feat: simplify query and histories initialization in debug API handler
This commit is contained in:
@@ -173,128 +173,121 @@ async function handler(
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const query: UserChatItemValueItemType[] = requestQuery || [
|
const query: UserChatItemValueItemType[] = requestQuery || [];
|
||||||
{
|
const histories: ChatItemType[] = requestHistories || [];
|
||||||
type: ChatItemValueTypeEnum.text,
|
// || [
|
||||||
|
// {
|
||||||
text: {
|
// dataId: 'debug-history-1',
|
||||||
content: 'Cancel'
|
// obj: ChatRoleEnum.Human,
|
||||||
}
|
// value: [
|
||||||
}
|
// {
|
||||||
];
|
// type: ChatItemValueTypeEnum.text,
|
||||||
const histories: ChatItemType[] = requestHistories || [
|
// text: {
|
||||||
{
|
// content: '启动工作流'
|
||||||
dataId: 'debug-history-1',
|
// }
|
||||||
obj: ChatRoleEnum.Human,
|
// }
|
||||||
value: [
|
// ]
|
||||||
{
|
// },
|
||||||
type: ChatItemValueTypeEnum.text,
|
// {
|
||||||
text: {
|
// dataId: 'debug-history-2',
|
||||||
content: '启动工作流'
|
// obj: ChatRoleEnum.AI,
|
||||||
}
|
// value: [
|
||||||
}
|
// {
|
||||||
]
|
// type: ChatItemValueTypeEnum.interactive,
|
||||||
},
|
// interactive: {
|
||||||
{
|
// type: 'userSelect',
|
||||||
dataId: 'debug-history-2',
|
// params: {
|
||||||
obj: ChatRoleEnum.AI,
|
// description: '请选择操作',
|
||||||
value: [
|
// userSelectOptions: [
|
||||||
{
|
// { value: 'Confirm', key: 'option1' },
|
||||||
type: ChatItemValueTypeEnum.interactive,
|
// { value: 'Cancel', key: 'option2' }
|
||||||
interactive: {
|
// ],
|
||||||
type: 'userSelect',
|
// // 已选择的值,使得此交互不会被getLastInteractiveValue返回
|
||||||
params: {
|
// userSelectedVal: 'Confirm'
|
||||||
description: '请选择操作',
|
// },
|
||||||
userSelectOptions: [
|
// entryNodeIds: ['nodeId1'],
|
||||||
{ value: 'Confirm', key: 'option1' },
|
// memoryEdges: [
|
||||||
{ value: 'Cancel', key: 'option2' }
|
// {
|
||||||
],
|
// source: 'workflowStartNodeId',
|
||||||
// 已选择的值,使得此交互不会被getLastInteractiveValue返回
|
// target: 'nodeId1',
|
||||||
userSelectedVal: 'Confirm'
|
// sourceHandle: 'workflowStartNodeId-source-right',
|
||||||
},
|
// targetHandle: 'nodeId1-target-left',
|
||||||
entryNodeIds: ['nodeId1'],
|
// status: 'active'
|
||||||
memoryEdges: [
|
// }
|
||||||
{
|
// ],
|
||||||
source: 'workflowStartNodeId',
|
// nodeOutputs: [
|
||||||
target: 'nodeId1',
|
// {
|
||||||
sourceHandle: 'workflowStartNodeId-source-right',
|
// nodeId: 'workflowStartNodeId',
|
||||||
targetHandle: 'nodeId1-target-left',
|
// key: NodeOutputKeyEnum.userChatInput,
|
||||||
status: 'active'
|
// value: '启动工作流'
|
||||||
}
|
// }
|
||||||
],
|
// ]
|
||||||
nodeOutputs: [
|
// }
|
||||||
{
|
// }
|
||||||
nodeId: 'workflowStartNodeId',
|
// ]
|
||||||
key: NodeOutputKeyEnum.userChatInput,
|
// },
|
||||||
value: '启动工作流'
|
// {
|
||||||
}
|
// dataId: 'bglb040v1wPQ3C1iNaDStPhm',
|
||||||
]
|
// obj: ChatRoleEnum.AI, // 使用枚举值
|
||||||
}
|
// value: [
|
||||||
}
|
// {
|
||||||
]
|
// type: ChatItemValueTypeEnum.interactive, // 使用枚举值
|
||||||
},
|
// interactive: {
|
||||||
{
|
// type: 'userSelect',
|
||||||
dataId: 'bglb040v1wPQ3C1iNaDStPhm',
|
// params: {
|
||||||
obj: ChatRoleEnum.AI, // 使用枚举值
|
// description: '你是谁',
|
||||||
value: [
|
// userSelectOptions: [
|
||||||
{
|
// {
|
||||||
type: ChatItemValueTypeEnum.interactive, // 使用枚举值
|
// value: 'Confirm',
|
||||||
interactive: {
|
// key: 'option1'
|
||||||
type: 'userSelect',
|
// },
|
||||||
params: {
|
// {
|
||||||
description: '你是谁',
|
// value: 'Cancel',
|
||||||
userSelectOptions: [
|
// key: 'option2'
|
||||||
{
|
// },
|
||||||
value: 'Confirm',
|
// {
|
||||||
key: 'option1'
|
// value: 'wqeqweqwe',
|
||||||
},
|
// key: 'y7eOdrYzYS5C'
|
||||||
{
|
// }
|
||||||
value: 'Cancel',
|
// ]
|
||||||
key: 'option2'
|
// // 重要:这里没有 userSelectedVal,所以这个交互会被getLastInteractiveValue返回
|
||||||
},
|
// },
|
||||||
{
|
// entryNodeIds: ['oQKWr1cGFVBG'],
|
||||||
value: 'wqeqweqwe',
|
// memoryEdges: [
|
||||||
key: 'y7eOdrYzYS5C'
|
// {
|
||||||
}
|
// source: 'workflowStartNodeId',
|
||||||
]
|
// target: 'oQKWr1cGFVBG',
|
||||||
// 重要:这里没有 userSelectedVal,所以这个交互会被getLastInteractiveValue返回
|
// sourceHandle: 'workflowStartNodeId-source-right',
|
||||||
},
|
// targetHandle: 'oQKWr1cGFVBG-target-left',
|
||||||
entryNodeIds: ['oQKWr1cGFVBG'],
|
// status: 'waiting'
|
||||||
memoryEdges: [
|
// },
|
||||||
{
|
// {
|
||||||
source: 'workflowStartNodeId',
|
// source: 'oQKWr1cGFVBG',
|
||||||
target: 'oQKWr1cGFVBG',
|
// target: 'uFnqha6Nx9qw',
|
||||||
sourceHandle: 'workflowStartNodeId-source-right',
|
// sourceHandle: 'oQKWr1cGFVBG-source-option1',
|
||||||
targetHandle: 'oQKWr1cGFVBG-target-left',
|
// targetHandle: 'uFnqha6Nx9qw-target-left',
|
||||||
status: 'waiting'
|
// status: 'waiting'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
source: 'oQKWr1cGFVBG',
|
// source: 'oQKWr1cGFVBG',
|
||||||
target: 'uFnqha6Nx9qw',
|
// target: '7kwgL1dVlwG6',
|
||||||
sourceHandle: 'oQKWr1cGFVBG-source-option1',
|
// sourceHandle: 'oQKWr1cGFVBG-source-option2',
|
||||||
targetHandle: 'uFnqha6Nx9qw-target-left',
|
// targetHandle: '7kwgL1dVlwG6-target-left',
|
||||||
status: 'waiting'
|
// status: 'waiting'
|
||||||
},
|
// }
|
||||||
{
|
// ],
|
||||||
source: 'oQKWr1cGFVBG',
|
// nodeOutputs: [
|
||||||
target: '7kwgL1dVlwG6',
|
// {
|
||||||
sourceHandle: 'oQKWr1cGFVBG-source-option2',
|
// nodeId: 'workflowStartNodeId',
|
||||||
targetHandle: '7kwgL1dVlwG6-target-left',
|
// key: NodeOutputKeyEnum.userChatInput,
|
||||||
status: 'waiting'
|
// value: 'Confirm'
|
||||||
}
|
// }
|
||||||
],
|
// ]
|
||||||
nodeOutputs: [
|
// }
|
||||||
{
|
// }
|
||||||
nodeId: 'workflowStartNodeId',
|
// ]
|
||||||
key: NodeOutputKeyEnum.userChatInput,
|
// }
|
||||||
value: 'Confirm'
|
// ];
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
/* user auth */
|
/* user auth */
|
||||||
const [{ teamId, tmbId }, { app }] = await Promise.all([
|
const [{ teamId, tmbId }, { app }] = await Promise.all([
|
||||||
authCert({
|
authCert({
|
||||||
|
|||||||
Reference in New Issue
Block a user