🐛 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({
|
||||
str,
|
||||
thought,
|
||||
prompt,
|
||||
end = false,
|
||||
files,
|
||||
}: {
|
||||
str?: string;
|
||||
thought?: string;
|
||||
// end param default is false
|
||||
prompt?: string;
|
||||
end?: boolean;
|
||||
files?: Array<any>;
|
||||
}) {
|
||||
|
|
@ -149,6 +150,9 @@ export default function FormModal({
|
|||
if (files) {
|
||||
newChat[newChat.length - 1].files = files;
|
||||
}
|
||||
if (prompt) {
|
||||
newChat[newChat.length - 1].template = prompt;
|
||||
}
|
||||
return newChat;
|
||||
});
|
||||
}
|
||||
|
|
@ -244,7 +248,10 @@ export default function FormModal({
|
|||
isStream = false;
|
||||
}
|
||||
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;
|
||||
thought?: string;
|
||||
files?: Array<{ data: string; type: string; data_type: string }>;
|
||||
prompt?: string;
|
||||
chatKey: string;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue