stop button

This commit is contained in:
YasinOnm08 2024-10-01 14:29:15 +02:00
parent 39ea1a2954
commit 9453dd1349
3 changed files with 94 additions and 13 deletions

View file

@ -176,7 +176,7 @@ const InputOutputBackend: React.FC = () => {
}
}
setInputMessage("")
postWorkerRef.current.postMessage({ messages: [...messages, { role: "user", content: inputValue }], ai_model: localStorage.getItem('model'), model_type: type, access_token: accessToken, api_key: api_key })
postWorkerRef.current.postMessage({ messages: [...messages, { role: "user", content: inputValue }], ai_model: "llama3.2", model_type: type, access_token: accessToken, api_key: api_key })
startGetWorker()
}
}
@ -226,6 +226,11 @@ const InputOutputBackend: React.FC = () => {
}
};
const handleStopClick = () => {
endGetWorker()
getNewToken()
}
const handleResendClick = () => {
var temporary_message = messages[messages.length - 2]['content']
const updatedMessages = messages.slice(0, -2)
@ -272,6 +277,7 @@ const InputOutputBackend: React.FC = () => {
<ConversationFrontend
ref={conversationRef}
messages={messages}
onStopClick={handleStopClick}
onResendClick={handleResendClick}
onEditClick={handleEditClick}
onCopyClick={handleCopyClick}