From 40f61dd6f9c6eed1e43444bf640671f80eb58566 Mon Sep 17 00:00:00 2001 From: ecwu Date: Sun, 5 Jan 2025 19:43:57 +0800 Subject: [PATCH] refactor: update button labels and improve dialog for saving tools templates --- src/components/ListAPI.tsx | 2 +- src/components/MessageBubble.tsx | 52 -------------------- src/components/Settings.tsx | 83 ++++++++++++++++++++++++-------- src/pages/App.tsx | 2 +- src/translate/zh_CN.ts | 2 + 5 files changed, 68 insertions(+), 73 deletions(-) diff --git a/src/components/ListAPI.tsx b/src/components/ListAPI.tsx index c854089..ee61de4 100644 --- a/src/components/ListAPI.tsx +++ b/src/components/ListAPI.tsx @@ -139,7 +139,7 @@ function ToolsDropdownList() { return ( - {Tr(`Saved tools templates`)} + {Tr(`Tools`)} - ); - const CopiedHint = () => ( -
- - - - {Tr("Message copied to clipboard!")} -
- ); const { toast } = useToast(); const copyToClipboard = async (text: string) => { @@ -309,20 +271,6 @@ export default function Message(props: { messageIndex: number }) { } }; - const CopyIcon = ({ textToCopy }: { textToCopy: string }) => { - return ( - <> - - - ); - }; - return ( <> {chatStore.postBeginIndex !== 0 && diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 70a904a..cd9b34f 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -53,6 +53,7 @@ import { } from "@/components/ui/select"; import { Dialog, + DialogClose, DialogContent, DialogDescription, DialogFooter, @@ -73,6 +74,7 @@ import { KeyIcon, ListIcon, MoveHorizontalIcon, + SaveIcon, TriangleAlertIcon, } from "lucide-react"; import { Separator } from "@/components/ui/separator"; @@ -581,25 +583,68 @@ export default (props: {}) => {
{ctx.chatStore.toolsString.trim() && ( - + + + + + + + Save the tool as Template + + Once saved, you can easily access your tools from + the dropdown menu. + + +
+
+ + + +
+
+ + + + + +
+
)}
diff --git a/src/pages/App.tsx b/src/pages/App.tsx index b4e7d20..15e9a32 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -115,7 +115,7 @@ import { import { Badge } from "@/components/ui/badge"; import { ModeToggle } from "@/components/ModeToggle"; -import Navbar from "@/components/navbar"; +import Navbar from "@/components/Navbar"; export function App() { // init selected index diff --git a/src/translate/zh_CN.ts b/src/translate/zh_CN.ts index a4eeb3a..edf60cd 100644 --- a/src/translate/zh_CN.ts +++ b/src/translate/zh_CN.ts @@ -11,6 +11,8 @@ const LANG_MAP: Record = { cost: "消费", stream: "流式返回", fetch: "一次获取", + Tools: "工具", + Clear: "清空", "saved api templates": "已保存的 API 模板", "saved prompt templates": "已保存的提示模板", "no chat history here": "暂无历史对话记录",