feat: #close 1789 add user input template

This commit is contained in:
Yidadaa
2023-06-24 00:07:46 +08:00
parent fa9ceb5875
commit be597a551d
6 changed files with 113 additions and 54 deletions

View File

@@ -1,7 +1,7 @@
import { create } from "zustand";
import { persist } from "zustand/middleware";
import { getClientConfig } from "../config/client";
import { StoreKey } from "../constant";
import { DEFAULT_INPUT_TEMPLATE, StoreKey } from "../constant";
export enum SubmitKey {
Enter = "Enter",
@@ -39,6 +39,7 @@ export const DEFAULT_CONFIG = {
sendMemory: true,
historyMessageCount: 4,
compressMessageLengthThreshold: 1000,
template: DEFAULT_INPUT_TEMPLATE,
},
};
@@ -176,15 +177,16 @@ export const useAppConfig = create<ChatConfigStore>()(
}),
{
name: StoreKey.Config,
version: 3,
version: 3.1,
migrate(persistedState, version) {
if (version === 3) return persistedState as any;
if (version === 3.1) return persistedState as any;
const state = persistedState as ChatConfig;
state.modelConfig.sendMemory = true;
state.modelConfig.historyMessageCount = 4;
state.modelConfig.compressMessageLengthThreshold = 1000;
state.modelConfig.frequency_penalty = 0;
state.modelConfig.template = DEFAULT_INPUT_TEMPLATE;
state.dontShowMaskSplashScreen = false;
return state;