Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
3. Remove chat configs
4. Command: /fork "question" -> fork chats to new pane. does not focus pane. /new -> opens new pane, with focus
5. Rename temperature db typo
6. Add max tokens to config
3 changes: 2 additions & 1 deletion src/components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { ConversationList } from "./conversations/Conversations";
import { useLocalStorage } from "./hooks/useLocalStorage";
import { ChatConfigList } from "./chat-config/ChatConfigList";
import { OpenAIKeyInput } from "./OpenAIKey";
import { OPEN_AI_KEY } from "../utils/openai";

export const Home = () => {
const [storedKey, setStoredKey] = useLocalStorage("openai-key", "");
const [storedKey, setStoredKey] = useLocalStorage(OPEN_AI_KEY, "");
return (
<main className={`flex flex-1`}>
<div className="grid flex-1 grid-cols-[minmax(200px,300px)_minmax(500px,1fr)] grid-rows-[1fr]">
Expand Down
87 changes: 0 additions & 87 deletions src/components/chat-config/ChatConfigContext.tsx

This file was deleted.

26 changes: 21 additions & 5 deletions src/components/chat-config/ChatConfigList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import { useLiveQuery } from "dexie-react-hooks";
import { dbSelectChatConfigs } from "../../db/db-selectors";
import { ChatConfigModal } from "./ChatConfigModal";
import { useOpenChatConfigShortcut as useStartChatShortcut } from "./useShortcut";
import { ChatConfig, db } from "../../db";
import { db } from "../../db";
import { ChatConfig } from "../../db/models";

export const ChatConfigList: FC = () => {
const chatConfigs = useLiveQuery(() => dbSelectChatConfigs(), []);
const chatConfigs = useLiveQuery(dbSelectChatConfigs, []);
useStartChatShortcut();
return (
<div className="mb-2 flex min-h-0 flex-1 flex-col bg-dark-gray">
Expand Down Expand Up @@ -66,14 +67,20 @@ const ChatConfigItem: FC<ChatConfigItemProps> = ({ chatConfig }) => {
? `⌥ + ${chatConfig.shortcut.toUpperCase()}`
: null;
})();

return (
<>
{isOpen && chatConfig !== "default" && (
<Portal>
<ChatConfigModal
initialChatConfig={chatConfig}
onClose={closePortal}
onSubmit={(p) => db.putChatConfig({ ...chatConfig, ...p })}
onSubmit={(modalChatConfig) => {
db.putChatConfig({
...chatConfig,
...modalChatConfig,
});
}}
/>
</Portal>
)}
Expand All @@ -84,7 +91,11 @@ const ChatConfigItem: FC<ChatConfigItemProps> = ({ chatConfig }) => {
onClick={onClick}
>
<span className="material-symbols-outlined mr-2 cursor-pointer text-[20px]">
file_open
{chatConfig !== "default" &&
// TODO: support multiple providers
chatConfig.providers[0]?.type === "godmode"
? "smart_toy"
: "file_open"}
</span>
<div className={"truncate text-[13px]"}>
{chatConfig === "default" ? "Default chat" : chatConfig.title}
Expand All @@ -111,7 +122,12 @@ const AddChatConfigButton: FC = () => {
<>
{isOpen && (
<Portal>
<ChatConfigModal onClose={closePortal} onSubmit={db.addChatConfig} />
<ChatConfigModal
onClose={closePortal}
onSubmit={(modalChatConfig) => {
db.addChatConfig(modalChatConfig);
}}
/>
</Portal>
)}
<div
Expand Down
Loading