|
|
@@ -353,8 +353,19 @@ const sendAction = async (action: string) => {
|
|
|
|
|
|
|
|
|
|
|
|
+ // 提取当前页面中 type 为 'text' 的元素的纯文本内容
|
|
|
+ const textContents = slidesStore.currentSlide?.elements
|
|
|
+ .filter((element: any) => element.type === 'text')
|
|
|
+ .map((textElement: any) => {
|
|
|
+ // 创建一个临时元素来解析 HTML 并提取纯文本
|
|
|
+ const tempElement = document.createElement('div')
|
|
|
+ tempElement.innerHTML = textElement.content
|
|
|
+ return tempElement.textContent || tempElement.innerText || ''
|
|
|
+ })
|
|
|
+ .filter(content => content.trim() !== '') || []
|
|
|
+ console.log('textContents', textContents)
|
|
|
const prompt = `
|
|
|
- #当前页面内容 ${JSON.stringify(slidesStore.currentSlide || '')}
|
|
|
+ #当前页面内容 ${textContents.length > 0 ? textContents.join('\n') : '无文本内容'}
|
|
|
#query: ${action}
|
|
|
`
|
|
|
chat_stream(prompt, agentid2.value, props.userid || '', lang.lang, (event) => {
|