Fix (PaLM2): Persist PaLM presets after initial message (#366)

* refactor(askGoogle.js): extract saveConvo function call to a separate function
feat(askGoogle.js): add endpoint property to the conversation object
refactor(handleSubmit.js): rename chatGptLabel to modelLabel in useMessageHandler function

* refactor(askGoogle.js): remove unused endpointOption spread operator
This commit is contained in:
Danny Avila 2023-05-22 20:50:10 -04:00 committed by GitHub
parent 4eda4542b7
commit 07fa0f39fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -119,6 +119,13 @@ const ask = async ({ text, endpointOption, parentMessageId = null, conversationI
abortController
});
await saveConvo(req.user.id, {
...endpointOption,
...endpointOption.modelOptions,
conversationId,
endpoint: 'google'
});
await saveMessage(response);
sendMessage(res, {
title: await getConvoTitle(req.user.id, conversationId),
@ -132,7 +139,7 @@ const ask = async ({ text, endpointOption, parentMessageId = null, conversationI
if (parentMessageId == '00000000-0000-0000-0000-000000000000') {
const title = await titleConvo({ text, response });
await saveConvo(req.user.id, {
conversationId: conversationId,
conversationId,
title
});
}

View file

@ -50,7 +50,7 @@ const useMessageHandler = () => {
currentConversation?.model ??
endpointsConfig[endpoint]?.availableModels?.[0] ??
'chat-bison',
chatGptLabel: currentConversation?.chatGptLabel ?? null,
modelLabel: currentConversation?.modelLabel ?? null,
promptPrefix: currentConversation?.promptPrefix ?? null,
examples: currentConversation?.examples ?? [
{ input: { content: '' }, output: { content: '' } }