fix: chat variable update (#3156)

* perf: file encoding

* fix: chat variable update
This commit is contained in:
Archer
2024-11-14 15:50:47 +08:00
committed by shilin66
parent f0f7f6d3a0
commit c915c7ade7
7 changed files with 23 additions and 11 deletions

View File

@@ -323,7 +323,7 @@ const ChatBox = (
})
};
} else if (event === SseResponseEventEnum.updateVariables && variables) {
variablesForm.reset(variables);
variablesForm.setValue('variables', variables);
} else if (event === SseResponseEventEnum.interactive) {
const val: AIChatItemValueItemType = {
type: ChatItemValueTypeEnum.interactive,
@@ -408,7 +408,7 @@ const ChatBox = (
isInteractivePrompt = false
}) => {
variablesForm.handleSubmit(
async ({ variables }) => {
async ({ variables = {} }) => {
if (!onStartChat) return;
if (isChatting) {
toast({
@@ -435,7 +435,7 @@ const ChatBox = (
// Only declared variables are kept
const requestVariables: Record<string, any> = {};
allVariableList?.forEach((item) => {
requestVariables[item.key] = variables[item.key] || '';
requestVariables[item.key] = variables[item.key];
});
const responseChatId = getNanoid(24);