mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-05-17 08:26:54 +08:00
chore: match new dataset tool format (#1044)
This commit is contained in:
parent
7b3314c5db
commit
05e0985f29
@ -37,12 +37,13 @@ const Thought: FC<IThoughtProps> = ({
|
|||||||
const getThoughtText = (item: ThoughtItem) => {
|
const getThoughtText = (item: ThoughtItem) => {
|
||||||
try {
|
try {
|
||||||
const input = JSON.parse(item.tool_input)
|
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}', `<span class="text-gray-700">${datasetName}</span>`)
|
||||||
|
}
|
||||||
switch (item.tool) {
|
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}', `<span class="text-gray-700">${datasetName}</span>`)
|
|
||||||
case 'web_reader':
|
case 'web_reader':
|
||||||
return t(`explore.universalChat.thought.res.webReader.${!input.cursor ? 'normal' : 'hasPageInfo'}`).replace('{url}', `<a href="${input.url}" class="text-[#155EEF]">${input.url}</a>`)
|
return t(`explore.universalChat.thought.res.webReader.${!input.cursor ? 'normal' : 'hasPageInfo'}`).replace('{url}', `<a href="${input.url}" class="text-[#155EEF]">${input.url}</a>`)
|
||||||
case 'google_search':
|
case 'google_search':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user