Files
openhuman/gitbooks/features/token-compression.zh-CN.md
T
JAYcodrGitHubagent:skill-master <skill-master@openclaw>Steven Enamakel
0f439fe1e1 docs(i18n): add zh-CN translations for integrations, mascot, model-routing, privacy, and tools
## Summary
- 添加第二批核心功能模块的中文翻译(8 个文件):隐私与安全、第三方集成、吉祥物、模型路由、编码器、语音、定时任务、系统与工具
- 修复批次 A 遗留的 12 处未本地化内部链接(因第二批新增目标 `.zh-CN` 文件,之前保留的英文链接现在可指向中文版)
- 修复第二批翻译中的 12 处质量问题:错别字、过直译、中英混杂、指向不存在的 `.zh-CN` 链接
- 修复隐私与安全文档中指向 `local-ai.zh-CN.md` 和 `triggers.zh-CN.md` 等尚未翻译文件的错误链接
- 统一 mascot、integrations 等跨模块链接指向,确保中文读者在 zh-CN 文档间流转
- 所有修改仅涉及 `.md` 文档,无代码变更

## Problem
- OpenHuman 中文用户阅读英文文档存在语言障碍
- 第一批汉化(overview + lightweight features)完成后,核心功能模块(integrations、model-routing、native-tools 等)仍无中文版
- 批次 A 的部分链接因目标文件当时未翻译而保留英文版,随着第二批新增 zh-CN 文件,这些链接已过时

## Solution
- 基于英文原文逐文件翻译,遵循术语统一表(vault→存储库、Agent→智能体、LLM/Token 保留英文等)
- 翻译完成后运行审计脚本扫描,修复所有未本地化链接、MD040 代码块标识、术语一致性问题
- 对于目标 `.zh-CN.md` 不存在的链接(如 triggers、subconscious、local-ai、agent-coordination),保持指向英文原文,在 Related 中标记后续批次覆盖计划

## Submission Checklist


- [x] I have read the Codex PR Checklist
- [x] I have confirmed Type Check passes (`pnpm typecheck`) (N/A: Markdown docs only)
- [x] I have confirmed the app builds locally (`pnpm build`) (N/A: Markdown docs only)
- [x] I have added tests for this change (N/A: i18n docs do not affect testable logic)
- [x] I have updated documentation (N/A: this PR is documentation-only)
- [x] I have confirmed no feature flags are required (N/A: no code changes)
- [x] I have confirmed Prettier passes (`pnpm format:check`) (N/A: Markdown docs only)

## Impact
- Runtime/platform impact: None
- Performance/security/migration/compatibility: None

## Related
- Follow-up PR(s)/TODOs:
  - Batch C: subconscious.zh-CN.md, triggers.zh-CN.md, local-ai.zh-CN.md, agent-coordination.zh-CN.md
  - Batch C: memory-tools.zh-CN.md, meeting-agents.zh-CN.md, developing/cef.zh-CN.md

---

## AI Authored PR Metadata

### Linear Issue
- Key: N/A
- URL: N/A

### Commit & Branch
- Branch: `docs/i18n-batch-b-core-features`
- Commit SHA: see PR commits

### Validation Run
- [x] `pnpm --filter openhuman-app format:check` — N/A: no code changed
- [x] `pnpm typecheck` — N/A: no code changed
- [x] Focused tests: N/A
- [x] Rust fmt/check: N/A
- [x] Tauri fmt/check: N/A

### Validation Blocked
- N/A

### Behavior Changes
- Intended behavior change: None
- User-visible effect: Chinese users can now read core feature docs in zh-CN

### Parity Contract
- Legacy behavior preserved: N/A
- Guard/fallback/dispatch parity checks: N/A

### Duplicate / Superseded PR Handling
- N/A


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **Localization**
  * Updated Simplified Chinese UI strings for vault operations and MCP server/settings.

* **Documentation**
  * Added extensive Chinese documentation covering integrations, mascot/meeting agents, model routing, native tools (voice, web search/scraper, coder, cron, system/tools), memory tree, obsidian wiki, token compression, platform, privacy/security, and subconscious/agent coordination.

* **Chores**
  * Updated ignore rules to exclude AI assistant progress tracking.
  * Added documentation maintenance and validation scripts.

<!-- review_stack_entry_start -->

[![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/tinyhumansai/openhuman/pull/2450?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: agent:skill-master <skill-master@openclaw>
Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
2026-05-22 13:06:20 -07:00

52 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
description: >-
TokenJuice - 一层规则叠加,在工具输出进入 LLM 上下文之前将其压缩。
处理成千上万封邮件依然成本低廉。
icon: file-zipper
---
# 智能 Token 压缩
LLM Token 价格不菲,而冗长的工具输出是消耗大多数 Token 的地方。繁忙仓库里的 `git status`、一次 `cargo build` 日志、一个 600 条消息的邮件串,或者针对真实集群的 `docker ps -a`,这些都可能把上下文窗口撑得很大,却几乎不带多少有效信息。
OpenHuman 搭载 **TokenJuice**,这是 [vincentkoc/tokenjuice](https://github.com/vincentkoc/tokenjuice) 的移植版本,直接集成到工具执行路径中。在任何工具结果到达模型之前,TokenJuice 会将输出通过一层规则叠加进行处理,去除噪音、保留信号。
## 三层规则叠加
规则是 JSON,按以下顺序合并,后面的层级覆盖前面的:
<table><thead><tr><th width="134.41796875">层级</th><th>路径</th><th>用途</th></tr></thead><tbody><tr><td><strong>内置</strong></td><td>随二进制文件发布</td><td>为 git、npm、cargo、docker、kubectl、ls 等提供的合理默认值</td></tr><tr><td><strong>用户</strong></td><td><code>~/.config/tokenjuice/rules/</code></td><td>你的个人覆盖,应用于所有项目</td></tr><tr><td><strong>项目</strong></td><td><code>.tokenjuice/rules/</code></td><td>仓库特定的覆盖,纳入版本控制,与团队共享</td></tr></tbody></table>
每条规则命名一个工具/命令模式和一个压缩策略(截断、行去重、折叠空白、删除匹配的正则表达式、摘要分段等)。新规则就是 JSON 文件,无需重新编译。
## 为什么这和记忆有关
TokenJuice 是使[自动拉取](obsidian-wiki/auto-fetch.zh-CN.md)在经济上可行的原因。当 Gmail provider 同步一页 200 条消息时,TokenJuice 在每个规范化的邮件进入构建摘要的模型**之前**就将其压缩。GitHub diff、Slack 频道转储以及其他任何高流量来源同理。
具体来说:通过前沿模型摄入你最近六个月的邮件费用从数百美元降到个位数美元。
## 它在流水线中的位置
```text
工具调用结果
TokenJuice(分类 → 匹配规则 → 压缩)
LLM 上下文
```
实现:`src/openhuman/tokenjuice/``classify.rs``reduce.rs``rules/compiler.rs``tool_integration.rs`)。
## 检查和覆盖
*`~/.config/tokenjuice/rules/` 中放入一个 JSON 文件来全局添加或覆写规则。
* 在仓库内的 `.tokenjuice/rules/` 中放入一个来做同样的项目级设置。
* 使用 `RUST_LOG=openhuman_core::openhuman::tokenjuice=debug` 启动 core,可以查看匹配了什么以及多少输出被裁剪了。
## 另见
* [原生工具](native-tools/README.zh-CN.md)。大多数重型工具输出都经过 TokenJuice。
* [记忆树](obsidian-wiki/memory-tree.zh-CN.md)。压缩输出的下游消费者。