From 9e79e17a35a87b18e55adb6c8aa39f812475eff1 Mon Sep 17 00:00:00 2001 From: selfrelease Date: Mon, 31 Aug 2026 17:36:25 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=88=87=E6=8D=A2AI=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E4=B8=BA=E5=8D=83=E9=97=AEqwen3.8-flash(=E9=98=BF=E9=87=8C?= =?UTF-8?q?=E4=BA=91MaaS,=E6=80=A7=E4=BB=B7=E6=AF=94=E5=A5=BD,2.5s?= =?UTF-8?q?=E5=93=8D=E5=BA=94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bossai.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bossai.py b/bossai.py index 7add04d..2782b83 100644 --- a/bossai.py +++ b/bossai.py @@ -2876,12 +2876,15 @@ class KimiClient: def chat(self, messages: list[dict], temperature: float = 0.2, timeout: int = 60) -> str: """调用云端模型,超时 60s。 - kimi-k 系列模型只允许 temperature=1,自动适配。 + 部分模型(kimi-k 系列)只允许 temperature=1,自动适配。 """ # kimi-k 系列模型只允许 temperature=1 if self.model.startswith("kimi-k"): temperature = 1.0 - body = json.dumps({"model": self.model, "messages": messages, "temperature": temperature}).encode() + body_dict = {"model": self.model, "messages": messages} + if temperature is not None: + body_dict["temperature"] = temperature + body = json.dumps(body_dict).encode() req = Request(self.base_url + "/chat/completions", data=body, headers={"Authorization": "Bearer " + self.api_key, "Content-Type": "application/json"}) with urlopen(req, timeout=timeout) as response: payload = json.loads(response.read().decode())