| | |
| | | }; |
| | | |
| | | const checkIsText = (item) => { |
| | | const isText = item?.content?.values?.some((item) => item?.content?.type === AnswerType.Knowledge); |
| | | const isText = item?.content?.values?.some((item) => item?.content?.type === AnswerType.Knowledge) || item?.conclusion?.length > 0; |
| | | return isText; |
| | | }; |
| | | |
| | | const getPlainText = (item) => { |
| | | let result = ''; |
| | | const knowledgeText = item.content.values |
| | | .filter((item) => { |
| | | const type = item?.content?.type; |
| | |
| | | .join('\n\n'); |
| | | return acc + answer; |
| | | }, ''); |
| | | return markdownToTxt(knowledgeText); |
| | | |
| | | const conclusionText = |
| | | item.conclusion |
| | | ?.filter((item) => !!item.report) |
| | | .map((item) => item.report) |
| | | .join('\n\n') ?? ''; |
| | | result += knowledgeText + conclusionText; |
| | | return markdownToTxt(result); |
| | | }; |
| | | |
| | | const likeClick = async (item) => { |
| | |
| | | isEnterStop = false; |
| | | const instance = BrowserSpeechSynthesis.getInstance(); |
| | | instance.cancel(); |
| | | activeSpeakItem.value = null; |
| | | }; |
| | | |
| | | const speechClick = (item) => { |
| | |
| | | activeSpeakItem.value = item; |
| | | |
| | | const instance = BrowserSpeechSynthesis.getInstance(); |
| | | instance.onEnd(() => { |
| | | resetSpeak(); |
| | | }); |
| | | if (isEnterStop) { |
| | | instance.resume(); |
| | | } else { |