Commit 6992b396 by Liu

fix:提问自动进入子工作流

parent e9c54c3a
...@@ -43,7 +43,8 @@ function CheckIcon({ ...props }) { ...@@ -43,7 +43,8 @@ function CheckIcon({ ...props }) {
} }
export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ isLastAnswer, onTyping, onComplate, answer, isStopTyping, onSubmitQuestion, hideOperate, onWorkflowSubmit, isWorkflowSubmitting, isAsking = false }) => { export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ isLastAnswer, onTyping, onComplate, answer, isStopTyping, onSubmitQuestion, hideOperate, onWorkflowSubmit, isWorkflowSubmitting, isAsking = false }) => {
const displayAnswerText = resolveDisplayAnswerText(answer.answer || '') const answerSourceText = (answer as { workflowParseText?: string }).workflowParseText ?? answer.answer ?? ''
const displayAnswerText = resolveDisplayAnswerText(answerSourceText)
const formatAnswer = formatMarkdown(displayAnswerText) const formatAnswer = formatMarkdown(displayAnswerText)
const hasCards = Array.isArray(answer.cardList) && answer.cardList.length > 0 const hasCards = Array.isArray(answer.cardList) && answer.cardList.length > 0
const [displayedText, setDisplayedText] = useState('') const [displayedText, setDisplayedText] = useState('')
...@@ -123,6 +124,14 @@ export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ isLastAnswer ...@@ -123,6 +124,14 @@ export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ isLastAnswer
} }
useEffect(() => { useEffect(() => {
if (answer.endAnswerFlag) {
setDisplayedText(formatAnswer)
setCurrentIndex(formatAnswer.length)
setIsTyping(false)
}
}, [answer.endAnswerFlag, formatAnswer])
useEffect(() => {
if (isStopTyping) { if (isStopTyping) {
return return
} }
......
...@@ -20,7 +20,8 @@ interface ChatAnswerShowerProps { ...@@ -20,7 +20,8 @@ interface ChatAnswerShowerProps {
export const ChatAnswerShower: React.FC<ChatAnswerShowerProps> = ({ answer, isLastAnswer, onSubmitQuestion, hideOperate: hideOperateProp, onWorkflowSubmit, isWorkflowSubmitting, isAsking = false }) => { export const ChatAnswerShower: React.FC<ChatAnswerShowerProps> = ({ answer, isLastAnswer, onSubmitQuestion, hideOperate: hideOperateProp, onWorkflowSubmit, isWorkflowSubmitting, isAsking = false }) => {
const hideOperateByCard = (answer.cardList || []).some(attachment => attachment.type === 'box' || attachment?.type?.includes('card-')) const hideOperateByCard = (answer.cardList || []).some(attachment => attachment.type === 'box' || attachment?.type?.includes('card-'))
const hideOperate = hideOperateByCard || hideOperateProp const hideOperate = hideOperateByCard || hideOperateProp
const displayAnswerText = resolveDisplayAnswerText(answer.answer || '') const answerSourceText = (answer as { workflowParseText?: string }).workflowParseText ?? answer.answer ?? ''
const displayAnswerText = resolveDisplayAnswerText(answerSourceText)
const hasCards = Array.isArray(answer.cardList) && answer.cardList.length > 0 const hasCards = Array.isArray(answer.cardList) && answer.cardList.length > 0
// 历史首包静默记录隐藏卡片;流式/含工作流表单卡片需正常展示 // 历史首包静默记录隐藏卡片;流式/含工作流表单卡片需正常展示
const shouldRenderCards = hasCards && !( const shouldRenderCards = hasCards && !(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment