From a4b8ed441cdef369bcf7eb3982f76522230df280 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Tue, 7 Jan 2025 18:58:23 +0800 Subject: [PATCH 1/2] bring Chat Template back --- src/components/ListAPI.tsx | 52 +++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/src/components/ListAPI.tsx b/src/components/ListAPI.tsx index 81f29e0..d32a62a 100644 --- a/src/components/ListAPI.tsx +++ b/src/components/ListAPI.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { ChatStore, TemplateAPI } from "@/types/chatstore"; +import { ChatStore, TemplateAPI, TemplateChatStore } from "@/types/chatstore"; import { Tr } from "@/translate"; import { @@ -32,6 +32,7 @@ import { import { BrushIcon } from "lucide-react"; import { useToast } from "@/hooks/use-toast"; +import { newChatStore } from "@/types/newChatstore"; interface APITemplateDropdownProps { label: string; @@ -186,6 +187,54 @@ function ToolsDropdownList() { ); } +function ChatTemplateDropdownList() { + const ctx = useContext(AppContext); + if (!ctx) return
error
; + + const { chatStore, setChatStore, templates } = ctx; + + return ( + + + Chat Template + Chat Template + + + + + + ); +} + const APIListMenu: React.FC = () => { const ctx = useContext(AppContext); if (!ctx) return
error
; @@ -194,6 +243,7 @@ const APIListMenu: React.FC = () => { {ctx.templateTools.length > 0 && } + {ctx.templates.length > 0 && } {ctx.templateAPIs.length > 0 && ( Date: Tue, 7 Jan 2025 18:59:30 +0800 Subject: [PATCH 2/2] save api to chat template --- src/components/Settings.tsx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index e5e0e5d..c4bff53 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -944,14 +944,6 @@ export default (props: {}) => { ctx.chatStore ); tmp.history = tmp.history.filter((h) => h.example); - tmp.apiEndpoint = ""; - tmp.apiKey = ""; - tmp.whisper_api = ""; - tmp.whisper_key = ""; - tmp.tts_api = ""; - tmp.tts_key = ""; - tmp.image_gen_api = ""; - tmp.image_gen_key = ""; // @ts-ignore tmp.name = name; ctx.templates.push(tmp as TemplateChatStore);