Commit Graph
3 Commits
Author SHA1 Message Date
JianMiauandClaude Fable 5 cfa61aa01a 發佈 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>
2026-08-17 16:08:58 +08:00
JianMiauandClaude Fable 5 b80d6f0a1b 發佈 0.1.8:支援傳圖/傳檔給使用者,新增連網開關
摘要:
1. 交件匣機制:每輪 prompt 附系統規則,Codex 把要給使用者的檔案放進
   工作目錄的 .tgcodex-outbox/,回覆後 bot 自動傳到 Telegram(圖片走
   sendPhoto、其餘或超過 10MB 走 sendDocument)並清空,一輪上限 10 個檔案。
2. bot 設定新增「允許 Codex 連網」開關(-c sandbox_workspace_write.network_access),
   開啟後可用 codex 的 imagegen 技能生圖,已實測產出 PNG 進交件匣。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 17:13:12 +08:00
JianMiauandClaude Fable 5 5b32816ad4 建立 telegram-codex-bot:串接 Codex CLI 的 Telegram bot(npm 包)
摘要:
用 Telegram 操控本機 Codex CLI 的 bot,附 web 控制台,封裝為 npm 包。

內容:
- 零依賴(僅 Node 內建模組);bot 以 codex exec --json 驅動,支援會話延續
  (exec resume)、workspace-write 沙盒、圖片輸入、進度回報與 ctx%/tokens footer
- web 控制台(pm2 託管,預設 127.0.0.1:3799):Bot 管理分頁(新增/編輯/啟停,
  token 自動驗證、工作目錄用原生視窗選、模型/推理強度/速度下拉,清單來自
  ~/.codex/models_cache.json)+ PM2 檢視分頁(狀態/port/log/啟停)
- CLI:start(環境檢查後把控制台掛上 pm2)/ stop / restart / delete / status /
  logs / web / doctor
- Windows 相容:解析 codex.cmd shim 直接以 node 執行、taskkill 整樹砍程序、
  資料夾選擇視窗以 TopMost 透明 owner 置中

影響:
新專案初始版本;bot 設定存於 ~/.tgcodex/bots/<name>/,含明文 token 的實例
設定不進版控(.gitignore 已涵蓋 tgcodex.config.json 與 .tgcodex/)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-04 16:25:39 +08:00