feat: 修改插件模型版本限制

This commit is contained in:
Hk-Gosuto 2023-08-21 23:55:08 +08:00
parent 609155b318
commit 987ddf5f0f
5 changed files with 11 additions and 8 deletions

View File

@ -62,12 +62,14 @@
- [x] 支持 Agent 参数配置( ~~agentType~~, maxIterations, returnIntermediateSteps 等)
- [x] 支持 ChatSession 级别插件功能开关
仅在使用 `0613` 版本模型时会出现插件开关,其它模型默认为关闭状态,开关也不会显示。
仅在使用`0301``0314` 版本模型时会出现插件开关,其它模型默认为关闭状态,开关也不会显示。
## 已知问题
- [x] 使用插件时需将模型切换为 `0613` 版本模型,如:`gpt-3.5-turbo-0613`
- [x] ~~使用插件时需将模型切换为 `0613` 版本模型,如:`gpt-3.5-turbo-0613`~~
尝试使用 `chat-conversational-react-description` 等类型的 `agent` 使用插件时效果并不理想,不再考虑支持其它版本的模型。
限制修改为非 `0301``0314` 模型均可调用插件。 [#10](https://github.com/Hk-Gosuto/ChatGPT-Next-Web-LangChain/issues/10)
- [x] `SERPAPI_API_KEY` 目前为必填,后续会支持使用 DuckDuckGo 替换搜索插件
- [x] Agent 不支持自定义接口地址
- [x] ~~部分场景下插件会调用失败~~

View File

@ -511,7 +511,7 @@ export function ChatActions(props: {
icon={<RobotIcon />}
/>
{config.pluginConfig.enable && currentModel.endsWith("0613") && (
{config.pluginConfig.enable && !/03\d{2}$/.test(currentModel) && (
<ChatAction
onClick={switchUsePlugins}
text={
@ -536,8 +536,9 @@ export function ChatActions(props: {
chatStore.updateCurrentSession((session) => {
session.mask.modelConfig.model = s[0] as ModelType;
session.mask.syncGlobalConfig = false;
session.mask.usePlugins =
session.mask.modelConfig.model.endsWith("0613");
session.mask.usePlugins = !/03\d{2}$/.test(
session.mask.modelConfig.model,
);
});
showToast(s[0]);
}}

View File

@ -577,7 +577,7 @@ export const useChatStore = create<ChatStore>()(
api.llm.chat({
messages: topicMessages,
config: {
model: "gpt-3.5-turbo-0613",
model: "gpt-3.5-turbo",
},
onFinish(message) {
get().updateCurrentSession(

View File

@ -39,7 +39,7 @@ export const DEFAULT_CONFIG = {
models: DEFAULT_MODELS as any as LLMModel[],
modelConfig: {
model: "gpt-3.5-turbo-0613" as ModelType,
model: "gpt-3.5-turbo" as ModelType,
temperature: 0.5,
top_p: 1,
max_tokens: 2000,

View File

@ -47,7 +47,7 @@ export const createEmptyMask = () =>
lang: getLang(),
builtin: false,
createdAt: Date.now(),
usePlugins: useAppConfig.getState().modelConfig.model.endsWith("0613"),
usePlugins: !/03\d{2}$/.test(useAppConfig.getState().modelConfig.model),
} as Mask);
export const useMaskStore = create<MaskStore>()(