發佈 0.1.11:連線中斷自動重試,已生成的圖不再丟失

根本原因:
imagegen 產圖成功後,模型把含圖結果串流回來時 OpenAI 端偶發切斷
WebSocket(stream disconnected / websocket closed),codex 回報 turn.failed,
bot 視為致命錯誤,連已生好的圖一起丟掉,使用者只看到錯誤。

修法:
1. codex.js 失敗時附帶 threadId 與 transient 旗標(辨識暫時性連線錯誤)。
2. bot.js 改為重試迴圈:暫時性錯誤時,若本輪 generated_images 已有產圖,
   直接交付並註明「連線中斷但圖已生成」,不重跑(避免重複生圖);
   沒產出才 resume 同一會話重試一次,狀態訊息顯示「自動重試中」。
   會話失效/換模型的自動開新會話邏輯併入同一迴圈。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-17 16:08:58 +08:00
co-authored by Claude Fable 5
parent ec06c77bde
commit cfa61aa01a
3 changed files with 44 additions and 17 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "telegram-codex-bot",
"version": "0.1.10",
"version": "0.1.11",
"description": "Telegram bot powered by the local Codex CLI — zero-dependency, pm2-managed, with a built-in PM2 web viewer",
"license": "MIT",
"type": "commonjs",