diff --git a/gateway/linux/wechat_webhook.py b/gateway/linux/wechat_webhook.py index 2ce04dc..020f5b4 100644 --- a/gateway/linux/wechat_webhook.py +++ b/gateway/linux/wechat_webhook.py @@ -125,11 +125,10 @@ class WebhookHandler(BaseHTTPRequestHandler): self._respond(200, {"status": "ok"}) def _forward_to_hermes(self, sender, sender_id, text): - """Forward to Hermes and send reply back to WeChat.""" + """Forward message to Hermes, get response, send back to WeChat.""" payload = json.dumps({ "model": "nova-4", "messages": [ - {"role": "system", "content": "你是莫荷微信Bot。回复简洁,不要废话。"}, {"role": "user", "content": f"[微信消息] 来自 {sender}({sender_id}): {text}"} ] }).encode() @@ -141,12 +140,11 @@ class WebhookHandler(BaseHTTPRequestHandler): opener = ureq.build_opener(handler) req = ureq.Request(HERMES_API, data=payload, headers={"Content-Type": "application/json", "Authorization": f"Bearer {HERMES_KEY}"}) - resp = opener.open(req, timeout=30) + resp = opener.open(req, timeout=180) resp_data = json.loads(resp.read()) reply = resp_data.get('choices', [{}])[0].get('message', {}).get('content', '') log.info(f"Hermes OK, reply: {reply[:60]}") - # Send reply back via WeChat API if reply and sender: self._send_wechat(sender, reply) except Exception as e: