diff --git a/src/components/Option/Prompt/index.tsx b/src/components/Option/Prompt/index.tsx index 141bdf6..f0d1c19 100644 --- a/src/components/Option/Prompt/index.tsx +++ b/src/components/Option/Prompt/index.tsx @@ -8,16 +8,12 @@ import { Input, Form, Switch, + Segmented } from "antd" import { Trash2, Pen, Computer, Zap } from "lucide-react" import { useState } from "react" import { useTranslation } from "react-i18next" -import { - deletePromptById, - getAllPrompts, - savePrompt, - updatePrompt -} from "@/db" +import { deletePromptById, getAllPrompts, savePrompt, updatePrompt } from "@/db" export const PromptBody = () => { const queryClient = useQueryClient() @@ -27,7 +23,9 @@ export const PromptBody = () => { const [createForm] = Form.useForm() const [editForm] = Form.useForm() const { t } = useTranslation("settings") - + const [selectedSegment, setSelectedSegment] = useState<"custom" | "copilot">( + "custom" + ) const { data, status } = useQuery({ queryKey: ["fetchAllPrompts"], queryFn: getAllPrompts @@ -103,8 +101,8 @@ export const PromptBody = () => { } }) - return ( -
+ function customPrompts() { + return (
@@ -127,30 +125,38 @@ export const PromptBody = () => { title: t("managePrompts.columns.title"), dataIndex: "title", key: "title", - render: (content) => ({content}) + render: (content) => ( + {content} + ) }, { title: t("managePrompts.columns.prompt"), dataIndex: "content", key: "content", - render: (content) => ({content}) + render: (content) => ( + {content} + ) }, { title: t("managePrompts.columns.type"), dataIndex: "is_system", key: "is_system", - render: (is_system) => + render: (is_system) => ( {is_system ? ( <> - {t("managePrompts.systemPrompt")} + {" "} + {t("managePrompts.systemPrompt")} ) : ( <> - {t("managePrompts.quickPrompt")} + {" "} + {t("managePrompts.quickPrompt")} )} - }, + + ) + }, { title: t("managePrompts.columns.actions"), render: (_, record) => ( @@ -189,6 +195,29 @@ export const PromptBody = () => { /> )}
+ ) + } + return ( +
+
+ { + setSelectedSegment(value as "custom" | "copilot") + }} + /> +
+ {selectedSegment === "custom" && customPrompts()}