提交 1491c50e 编写于 作者: View Design's avatar View Design

Merge branch 'main' of gitcode.com:git_bot/ai-fe

......@@ -190,6 +190,16 @@ function handleFormatWebSource (source) {
} catch (error) {}
return sources
}
function handleFormatReports (content) {
let start = '::ProseLineChart'
let result = ''
content.forEach(item => {
const { title, data, columns } = item
let toStr = JSON.stringify({ title, data, columns })
result += `${start}{:data=${toStr}}`
})
return result
}
function handleSetNoPermission () {
askingData.value = {}
useRequestError(403)
......@@ -213,29 +223,33 @@ function handleFormFetchData (fetchData) {
handleStopGenerate()
}
if (meta.type === 'answer') {
Object.assign(askingData.value, { ansLoading: true, desLoading: false, searchLoading: false, article: message.choices[0].message.content, collapse: false })
// todo 处理chart图表
let article = message.choices[0].message.content
article = Array.isArray(article) ? handleFormatReports(article) : article
Object.assign(askingData.value, { ansLoading: true, desLoading: false, searchLoading: false, article, collapse: false })
return
}
if (meta.type !== 'log') return
if (meta.action === 'rephrase_question') {
switch (meta.action) {
case 'rephrase_question' :
Object.assign(askingData.value, { description: choices[0].message.content, desLoading: true })
resetAutoBottom()
return
}
if (meta.action === 'search_file') {
let source = choices[0].message.content
break
case 'search_file' :
const source = choices[0].message.content
source = handleFormatSource(source)
Object.assign(askingData.value, { desLoading: true, source, searchLoading: true, desLoading: false })
resetAutoBottom()
return
break
case 'search_web' :
const sourceWeb = choices[0].message.content
source = handleFormatWebSource(sourceWeb)
Object.assign(askingData.value, { desLoading: true, source: sourceWeb, searchLoading: true, desLoading: false })
break
case 'tool_select' :
// todo 按需求做
Object.assign(askingData.value, { toolsLoading: true })
break
}
if (meta.action === 'search_web') {
let source = choices[0].message.content
source = handleFormatWebSource(source)
Object.assign(askingData.value, { desLoading: true, source, searchLoading: true, desLoading: false })
resetAutoBottom()
}
}
function handleCreateAiTitle () {
if (isFirstCreate) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册