fix: 文本提取不支持arrayString,arrayNumber等jsonSchema (#4079)
This commit is contained in:
parent
3f794baf2e
commit
bcd0b010a6
@ -9,7 +9,11 @@ import {
|
|||||||
import { ChatItemValueTypeEnum, ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
|
import { ChatItemValueTypeEnum, ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
|
||||||
import { createChatCompletion } from '../../../ai/config';
|
import { createChatCompletion } from '../../../ai/config';
|
||||||
import type { ContextExtractAgentItemType } from '@fastgpt/global/core/workflow/template/system/contextExtract/type';
|
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 { DispatchNodeResponseKeyEnum } from '@fastgpt/global/core/workflow/runtime/constants';
|
||||||
import type { ModuleDispatchProps } from '@fastgpt/global/core/workflow/runtime/type';
|
import type { ModuleDispatchProps } from '@fastgpt/global/core/workflow/runtime/type';
|
||||||
import { Prompt_ExtractJson } from '@fastgpt/global/core/ai/prompt/agent';
|
import { Prompt_ExtractJson } from '@fastgpt/global/core/ai/prompt/agent';
|
||||||
@ -192,8 +196,11 @@ ${description ? `- ${description}` : ''}
|
|||||||
}
|
}
|
||||||
> = {};
|
> = {};
|
||||||
extractKeys.forEach((item) => {
|
extractKeys.forEach((item) => {
|
||||||
|
const jsonSchema = (
|
||||||
|
toolValueTypeList.find((type) => type.value === item.valueType) || toolValueTypeList[0]
|
||||||
|
)?.jsonSchema;
|
||||||
properties[item.key] = {
|
properties[item.key] = {
|
||||||
type: item.valueType || 'string',
|
...jsonSchema,
|
||||||
description: item.desc,
|
description: item.desc,
|
||||||
...(item.enum ? { enum: item.enum.split('\n') } : {})
|
...(item.enum ? { enum: item.enum.split('\n') } : {})
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user