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

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

...@@ -190,6 +190,16 @@ function handleFormatWebSource (source) { ...@@ -190,6 +190,16 @@ function handleFormatWebSource (source) {
} catch (error) {} } catch (error) {}
return sources 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 () { function handleSetNoPermission () {
askingData.value = {} askingData.value = {}
useRequestError(403) useRequestError(403)
...@@ -213,29 +223,33 @@ function handleFormFetchData (fetchData) { ...@@ -213,29 +223,33 @@ function handleFormFetchData (fetchData) {
handleStopGenerate() handleStopGenerate()
} }
if (meta.type === 'answer') { 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 return
} }
if (meta.type !== 'log') return if (meta.type !== 'log') return
switch (meta.action) {
if (meta.action === 'rephrase_question') { case 'rephrase_question' :
Object.assign(askingData.value, { description: choices[0].message.content, desLoading: true }) Object.assign(askingData.value, { description: choices[0].message.content, desLoading: true })
resetAutoBottom() break
return case 'search_file' :
} const source = choices[0].message.content
if (meta.action === 'search_file') { source = handleFormatSource(source)
let source = choices[0].message.content Object.assign(askingData.value, { desLoading: true, source, searchLoading: true, desLoading: false })
source = handleFormatSource(source) break
Object.assign(askingData.value, { desLoading: true, source, searchLoading: true, desLoading: false }) case 'search_web' :
resetAutoBottom() const sourceWeb = choices[0].message.content
return source = handleFormatWebSource(sourceWeb)
} Object.assign(askingData.value, { desLoading: true, source: sourceWeb, searchLoading: true, desLoading: false })
if (meta.action === 'search_web') { break
let source = choices[0].message.content case 'tool_select' :
source = handleFormatWebSource(source) // todo 按需求做
Object.assign(askingData.value, { desLoading: true, source, searchLoading: true, desLoading: false }) Object.assign(askingData.value, { toolsLoading: true })
resetAutoBottom() break
} }
resetAutoBottom()
} }
function handleCreateAiTitle () { function handleCreateAiTitle () {
if (isFirstCreate) { if (isFirstCreate) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册