feat:add Stop Responding

This commit is contained in:
GotoFox 2023-04-13 13:56:49 +08:00
parent 86fb36163c
commit 62a38577ae
9 changed files with 31 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import { memo, useState, useRef, useEffect, useLayoutEffect } from "react";
import SendWhiteIcon from "../icons/send-white.svg";
import BrainIcon from "../icons/brain.svg";
import StopIcon from "../icons/stop.svg";
import ExportIcon from "../icons/share.svg";
import ReturnIcon from "../icons/return.svg";
import CopyIcon from "../icons/copy.svg";
@ -767,6 +768,28 @@ export function Chat(props: {
})}
</div>
<div style={{ bottom: "103px" }} className={chatStyle["prompt-toast"]}>
{session.messages.length > 0 &&
session.messages[session.messages.length - 1].streaming && (
<div
className={chatStyle["prompt-toast-inner"] + " clickable"}
role="button"
onClick={() => {
const lastMessage =
session.messages[session.messages.length - 1];
if (lastMessage?.id) {
onUserStop(lastMessage.id);
}
}}
>
<StopIcon />
<span className={chatStyle["prompt-toast-content"]}>
{Locale.Chat.Actions.stopResponding}
</span>
</div>
)}
</div>
<div className={styles["chat-input-panel"]}>
<PromptHints prompts={promptHints} onPromptSelect={onPromptSelect} />

1
app/icons/stop.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1681271256616" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2643" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M512 967.111111c-250.311111 0-455.111111-204.8-455.111111-455.111111s204.8-455.111111 455.111111-455.111111 455.111111 204.8 455.111111 455.111111-204.8 455.111111-455.111111 455.111111z m0-56.888889c221.866667 0 398.222222-176.355556 398.222222-398.222222s-176.355556-398.222222-398.222222-398.222222-398.222222 176.355556-398.222222 398.222222 176.355556 398.222222 398.222222 398.222222z" fill="#323232" p-id="2644"></path><path d="M341.333333 341.333333h341.333334v341.333334H341.333333z" fill="#323232" p-id="2645"></path></svg>

After

Width:  |  Height:  |  Size: 864 B

View File

@ -17,6 +17,7 @@ const cn = {
Copy: "复制",
Stop: "停止",
Retry: "重试",
stopResponding: "停止响应",
},
Rename: "重命名对话",
Typing: "正在输入…",

View File

@ -19,6 +19,7 @@ const en: LocaleType = {
Copy: "Copy",
Stop: "Stop",
Retry: "Retry",
stopResponding: "Stop Responding",
},
Rename: "Rename Chat",
Typing: "Typing…",

View File

@ -19,6 +19,7 @@ const es: LocaleType = {
Copy: "Copiar",
Stop: "Detener",
Retry: "Reintentar",
stopResponding: "Deja de responder",
},
Rename: "Renombrar chat",
Typing: "Escribiendo...",

View File

@ -19,6 +19,7 @@ const it: LocaleType = {
Copy: "Copia",
Stop: "Stop",
Retry: "Riprova",
stopResponding: "cessa di rispondere",
},
Rename: "Rinomina Chat",
Typing: "Typing…",

View File

@ -18,6 +18,7 @@ const jp = {
Copy: "コピー",
Stop: "停止",
Retry: "リトライ",
stopResponding: "応答を停止する",
},
Rename: "チャットの名前を変更",
Typing: "入力中…",

View File

@ -19,6 +19,7 @@ const tr: LocaleType = {
Copy: "Kopyala",
Stop: "Durdur",
Retry: "Tekrar Dene",
stopResponding: "yanıt vermemeyi durdur",
},
Rename: "Sohbeti Yeniden Adlandır",
Typing: "Yazıyor…",

View File

@ -18,6 +18,7 @@ const tw: LocaleType = {
Copy: "複製",
Stop: "停止",
Retry: "重試",
stopResponding: "停止响应",
},
Rename: "重命名對話",
Typing: "正在輸入…",