From 05e0985f29a43dd63bf7a9845b0f8c8cd13270c6 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 29 Aug 2023 09:07:45 +0800 Subject: [PATCH] chore: match new dataset tool format (#1044) --- web/app/components/app/chat/thought/index.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/web/app/components/app/chat/thought/index.tsx b/web/app/components/app/chat/thought/index.tsx index 789c7bc26..df0d28481 100644 --- a/web/app/components/app/chat/thought/index.tsx +++ b/web/app/components/app/chat/thought/index.tsx @@ -37,12 +37,13 @@ const Thought: FC = ({ const getThoughtText = (item: ThoughtItem) => { try { const input = JSON.parse(item.tool_input) - + // dataset + if (item.tool.startsWith('dataset-')) { + const dataSetId = item.tool.replace('dataset-', '') + const datasetName = dataSets?.find(item => item.id === dataSetId)?.name || 'unknown dataset' + return t('explore.universalChat.thought.res.dataset').replace('{datasetName}', `${datasetName}`) + } switch (item.tool) { - case 'dataset': - // eslint-disable-next-line no-case-declarations - const datasetName = dataSets?.find(item => item.id === input.dataset_id)?.name || 'unknown dataset' - return t('explore.universalChat.thought.res.dataset').replace('{datasetName}', `${datasetName}`) case 'web_reader': return t(`explore.universalChat.thought.res.webReader.${!input.cursor ? 'normal' : 'hasPageInfo'}`).replace('{url}', `${input.url}`) case 'google_search':