From 511dcd914c6df126467f5dcef5a6e100cab0a9ea Mon Sep 17 00:00:00 2001 From: fylorn <249551762+fylorn@users.noreply.github.com> Date: Thu, 17 Sep 2026 17:32:51 +0800 Subject: [PATCH] fix(copy): rewrite the remaining UI copy in a written register MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The upstream page was rewritten in #35, but the rest of the app still talked to the user the way a chat would: "没绑路由的密钥走这条", "并发上限 要是一个 1 以上的整数", "第一个请求进来时,它会出现在这里", "像密钥的内容都 打了码". In a tool people use to read costs and debug traffic that tone reads as unreliable, and it no longer matched the page next to it. Every other page now uses the upstream page's register: statements rather than asides or questions, no first or second person, 费用 for amounts, 尚无/未/无法 rather than 还没/没/…不了, and an upstream is 上游 rather than 这家/一家. Tooltips that only justified a design choice (why custom scan rules are appended, why a replay is byte-identical, why small samples are not compared) keep the fact a user acts on and drop the reasoning, which belongs in comments. Two strings were wrong on screen, not just informal: - A global 全部 -> 不限 replace in #15 left 不限还原, 请求不限失败, 展开不限, 拖垮不限 and 不限网卡. They read 全部/所有 again, and the traffic filters say 全部客户端/全部上游, as that commit message described them. - Core 0.2 reports trust as a slug, so the Guard page showed "official" and "untrusted"; redaction categories were always slugs. Both now use the labels the upstream dialog already defines. The copy test rejects the spoken markers removed here (要是, 还没, 删掉, 拿到, 这家, 只计到, 知道了, 吗?, 你 and others) so they cannot return one string at a time. 就好了, 怎么办 and 稍等一下 are widened to 就好, 怎么 and 稍等, and 成本 joins 花费 as a synonym to reject. Not changed here: strategy names (手动选, 轮流, 选最快, 选最便宜), the disk status line and the scan rule summary are strings core sends, so they have to change in core. Co-Authored-By: Claude Opus 5 --- src/App.tsx | 68 ++++++++++++++++---------------- src/Clients.tsx | 59 ++++++++++++++------------- src/Config.tsx | 77 ++++++++++++++++++------------------ src/ConfigText.tsx | 2 +- src/Connect.tsx | 12 +++--- src/Dashboard.tsx | 34 ++++++++-------- src/Guard.tsx | 69 ++++++++++++++++---------------- src/Keys.tsx | 26 ++++++------ src/RequestDrawer.tsx | 44 ++++++++++----------- src/Routes.tsx | 56 +++++++++++++------------- src/Security.tsx | 92 +++++++++++++++++++++---------------------- src/Sessions.tsx | 20 +++++----- src/UpdateWindow.tsx | 8 ++-- src/copy.test.ts | 42 ++++++++++++++++++-- src/ui/charts.tsx | 2 +- 15 files changed, 320 insertions(+), 291 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 741841a8..5fe42b04 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -758,7 +758,7 @@ export default function App() { onClick={() => setTab(it.id)} aria-current={on ? "page" : undefined} tooltip={ - badge > 0 ? `${it.label} · ${badge} 项新证据` : it.label + badge > 0 ? `${it.label} · ${badge} 项新发现` : it.label } > @@ -961,9 +961,9 @@ export default function App() { {r.provider} {" "} - 的 token 端点换发了新凭据,已写回 config.yaml - - 编辑器要重载 + 的 token 端点已换发新凭据,并已写回 config.yaml。 + + 编辑器需重新加载

) : ( @@ -983,14 +983,14 @@ export default function App() {

- {r.provider} 换发了新凭据,但没能写回 config.yaml。当前转发正常。 + {r.provider} 已换发新凭据,但未能写回 config.yaml。当前转发正常。

{r.detail}

- 旧的那个已经在服务端作废了 —— - 重启之前不处理,这家会一直 401。 + 原凭据已在服务端失效。 + 重启前如未处理,该上游的请求将持续返回 401。

@@ -1017,7 +1017,7 @@ export default function App() { {linked && tries > 0 && lost && (
- {lost.what} —— 下面的数字停在断开之前 + {lost.what} · 以下数据截至连接断开时 {lost.next} {lost.retry && ( @@ -1167,7 +1167,7 @@ export default function App() { pressed={filter.failedOnly} onPressedChange={(v) => setFilter((f) => ({ ...f, failedOnly: v }))} > - 只看失败 + 仅显示失败 {/* 下拉里只列**出现过的** —— 配了三家而只有一家在收流量时, 另外两家出现在这里只会让人以为自己筛错了 */} @@ -1179,8 +1179,8 @@ export default function App() { setFilter((f) => ({ ...f, client: e.target.value })) } > - {/* 原生 option 收空串,所以「不限」不用再借哨兵 */} - 不限客户端 + {/* 原生 option 收空串,所以「全部」不用再借哨兵 */} + 全部客户端 {facet.clients.map((c) => ( {c} @@ -1196,8 +1196,8 @@ export default function App() { setFilter((f) => ({ ...f, provider: e.target.value })) } > - {/* 原生 option 收空串,所以「不限」不用再借哨兵 */} - 不限上游 + {/* 原生 option 收空串,所以「全部」不用再借哨兵 */} + 全部上游 {facet.providers.map((c) => ( {c} @@ -1271,19 +1271,19 @@ export default function App() { 暂无请求记录 - 把客户端指到{" "} + 将客户端的端点设为{" "} http://{status?.gateway_addr ?? "127.0.0.1:8788"} - ,用配置里那把 tw- 开头的密钥。 + ,并使用以 tw- 开头的客户端密钥。
- 第一个请求进来时,它会出现在这里。 + 收到请求后,请求记录将显示在此处。
{/* 一次都没有的时候不说这句 —— 「已经本地应答了 0 次」是在 拿一个零冒充证据 */} {locallyAnswered > 0 && ( - 已经本地应答了 {locallyAnswered} 次客户端探测 —— 客户端连上了,而这些探测一分钱没花。 + 已本地应答 {locallyAnswered} 次客户端探测。客户端已连接网关,这些探测未产生费用。 )}
@@ -1341,14 +1341,14 @@ export default function App() { // 会打错,打错的表现是「筛出来空的」。 { kind: "item", - label: `只看上游 ${r.provider}`, + label: `仅显示上游 ${r.provider}`, onSelect: () => setFilter((f) => ({ ...f, provider: r.provider })), }, ...(showClient ? ([ { kind: "item", - label: `只看客户端 ${r.client}`, + label: `仅显示客户端 ${r.client}`, onSelect: () => setFilter((f) => ({ ...f, client: r.client })), }, ] as const) @@ -1361,7 +1361,7 @@ export default function App() { }, { kind: "item", - label: "复制这一行", + label: "复制此行", onSelect: () => void navigator.clipboard.writeText( [ @@ -1467,9 +1467,9 @@ export default function App() { `${x.what} ×${x.count}`).join("、") + - "\n模型回显时会自动换回来。" + "\n模型回显的内容将自动还原。" } > 已脱敏 {r.redacted.reduce((a, x) => a + x.count, 0)} @@ -1487,14 +1487,14 @@ export default function App() { : "bg-neutral-200 text-neutral-600 dark:bg-neutral-800 dark:text-neutral-300") } title={ - `请求从 ${r.translated.from} 方言转成了 ${r.translated.to} 再发出去。` + + `请求已从 ${r.translated.from} 协议转换为 ${r.translated.to} 协议后发送。` + (r.translated.dropped.length > 0 - ? `\n\n目标方言里没有对应物、只能丢掉的字段:${r.translated.dropped.join("、")}` - : "\n没有字段被丢掉。") + ? `\n\n目标协议不支持、已丢弃的字段:${r.translated.dropped.join("、")}` + : "\n未丢弃任何字段。") } > {r.translated.dropped.length > 0 - ? `已转换 · 丢了 ${r.translated.dropped.length} 项` + ? `已转换 · 丢弃 ${r.translated.dropped.length} 项` : "已转换"} )} @@ -1538,10 +1538,10 @@ export default function App() { @@ -1563,7 +1563,7 @@ export default function App() { )} {locallyAnswered > 0 && rows.length > 0 && (

- 另有 {locallyAnswered} 次客户端探测被本地应答,没有发给任何上游。 + 另有 {locallyAnswered} 次客户端探测由网关本地应答,未发送到上游。

)} @@ -1578,9 +1578,9 @@ export default function App() { - 退出 ThinkWatch Lite? + 退出 ThinkWatch Lite - 所有接管过的客户端会立刻失联 —— 它们指着的端口后面就没东西在听了。 + 退出后网关将停止监听,所有已接管的客户端将立即无法连接。

diff --git a/src/Clients.tsx b/src/Clients.tsx index 8a97290d..f5365a53 100644 --- a/src/Clients.tsx +++ b/src/Clients.tsx @@ -169,8 +169,7 @@ export default function Clients({

- 接管会把这些客户端指向 {data.gateway_base}。 - 只改端点和密钥两个字段,其余不动,随时可还原。 + 接管后,这些客户端将指向 {data.gateway_base}。仅修改端点与密钥两个字段,其余配置保持不变,可随时还原。
{/* **退路要一直看得见**。用户敢按下「接管」的前提,就是 @@ -181,8 +180,8 @@ export default function Clients({ (confirmAll ? (
- 把 {data.clients.filter((c) => c.adopted_at_ms !== null).length}{" "} - 个客户端改回原样?它们会立刻不再经过 ThinkWatch。 + {data.clients.filter((c) => c.adopted_at_ms !== null).length}{" "} + 个客户端将还原,其请求将立即不再经过 ThinkWatch。 ))}
@@ -243,12 +242,12 @@ export default function Clients({ 未检测到已支持的客户端 - 装了 Claude Code、Codex、Gemini CLI 的话 + 如已安装 Claude Code、Codex 或 Gemini CLI, - 先跑一次再回来 + 请先运行一次 。
- 也可以手动把客户端的端点指到{" "} + 也可手动将客户端的端点设为{" "} {data.gateway_base} @@ -263,11 +262,11 @@ export default function Clients({ {gone.length > 0 && (
- 这台机器上没找到的({gone.length}) + 未检测到的客户端({gone.length})
    {gone.map((c) => (
  • - {c.name} —— 没在 {c.path} 找到 + {c.name}:未找到 {c.path}
  • ))}
@@ -276,7 +275,7 @@ export default function Clients({ {/* **不假装能接管。**显示成「已接管」会让用户以为所有流量都在我们这儿 */}
-
接管不了,只能给你步骤
+
需手动配置的客户端
    {data.manual.map((m) => (
  • @@ -319,11 +318,11 @@ function Card({
    {c.name} {verified ? ( - 已验证 · 收到过它的请求 + 已验证 · 已收到请求 ) : adopted ? ( - 已接管 · 等第一个请求 + 已接管 · 等待首个请求 ) : ( - 没接管 + 未接管 )}
    {adopted && ( @@ -335,7 +334,7 @@ function Card({ > {/* 已经收到过它的请求了还问「为什么没生效」,读起来像是我们 自己都不信刚才那个「已验证」 */} - {verified ? "检查配置链" : "为什么没生效?"} + {verified ? "检查配置链" : "诊断未生效原因"} )}
    - {c.endpoint &&
    现在指向 {c.endpoint}
    } + {c.endpoint &&
    当前指向 {c.endpoint}
    } {c.takes_effect === "on_restart" &&
    {c.takes_effect_note}
    } {c.verified === "fields_only" &&
    ⓘ {c.verified_note}
    } {c.shadows.map((s) => (
    - ⚠ {s} 优先级更高,可能盖过这里的设置 + ⚠ {s} 优先级更高,可能覆盖此处的设置
    ))} {nagging && (
    - 接管五分钟了还没收到请求 —— 点上面的按钮诊断。 + 接管已超过五分钟,仍未收到请求。可点击「诊断未生效原因」进行检查。
    )}
    @@ -426,11 +425,11 @@ function PlanDialog({ return (
    - 要改 {p.path} + 将修改 {p.path}
    {p.noop ? ( -
    已经是这样了,什么都不用改。
    +
    配置已是目标状态,无需修改。
    ) : ( <> {p.fields.length > 0 && ( @@ -455,8 +454,8 @@ function PlanDialog({
    - 写入前整份备份,除上面这几个字段外一字节不动。 - {p.carries_secret && "(diff 里的密钥已打码,实际写入的是 config.yaml 里那把真的。)"} + 写入前将完整备份原文件,除上述字段外不做任何改动。 + {p.carries_secret && "(差异中的密钥已遮盖,实际写入的是 config.yaml 中的密钥原文。)"}
    )} @@ -552,14 +551,14 @@ function Diff({ before, after }: { before: string | null; after: string }) { /** 接管完成。**不说「成功」** —— 只有请求能证明它真的生效了。 */ function DoneDialog({ r, onClose }: { r: AdoptResponse; onClose: () => void }) { return ( - +
    {r.takes_effect_note}
    - 改的是 {r.real} + 已修改 {r.real}
    - 原文件备份在 {r.backup} + 原文件已备份至 {r.backup}
    {r.warnings.map((w) => (
    @@ -567,12 +566,12 @@ function DoneDialog({ r, onClose }: { r: AdoptResponse; onClose: () => void }) {
    ))}
    - 接下来等一个真实请求 —— 那是唯一能证明它生效的东西。 + 收到真实请求后,方可确认配置已生效。
    @@ -582,7 +581,7 @@ function DoneDialog({ r, onClose }: { r: AdoptResponse; onClose: () => void }) { /** 优先级链的诊断结果。**查干净的也要说出来**,而不是让那一项消失。 */ function WhyDialog({ found, onClose }: { found: FindingView[]; onClose: () => void }) { return ( - +
      {found.map((f, i) => (
    • diff --git a/src/Config.tsx b/src/Config.tsx index e7b81a65..98fe8f3b 100644 --- a/src/Config.tsx +++ b/src/Config.tsx @@ -182,9 +182,9 @@ function SelectCell({ * · **仅本机** `loopback` —— 绑 127.0.0.1。别的设备连不过来。 * · **指定网卡** `` —— 绑某一张网卡自己的地址。只有那张网卡所在的 * 网络连得上。 - * · **不限网卡** `all` —— 绑 0.0.0.0。**每一张**网卡,包括对着公网的那张。 + * · **所有网卡** `all` —— 绑 0.0.0.0。**每一张**网卡,包括对着公网的那张。 * - * 以前中间那档叫「局域网」,而它绑的也是 0.0.0.0 —— 和「不限网卡」是同 + * 以前中间那档叫「局域网」,而它绑的也是 0.0.0.0 —— 和「所有网卡」是同 * 一个地址,区别只在来源白名单的默认值。**那是个白名单概念,伪装成了网卡 * 选择**:用户以为网关只在局域网那张网卡上听,实际它在所有网卡上听。 * @@ -210,12 +210,12 @@ const KINDS: { id: BindKind; label: string; what: string }[] = [ { id: "nic", label: "指定网卡", - what: "只绑这一张网卡自己的地址,只有它所在的那个网络连得上。密钥校验强制开启。", + what: "绑定所选网卡的地址。仅该网卡所在网络中的设备可连接,密钥校验强制开启。", }, { id: "all", - label: "不限网卡", - what: "绑 0.0.0.0,每一张网卡都在听 —— 包括对着公网的那张。密钥校验强制开启。", + label: "所有网卡", + what: "绑定 0.0.0.0,在所有网卡上监听,包括连接公网的网卡。密钥校验强制开启。", }, ]; @@ -254,7 +254,7 @@ function CidrList({ return (
      - {items.length === 0 && (全放行)} + {items.length === 0 && (允许所有来源)} {items.map((c, i) => ( void run([{ op: "remove", path: `/listen/gateway/allow_from/${i}` }])} - aria-label={`删掉 ${c}`} + aria-label={`删除 ${c}`} > × @@ -276,7 +276,7 @@ function CidrList({ className="w-44 font-mono" value={adding} disabled={busy} - placeholder="加一段,比如 192.168.1.0/24" + placeholder="例如 192.168.1.0/24" onChange={(e) => setAdding(e.target.value)} onKeyDown={(e) => { if (e.key === "Enter" && adding.trim()) { @@ -368,7 +368,7 @@ function ProbesSection({ ))}

    - 路由规则里的「辅助请求」条件,只有在这一类选了「交给路由」时才可能命中。 + 仅当对应类别设为「交给路由」时,路由规则中的「辅助请求」条件才会命中。

    ); @@ -385,8 +385,8 @@ function LimitsSection({ const l = ov.limits; if (!l) return null; const rows: [string, keyof typeof l, string][] = [ - ["全局并发", "max_concurrent", "同时在飞的请求上限。超了先排队。"], - ["单个上游", "per_provider", "一家上游同时最多几个。防止一家慢拖垮不限。"], + ["全局并发", "max_concurrent", "同时处理的请求数上限,超出后进入队列。"], + ["单个上游", "per_provider", "单个上游同时处理的请求数上限,避免个别上游变慢时占满全局并发。"], ["队列上限", "queue_depth", "队列达到此长度后拒绝新请求。"], ["排队超时", "queue_timeout_secs", "排队超过此时长后放弃(秒)。"], ]; @@ -462,7 +462,7 @@ function ListenSection({ // 选「指定网卡」时先落到第一张,用户再从选单里换 const first = nics?.[0]; if (!first) { - toast.error("没找到可以绑的网卡。插着网线或连着 Wi-Fi 吗?"); + toast.error("未找到可绑定的网卡,请检查网线或 Wi-Fi 连接。"); return; } void write(first.addr); @@ -508,9 +508,8 @@ function ListenSection({ 网关已暴露在局域网 - 同一个网络里的机器都能连过来。来源白名单还在起作用,但它挡的是 - 地址,不是人。 - + 同一网络中的设备均可连接网关。来源白名单仅按 IP 地址限制访问。 + 密钥强制校验 @@ -532,7 +531,7 @@ function ListenSection({ **必须列出来**,否则选单会显示成别的地址,看起来像是它变了 */} {!nics?.some((n) => n.addr === cur) && ( - {cur}(现在找不到这张网卡) + {cur}(未找到此网卡) )} {nics?.map((n) => ( @@ -541,9 +540,9 @@ function ListenSection({ ))} - + - 地址会变 + 地址可能变化
@@ -649,7 +648,7 @@ export default function Config({ >
{g.name} - +
)} {/* **会话粘滞要摆在明面上,因为它直接决定账单。** - 关掉它,一次长会话每轮跳一家,prompt cache 不限失效, + 关掉它,一次长会话每轮跳一家,prompt cache 全部失效, 而缓存命中与否成本差 5 到 10 倍。 */} {g.kind === "轮流" && ( @@ -757,7 +756,7 @@ export default function Config({ }} /> - 会话粘滞(同一次对话固定走同一家) + 会话粘滞(同一会话固定使用同一上游) )} @@ -766,8 +765,8 @@ export default function Config({ // 缓存命中与否成本差 5 到 10 倍,而为了省 20% 的单价 // 丢掉 90% 的缓存折扣,是一笔怎么算都不划算的账。

- ⚠ 这个策略会让 prompt cache 失效,长会话的成本会明显上升。 - {g.kind === "轮流" ? "把上面那个粘滞打开就好。" : ""} + ⚠ 此策略会使 prompt cache 失效,长会话的费用将明显上升。 + {g.kind === "轮流" ? "开启会话粘滞可避免此问题。" : ""}

)} @@ -812,9 +811,9 @@ export default function Config({ 看到一个自己没同意过的条目 —— 所以这里出厂不勾,而且 要讲清勾上之后系统设置里会多出什么。 */} - 默认不开。 - - 勾上会发生什么 + 默认关闭。 + + 开启后的效果 @@ -886,7 +885,7 @@ function About() { * 遇到问题时一次性交出「我这儿是什么情况」,省掉来回问一轮(版本?配置? * 哪家上游?)—— 而每一趟都可能问漏。 * - * **里面的东西不限脱敏过,但仍然要求用户自己看一眼再交出去。**我们是个 + * **里面的东西全部脱敏过,但仍然要求用户自己看一眼再交出去。**我们是个 * 看得见所有 API key 的网关,这一步值得多花十秒。 */ function Diagnostics() { @@ -897,8 +896,8 @@ function Diagnostics() {

诊断包

- 版本、上游、熔断状态、最近的失败、脱敏后的配置原文。 - + 包含版本、上游、熔断状态、近期失败记录与脱敏后的配置文件。 + 不含请求与响应正文 。

@@ -924,7 +923,7 @@ function Diagnostics() { {path && (
- 写好了:{path} + 已生成:{path}
其中的密钥与地址已脱敏,提交前请自行核对。
@@ -972,9 +971,9 @@ function Uninstall() { {step === "idle" ? (

- 把接管过的客户端改回原样,注销开机自启。 - 直接把应用拖进废纸篓不会做这些 - —— 那时客户端会指着一个没有东西在听的端口。 + 还原所有已接管的客户端,并取消开机启动。 + 直接将应用移到废纸篓不会执行这些操作 + ,已接管的客户端将指向一个无人监听的端口。