From bcd0b010a6f5d1983353542048c5243d5929761d Mon Sep 17 00:00:00 2001 From: shilin <39396378+shilin66@users.noreply.github.com> Date: Tue, 11 Mar 2025 14:09:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=87=E6=9C=AC=E6=8F=90=E5=8F=96?= =?UTF-8?q?=E4=B8=8D=E6=94=AF=E6=8C=81arrayString,arrayNumber=E7=AD=89json?= =?UTF-8?q?Schema=20(#4079)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/core/workflow/dispatch/agent/extract.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/service/core/workflow/dispatch/agent/extract.ts b/packages/service/core/workflow/dispatch/agent/extract.ts index 431bdb4f6..0c974e786 100644 --- a/packages/service/core/workflow/dispatch/agent/extract.ts +++ b/packages/service/core/workflow/dispatch/agent/extract.ts @@ -9,7 +9,11 @@ import { import { ChatItemValueTypeEnum, ChatRoleEnum } from '@fastgpt/global/core/chat/constants'; import { createChatCompletion } from '../../../ai/config'; import type { ContextExtractAgentItemType } from '@fastgpt/global/core/workflow/template/system/contextExtract/type'; -import { NodeInputKeyEnum, NodeOutputKeyEnum } from '@fastgpt/global/core/workflow/constants'; +import { + NodeInputKeyEnum, + NodeOutputKeyEnum, + toolValueTypeList +} from '@fastgpt/global/core/workflow/constants'; import { DispatchNodeResponseKeyEnum } from '@fastgpt/global/core/workflow/runtime/constants'; import type { ModuleDispatchProps } from '@fastgpt/global/core/workflow/runtime/type'; import { Prompt_ExtractJson } from '@fastgpt/global/core/ai/prompt/agent'; @@ -192,8 +196,11 @@ ${description ? `- ${description}` : ''} } > = {}; extractKeys.forEach((item) => { + const jsonSchema = ( + toolValueTypeList.find((type) => type.value === item.valueType) || toolValueTypeList[0] + )?.jsonSchema; properties[item.key] = { - type: item.valueType || 'string', + ...jsonSchema, description: item.desc, ...(item.enum ? { enum: item.enum.split('\n') } : {}) };