From 1218691b61d594fe702404a66fdfae70a7f8eec2 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sat, 25 May 2024 18:29:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?perf:=20model=20=E6=8C=87=E4=BB=A4=E6=94=BE?= =?UTF-8?q?=E5=AE=BD=E9=99=90=E5=88=B6=EF=BC=8C=E6=94=AF=E6=8C=81=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E8=87=AA=E5=AE=9A=E4=B9=89=E6=A8=A1=E5=9E=8B=E3=80=82?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=A8=A1=E5=9E=8B=E5=90=8E=E6=8C=81=E4=B9=85?= =?UTF-8?q?=E5=8C=96=E4=BF=9D=E5=AD=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/command/openai_official.py | 9 +-------- model/provider/openai_official.py | 1 + 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/model/command/openai_official.py b/model/command/openai_official.py index 10d02fd6e..b64511348 100644 --- a/model/command/openai_official.py +++ b/model/command/openai_official.py @@ -84,6 +84,7 @@ class CommandOpenAIOfficial(Command): for model in models: ret += f"\n{i}. {model.id}" i += 1 + ret += "\nTips: 使用 /model 模型名/编号,即可实时更换模型。如目标模型不存在于上表,请输入模型名。" logger.debug(ret) return True, ret, "models" @@ -97,14 +98,6 @@ class CommandOpenAIOfficial(Command): models = list(models) if model.isdigit() and int(model) <= len(models) and int(model) >= 1: model = models[int(model)-1] - else: - f = False - for m in models: - if model == m.id: - f = True - break - if not f: - return True, "模型不存在或输入非法", "model" self.provider.set_model(model.id) return True, f"模型已设置为 {model.id}", "model" diff --git a/model/provider/openai_official.py b/model/provider/openai_official.py index d270cc201..8387fb571 100644 --- a/model/provider/openai_official.py +++ b/model/provider/openai_official.py @@ -484,6 +484,7 @@ class ProviderOpenAIOfficial(Provider): def set_model(self, model: str): self.model_configs['model'] = model + self.cc.put_by_dot_str("openai.chatGPTConfigs.model", model) super().set_curr_model(model) def get_configs(self): From f08de1f4046b28d6c169a1fbcee522b66d7db313 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sat, 25 May 2024 18:34:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?perf:=20=E6=B7=BB=E5=8A=A0=20models=20?= =?UTF-8?q?=E6=8C=87=E4=BB=A4=E5=88=B0=E5=B8=AE=E5=8A=A9=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/command/openai_official.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/model/command/openai_official.py b/model/command/openai_official.py index b64511348..afeb97576 100644 --- a/model/command/openai_official.py +++ b/model/command/openai_official.py @@ -106,11 +106,13 @@ class CommandOpenAIOfficial(Command): async def help(self): commands = super().general_commands() commands['画'] = '调用 OpenAI DallE 模型生成图片' - commands['set'] = '人格设置面板' - commands['status'] = '查看 Api Key 状态和配置信息' - commands['token'] = '查看本轮会话 token' - commands['reset'] = '重置当前与 LLM 的会话,但保留人格(system prompt)' - commands['reset p'] = '重置当前与 LLM 的会话,并清除人格。' + commands['/set'] = '人格设置面板' + commands['/status'] = '查看 Api Key 状态和配置信息' + commands['/token'] = '查看本轮会话 token' + commands['/reset'] = '重置当前与 LLM 的会话,但保留人格(system prompt)' + commands['/reset p'] = '重置当前与 LLM 的会话,并清除人格。' + commands['/models'] = '获取当前可用的模型' + commands['/model'] = '更换模型' return True, await super().help_messager(commands, self.platform, self.global_object.cached_plugins), "help"