This commit is contained in:
Timothy J. Baek 2024-10-05 17:05:26 -07:00
parent a860e98ab9
commit 3dd1d1bc4a

View File

@ -2071,33 +2071,9 @@
{createMessagePair}
on:submit={async (e) => {
if (e.detail) {
// New user message
let userPrompt = e.detail.prompt;
let userMessageId = uuidv4();
let userMessage = {
id: userMessageId,
parentId: e.detail.parentId,
childrenIds: [],
role: 'user',
content: userPrompt,
models: selectedModels
};
let messageParentId = e.detail.parentId;
if (messageParentId !== null) {
history.messages[messageParentId].childrenIds = [
...history.messages[messageParentId].childrenIds,
userMessageId
];
}
history.messages[userMessageId] = userMessage;
history.currentId = userMessageId;
prompt = '';
await tick();
await sendPrompt(userPrompt, userMessageId);
submitPrompt(e.detail);
}
}}
/>