feat: 支持 ChatSession 级别插件功能开关

This commit is contained in:
Hk-Gosuto
2023-08-12 00:53:15 +08:00
parent 6b28bcd9b5
commit fb1b92e9cc
6 changed files with 27 additions and 54 deletions

View File

@@ -61,7 +61,6 @@ export interface ChatSession {
clearContextIndex?: number;
mask: Mask;
usePlugins: boolean;
}
export const DEFAULT_TOPIC = Locale.Store.DefaultTopic;
@@ -85,7 +84,6 @@ function createEmptySession(): ChatSession {
lastSummarizeIndex: 0,
mask: createEmptyMask(),
usePlugins: true,
};
}
@@ -317,7 +315,7 @@ export const useChatStore = create<ChatStore>()(
session.messages.push(botMessage);
});
if (session.usePlugins) {
if (session.mask.usePlugins) {
console.log("[ToolAgent] start");
api.llm.toolAgentChat({
messages: sendMessages,

View File

@@ -18,6 +18,7 @@ export type Mask = {
modelConfig: ModelConfig;
lang: Lang;
builtin: boolean;
usePlugins?: boolean;
};
export const DEFAULT_MASK_STATE = {
@@ -46,6 +47,7 @@ export const createEmptyMask = () =>
lang: getLang(),
builtin: false,
createdAt: Date.now(),
usePlugins: useAppConfig.getState().modelConfig.model.endsWith("0613"),
} as Mask);
export const useMaskStore = create<MaskStore>()(