mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 23:56:39 +08:00
优化新建窗口可以继承模型配置
This commit is contained in:
parent
1b1ad3201a
commit
941f40afb5
@ -130,6 +130,7 @@ function useDragSideBar() {
|
|||||||
export function SideBar(props: { className?: string }) {
|
export function SideBar(props: { className?: string }) {
|
||||||
const chatStore = useChatStore();
|
const chatStore = useChatStore();
|
||||||
|
|
||||||
|
const currentModel = chatStore.currentSession().mask.modelConfig.model;
|
||||||
// drag side bar
|
// drag side bar
|
||||||
const { onDragStart, shouldNarrow } = useDragSideBar();
|
const { onDragStart, shouldNarrow } = useDragSideBar();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -248,7 +249,7 @@ export function SideBar(props: { className?: string }) {
|
|||||||
text={shouldNarrow ? undefined : Locale.Home.NewChat}
|
text={shouldNarrow ? undefined : Locale.Home.NewChat}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (config.dontShowMaskSplashScreen) {
|
if (config.dontShowMaskSplashScreen) {
|
||||||
chatStore.newSession();
|
chatStore.newSession(undefined, currentModel);
|
||||||
navigate(Path.Chat);
|
navigate(Path.Chat);
|
||||||
} else {
|
} else {
|
||||||
navigate(Path.NewChat);
|
navigate(Path.NewChat);
|
||||||
|
@ -221,9 +221,14 @@ export const useChatStore = createPersistStore(
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
newSession(mask?: Mask) {
|
newSession(mask?: Mask, currentModel?: Mask["modelConfig"]["model"]) {
|
||||||
const session = createEmptySession();
|
const session = createEmptySession();
|
||||||
|
const config = useAppConfig.getState();
|
||||||
|
console.log("------", session, "2222", config);
|
||||||
|
// 继承当前会话的模型
|
||||||
|
if (currentModel) {
|
||||||
|
session.mask.modelConfig.model = currentModel;
|
||||||
|
}
|
||||||
if (mask) {
|
if (mask) {
|
||||||
const config = useAppConfig.getState();
|
const config = useAppConfig.getState();
|
||||||
const globalModelConfig = config.modelConfig;
|
const globalModelConfig = config.modelConfig;
|
||||||
|
@ -52,7 +52,7 @@ export const DEFAULT_CONFIG = {
|
|||||||
dontUseModel: DISABLE_MODELS,
|
dontUseModel: DISABLE_MODELS,
|
||||||
|
|
||||||
modelConfig: {
|
modelConfig: {
|
||||||
model: "gpt-35-turbo-0125" as ModelType,
|
model: "gpt-3.5-turbo-0125" as ModelType,
|
||||||
temperature: 0.8,
|
temperature: 0.8,
|
||||||
top_p: 1,
|
top_p: 1,
|
||||||
max_tokens: 2000,
|
max_tokens: 2000,
|
||||||
@ -138,7 +138,7 @@ export const useAppConfig = createPersistStore(
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: StoreKey.Config,
|
name: StoreKey.Config,
|
||||||
version: 3.9,
|
version: 3.91,
|
||||||
migrate(persistedState, version) {
|
migrate(persistedState, version) {
|
||||||
const state = persistedState as ChatConfig;
|
const state = persistedState as ChatConfig;
|
||||||
|
|
||||||
@ -174,11 +174,12 @@ export const useAppConfig = createPersistStore(
|
|||||||
// return { ...DEFAULT_CONFIG };
|
// return { ...DEFAULT_CONFIG };
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (version < 3.9) {
|
if (version < 3.91) {
|
||||||
state.modelConfig.template =
|
state.modelConfig = DEFAULT_CONFIG.modelConfig;
|
||||||
state.modelConfig.template !== DEFAULT_INPUT_TEMPLATE
|
// state.modelConfig.template =
|
||||||
? state.modelConfig.template
|
// state.modelConfig.template !== DEFAULT_INPUT_TEMPLATE
|
||||||
: config?.template ?? DEFAULT_INPUT_TEMPLATE;
|
// ? state.modelConfig.template
|
||||||
|
// : config?.template ?? DEFAULT_INPUT_TEMPLATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return state as any;
|
return state as any;
|
||||||
|
Loading…
Reference in New Issue
Block a user