🐛 fix(formModal): add support for prompt in updateLastMessage function to update chat message template
🔀 merge(types): add prompt property to ChatMessageType to support chat message templates
This commit is contained in:
parent
de08475bdf
commit
00c1a946c0
2 changed files with 10 additions and 2 deletions
|
|
@ -124,12 +124,13 @@ export default function FormModal({
|
||||||
function updateLastMessage({
|
function updateLastMessage({
|
||||||
str,
|
str,
|
||||||
thought,
|
thought,
|
||||||
|
prompt,
|
||||||
end = false,
|
end = false,
|
||||||
files,
|
files,
|
||||||
}: {
|
}: {
|
||||||
str?: string;
|
str?: string;
|
||||||
thought?: string;
|
thought?: string;
|
||||||
// end param default is false
|
prompt?: string;
|
||||||
end?: boolean;
|
end?: boolean;
|
||||||
files?: Array<any>;
|
files?: Array<any>;
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -149,6 +150,9 @@ export default function FormModal({
|
||||||
if (files) {
|
if (files) {
|
||||||
newChat[newChat.length - 1].files = files;
|
newChat[newChat.length - 1].files = files;
|
||||||
}
|
}
|
||||||
|
if (prompt) {
|
||||||
|
newChat[newChat.length - 1].template = prompt;
|
||||||
|
}
|
||||||
return newChat;
|
return newChat;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -244,7 +248,10 @@ export default function FormModal({
|
||||||
isStream = false;
|
isStream = false;
|
||||||
}
|
}
|
||||||
if (data.type === "stream" && isStream) {
|
if (data.type === "stream" && isStream) {
|
||||||
updateLastMessage({ str: data.message });
|
if (data.prompt) {
|
||||||
|
} else {
|
||||||
|
updateLastMessage({ str: data.message });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,6 @@ export type ChatMessageType = {
|
||||||
isSend: boolean;
|
isSend: boolean;
|
||||||
thought?: string;
|
thought?: string;
|
||||||
files?: Array<{ data: string; type: string; data_type: string }>;
|
files?: Array<{ data: string; type: string; data_type: string }>;
|
||||||
|
prompt?: string;
|
||||||
chatKey: string;
|
chatKey: string;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue