fix: 文本提取不支持arrayString,arrayNumber等jsonSchema (#4079)

This commit is contained in:
shilin 2025-03-11 14:09:26 +08:00 committed by archer
parent 3f794baf2e
commit bcd0b010a6
No known key found for this signature in database
GPG Key ID: 4446499B846D4A9E

View File

@ -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') } : {})
};