Skip to content

Commit

Permalink
feat: Retain model selection upon starting a new chat session
Browse files Browse the repository at this point in the history
  • Loading branch information
Neet-Nestor committed May 19, 2024
1 parent 434da32 commit 98264f6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 298 deletions.
125 changes: 0 additions & 125 deletions app/components/new-chat.module.scss

This file was deleted.

171 changes: 0 additions & 171 deletions app/components/new-chat.tsx

This file was deleted.

3 changes: 3 additions & 0 deletions app/store/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ export const useChatStore = createPersistStore(
},
};
session.topic = mask.name;
} else {
// inherit current model config
session.mask.modelConfig = this.currentSession().mask.modelConfig;
}

set((state) => ({
Expand Down
6 changes: 4 additions & 2 deletions app/store/mask.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BUILTIN_MASKS } from "../masks";
import { getLang, Lang } from "../locales";
import { DEFAULT_TOPIC, ChatMessage } from "./chat";
import { DEFAULT_TOPIC, ChatMessage, useChatStore } from "./chat";
import { ModelConfig, useAppConfig } from "./config";
import { StoreKey } from "../constant";
import { nanoid } from "nanoid";
Expand Down Expand Up @@ -33,7 +33,9 @@ export const createEmptyMask = () =>
name: DEFAULT_TOPIC,
context: [],
syncGlobalConfig: true, // use global config as default
modelConfig: { ...useAppConfig.getState().modelConfig },
modelConfig: {
...useAppConfig.getState().modelConfig,
},
lang: getLang(),
builtin: false,
createdAt: Date.now(),
Expand Down

0 comments on commit 98264f6

Please sign in to comment.