chore: 切换AI模型为千问qwen3.8-flash(阿里云MaaS,性价比好,2.5s响应)
CI / 后端测试 (push) Has been cancelled
CI / 前端构建 (push) Has been cancelled

This commit is contained in:
selfrelease
2026-08-31 17:36:25 +08:00
parent 798bb40885
commit 9e79e17a35
+5 -2
View File
@@ -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())