‹ 首页

tts-error-reporting

@project-n-e-k-o · 收录于 昨天 · 上游提交 昨天

Convention for reporting errors from multiprocessing TTS workers to the main process frontend. Use this skill when modifying, adding, or debugging TTS workers in tts_client.py to ensure connection errors, quotas, and API limits correctly display Toast notifications to the user rather than failing silently.

适合你,如果正在开发或维护TTS客户端,需要确保错误不被静默忽略

/ 通过 npx 安装 校验哈希
npx oh-my-skill add project-n-e-k-o/n.e.k.o/tts-error-reporting
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- project-n-e-k-o/n.e.k.o/tts-error-reporting
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify project-n-e-k-o/n.e.k.o/tts-error-reporting
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
2258GitHub stars
~599上下文体积 · 单文件
索引托管

怎么用

商店整理自技能原文 · 版本 b0c3c15 · 表述以原文为准
它做什么

安装此技能后,Claude 在修改或调试 TTS 工作器时,会确保错误通过 response_queue 发送,并触发前端 Toast 通知,而非静默失败。

什么时候触发

当你要求修改、添加或调试 tts_client.py 中的 TTS 工作器时,或者当 TTS 服务遇到配额、API 或连接错误时。

装好后可以这样说
Claude 会自动遵循错误报告协议。
Claude 会添加错误报告逻辑并生成 Toast 通知。
技能原文 SKILL.md作者撰写 · Apache-2.0 · b0c3c15

TTS Error Reporting Protocol

To ensure users are properly notified when a TTS service encounters an error (such as quota exhaustion, API issues, or connection failures), TTS workers running in separate processes must propagate errors back to the main process (core.py).

Core Rule: Use response_queue.put(("__error__", error_msg))

When a TTS worker (e.g. step_realtime_tts_worker, qwen_realtime_tts_worker, etc.) catches an error, it MUST NOT only log the error using logger.error(). It MUST ALSO send the error message back to the main process through its response_queue using the explicit tuple format ("__error__", error_msg).

This ensures that core.py's tts_response_handler can intercept the error and translate it into a frontend WebSocket message (type: 'status'), triggering a user-friendly Toast notification (e.g., "💥 免费TTS限额已耗尽").

Example Implementation
# Bad Pattern (Fails silently for user)
except Exception as e:
    logger.error(f"TTS Worker Error: {e}")
    # Worker dies or hangs, user stuck on "Preparing..."

# Good Pattern (Structured JSON error for i18n frontend toasts)
import json
except Exception as e:
    logger.error(f"TTS Worker Error: {e}")
    # Map to specific error codes known to i18n
    error_payload = json.dumps({"code": "API_QUOTA_TIME", "details": str(e)})
    response_queue.put(("__error__", error_payload))

# Acceptable Fallback (Fallback 1008 error if code unknown)
except Exception as e:
    logger.error(f"TTS Worker Error: {e}")
    error_payload = json.dumps({"code": "API_1008_FALLBACK", "msg": str(e)})
    response_queue.put(("__error__", error_payload))
WebSocket Stream Callbacks Example
import json
def on_error(self, message: str): 
    logger.error(f"TTS Error: {message}")
    error_payload = json.dumps({"code": "API_1008_FALLBACK", "msg": message})
    self.response_queue.put(("__error__", error_payload))
Checklist for Adding a New TTS Worker

Whenever you add a new TTS API worker in tts_client.py:

  1. Ensure the worker signature accepts a response_queue.
  2. Locate all network initialization blocks, try/except loops, and on_error WebSocket callbacks.
  3. In every local exception block where the worker might fail or drop the connection, add response_queue.put(("__error__", error_message_string)).
  4. Ensure string encoding handles JSON cleanly if propagating raw API errors.
按 Apache-2.0 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。