feat(inference): CJK 保守 token 估算(T9 架构审查整改)

- Issue11: approximate_token_count 重写
  - 新增 _is_cjk_char(CJK 统一表意/扩展A/假名/韩文/兼容/全角六大 Unicode 范围)
  - CJK 字符按 1.5 token/字符(旧 4 字符 1 token 严重低估,裁剪失效致 API 超限)
  - 其余字符仍 4 字符 1 token;最少 1 token
- 同步 config-design.md token_estimation 注释
- 新增 4 用例,全量 186 passed / 100.00%(995 stmts/252 br)
This commit is contained in:
lhl
2026-08-12 09:54:20 +08:00
parent 8239a37a99
commit 8febc50eb8
4 changed files with 53 additions and 3 deletions
+1 -1
View File
@@ -133,7 +133,7 @@ models:
timeout_sec: 90
llm_calls:
token_estimation: tiktoken # tiktoken | approximatetiktoken 缺失自动回落 approximate(内置估算器)
token_estimation: tiktoken # tiktoken | approximatetiktoken 缺失自动回落 approximate(内置估算器T9 起对 CJK 保守 ×1.5/字符
max_context_tokens: 32000 # 上下文窗口上限
truncation_policy: # 超限裁剪策略(runtime §2.6
priority: