From 5ce4137e7500a09ee6df81d84cefbd1aea0cfa1f Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 26 May 2024 21:15:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dmodel=E6=8C=87?= =?UTF-8?q?=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/command/openai_official.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/model/command/openai_official.py b/model/command/openai_official.py index 19e0e8ef..bafac680 100644 --- a/model/command/openai_official.py +++ b/model/command/openai_official.py @@ -94,14 +94,17 @@ class CommandOpenAIOfficial(Command): if len(l) == 1: return True, "请输入 /model 模型名/编号", "model" model = str(l[1]) - models = await self.get_models() - models = list(models) - if model.isdigit() and int(model) <= len(models) and int(model) >= 1: - model = models[int(model)-1] + if model.isdigit(): + models = await self.get_models() + models = list(models) + if int(model) <= len(models) and int(model) >= 1: + model = models[int(model)-1] + self.provider.set_model(model.id) + return True, f"模型已设置为 {model.id}", "model" + else: + self.provider.set_model(model) + return True, f"模型已设置为 {model} (自定义)", "model" - self.provider.set_model(model.id) - return True, f"模型已设置为 {model.id}", "model" - async def help(self): commands = super().general_commands()