diff --git a/src/components/ListAPI.tsx b/src/components/ListAPI.tsx
index 1513262..9f2bb99 100644
--- a/src/components/ListAPI.tsx
+++ b/src/components/ListAPI.tsx
@@ -226,110 +226,116 @@ function ChatTemplateDropdownList() {
);
}
+const ChatTemplateItem = ({
+ t,
+ index,
+}: {
+ t: TemplateChatStore;
+ index: number;
+}) => {
+ const [dialogOpen, setDialogOpen] = React.useState(false);
+ const { chatStore, setChatStore } = useContext(AppChatStoreContext);
+ const { templates, setTemplates } = useContext(AppContext);
+
+ return (
+
+
+ {
+ // Update chatStore with the selected template
+ if (
+ chatStore.history.length > 0 ||
+ chatStore.systemMessageContent
+ ) {
+ console.log("you clicked", t.name);
+ const confirm = window.confirm(
+ "This will replace the current chat history. Are you sure?"
+ );
+ if (!confirm) return;
+ }
+ setChatStore({ ...newChatStore({ ...chatStore, ...t }) });
+ }}
+ className={cn(
+ "flex flex-row justify-between items-center select-none space-y-1 rounded-md p-3 leading-none no-underline outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"
+ )}
+ >
+ {t.name}
+ e.stopPropagation()}>
+
+
+
+
+
+ );
+};
+
const APIListMenu: React.FC = () => {
const ctx = useContext(AppContext);
return (