From 8b3fcc00fe0374e8e55ec4cc154e5d8911211153 Mon Sep 17 00:00:00 2001 From: DebugIsFalse <511418503@qq.com> Date: Wed, 5 Jun 2024 14:04:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B8=B2=E6=9F=93=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/search/[id].vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pages/search/[id].vue b/pages/search/[id].vue index 004cdde..034615c 100644 --- a/pages/search/[id].vue +++ b/pages/search/[id].vue @@ -76,7 +76,8 @@ function initSearchItemInfo (info, records) { } function initSearchRecords (records) { data.value = records.map(item => { - let { answer, actions, question } = item + let { answer, actions, question, answer_type } = item + answer = answer_type === 'json' ? handleFormatReports(answer) : answer const historyItem = { article: answer, question, desLoading: false, searchLoading: false, ansLoading: false, showActions: true} // todo ?action为啥成了string? actions = typeof actions === 'string' ? JSON.parse(actions) : actions @@ -195,7 +196,7 @@ function handleFormatReports (content) { // todo let tableStart = '::ProseDataTable' let result = '' - // ::ProseLineChart{title='xxx' :labels='[]' :data='[]'} + // ::ProseLineChart{title='langchain-ai/langchain [2023-06-05,2024-06-04] Star Data' :labels='["2023-06-05","2023-06-12"]' :data='[43071,44946]'} content.forEach(item => { const { title, data, format } = item if (format === 'timeline') { @@ -205,7 +206,7 @@ function handleFormatReports (content) { labels.push(child.date) datas.push(child.stargazers) }) - result += `${chartStart}{title=${title} :labels=${JSON.stringify(labels)} :data=${JSON.stringify(datas)}}` + result += `${chartStart}{title='${title}' :labels='${JSON.stringify(labels)}' :data='${JSON.stringify(datas)}'}` } else if ( format === 'table' ) { result += `${tableStart}{:data=${JSON.stringify(data)}}` } -- GitLab