Commit Graph

6 Commits

Author SHA1 Message Date
fawney19
cf67160821 feat(cache): enhance cache monitoring endpoints and handler integrations 2025-12-15 23:12:48 +08:00
fawney19
88e37594cf refactor(backend): update handlers, utilities and core modules after models restructure 2025-12-15 14:30:53 +08:00
fawney19
53bf74429e refactor: 重构流式处理模块,提取 StreamContext/Processor/Telemetry
- 将 chat_handler_base.py 中的流式处理逻辑拆分为三个独立模块:
  - StreamContext: 类型安全的流式上下文数据类,替代原有的 ctx dict
  - StreamProcessor: SSE 解析、预读、嵌套错误检测
  - StreamTelemetryRecorder: 统计记录(Usage/Audit/Candidate)
- 将硬编码配置外置到 settings.py,支持环境变量覆盖:
  - HTTP 超时配置(connect/write/pool)
  - 流式处理配置(预读行数、统计延迟)
  - 并发控制配置(槽位 TTL、缓存预留比例)
2025-12-12 15:42:45 +08:00
fawney19
8f914d89bb fix: 增加写入超时时间支持大请求体
- 将 chat_handler_base 的写入超时从 10 秒增加到 60 秒
- 将 cli_handler_base 的写入超时从 10 秒增加到 60 秒
- 将 http_client 的写入超时从 10 秒增加到 60 秒
- 支持包含大量数据(如图片)的长对话请求
2025-12-11 11:21:46 +08:00
fawney19
0474f63403 refactor: 完善 handler 基类类型注解和流式状态更新
- 为 BaseMessageHandler 和 MessageTelemetry 添加完整类型注解
- 新增 _update_usage_to_streaming 方法,异步更新 Usage 状态为 streaming
- 优化 chat/cli handler 的类型提示,提升代码可维护性
- 修复类型检查警告,确保 mypy 通过
2025-12-11 10:05:06 +08:00
fawney19
f784106826 Initial commit 2025-12-10 20:52:44 +08:00