fix send params
This commit is contained in:
parent
d27326125b
commit
93a8e814d6
|
@ -16,7 +16,7 @@ interface Props {
|
||||||
messageError: boolean;
|
messageError: boolean;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
lightMode: "light" | "dark";
|
lightMode: "light" | "dark";
|
||||||
onSend: (message: Message, isResend?: boolean, deleteCount?: number) => void;
|
onSend: (message: Message, deleteCount?: number) => void;
|
||||||
onUpdateConversation: (conversation: Conversation, data: KeyValuePair) => void;
|
onUpdateConversation: (conversation: Conversation, data: KeyValuePair) => void;
|
||||||
onEditMessage: (message: Message, messageIndex: number) => void;
|
onEditMessage: (message: Message, messageIndex: number) => void;
|
||||||
stopConversationRef: MutableRefObject<boolean>;
|
stopConversationRef: MutableRefObject<boolean>;
|
||||||
|
@ -67,8 +67,6 @@ export const Chat: FC<Props> = ({ conversation, models, apiKey, serverSideApiKey
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
console.log("currentMessage", currentMessage);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative flex-1 overflow-none dark:bg-[#343541] bg-white">
|
<div className="relative flex-1 overflow-none dark:bg-[#343541] bg-white">
|
||||||
{!(apiKey || serverSideApiKeyIsSet) ? (
|
{!(apiKey || serverSideApiKeyIsSet) ? (
|
||||||
|
@ -145,7 +143,7 @@ export const Chat: FC<Props> = ({ conversation, models, apiKey, serverSideApiKey
|
||||||
}}
|
}}
|
||||||
onRegenerate={() => {
|
onRegenerate={() => {
|
||||||
if (currentMessage) {
|
if (currentMessage) {
|
||||||
onSend(currentMessage, true, 2);
|
onSend(currentMessage, 2);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -32,11 +32,11 @@ const Home: React.FC<HomeProps> = ({ serverSideApiKeyIsSet }) => {
|
||||||
|
|
||||||
const stopConversationRef = useRef<boolean>(false);
|
const stopConversationRef = useRef<boolean>(false);
|
||||||
|
|
||||||
const handleSend = async (message: Message, isResend = false, deleteCount = 0) => {
|
const handleSend = async (message: Message, deleteCount = 0) => {
|
||||||
if (selectedConversation) {
|
if (selectedConversation) {
|
||||||
let updatedConversation: Conversation;
|
let updatedConversation: Conversation;
|
||||||
|
|
||||||
if (isResend) {
|
if (deleteCount) {
|
||||||
const updatedMessages = [...selectedConversation.messages];
|
const updatedMessages = [...selectedConversation.messages];
|
||||||
for (let i = 0; i < deleteCount; i++) {
|
for (let i = 0; i < deleteCount; i++) {
|
||||||
updatedMessages.pop();
|
updatedMessages.pop();
|
||||||
|
|
Loading…
Reference in New Issue