fix (PaLM2): messages will properly regenerate (#368)

* making progress to fix regen for PaLM

* fix (PaLM2): messages will properly regenerate
This commit is contained in:
Danny Avila 2023-05-23 06:55:23 -04:00 committed by GitHub
parent b8c3ae5e8f
commit 112c6c5b19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 9 deletions

View file

@ -1,8 +1,7 @@
import { useEffect, useState } from 'react';
import { useRecoilValue, useRecoilState, useResetRecoilState, useSetRecoilState } from 'recoil';
import { useEffect } from 'react';
import { useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil';
import { SSE } from '~/data-provider/sse.mjs';
import createPayload from '~/data-provider/createPayload';
import { useAbortRequestWithMessage } from '~/data-provider';
import store from '~/store';
import { useAuthContext } from '~/hooks/AuthContext';
@ -117,8 +116,11 @@ export default function MessageHandler() {
const { requestMessage, responseMessage, conversation } = data;
// update the messages
if (isRegenerate) setMessages([...messages, responseMessage]);
else setMessages([...messages, requestMessage, responseMessage]);
if (isRegenerate) {
setMessages([...messages, responseMessage]);
} else {
setMessages([...messages, requestMessage, responseMessage]);
}
setIsSubmitting(false);
// refresh title