Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/shots/core/en/overview.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
},
{
"id": "titling",
"mode": "passthrough"
"mode": "forward"
},
{
"id": "topic_detect",
"mode": "passthrough"
"mode": "forward"
},
{
"id": "suggestion",
"mode": "passthrough"
"mode": "forward"
}
],
"clients": [
Expand Down
4 changes: 2 additions & 2 deletions scripts/shots/core/en/status.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"api_version": 35,
"api_version": 36,
"clients": 4,
"config_path": "",
"gateway_addr": null,
Expand All @@ -14,5 +14,5 @@
"reachable": []
},
"uptime_secs": 0,
"version": "0.59.0"
"version": "0.60.0"
}
6 changes: 3 additions & 3 deletions scripts/shots/core/zh/overview.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
},
{
"id": "titling",
"mode": "passthrough"
"mode": "forward"
},
{
"id": "topic_detect",
"mode": "passthrough"
"mode": "forward"
},
{
"id": "suggestion",
"mode": "passthrough"
"mode": "forward"
}
],
"clients": [
Expand Down
4 changes: 2 additions & 2 deletions scripts/shots/core/zh/status.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"api_version": 35,
"api_version": 36,
"clients": 4,
"config_path": "",
"gateway_addr": null,
Expand All @@ -14,5 +14,5 @@
"reachable": []
},
"uptime_secs": 0,
"version": "0.59.0"
"version": "0.60.0"
}
44 changes: 22 additions & 22 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ license = "MIT"
# twcore 二进制必须和这里编译进去的协议镜像来自同一个 core 版本 —— 打包脚本正是
# 从 tw-api 锁到的 tag 去取二进制的(见 scripts/fetch-core.sh)。
[workspace.dependencies]
tw-api = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.59.0" }
tw-types = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.59.0" }
tw-yaml = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.59.0" }
tw-guard = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.59.0" }
tw-watch = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.59.0" }
tw-link = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.59.0" }
tw-api = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.60.0" }
tw-types = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.60.0" }
tw-yaml = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.60.0" }
tw-guard = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.60.0" }
tw-watch = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.60.0" }
tw-link = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.60.0" }

[lib]
name = "thinkwatch_lite_lib"
Expand Down
6 changes: 3 additions & 3 deletions src-tauri/src/notices/fixtures/snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@
},
{
"id": "titling",
"mode": "passthrough"
"mode": "forward"
},
{
"id": "topic_detect",
"mode": "passthrough"
"mode": "forward"
},
{
"id": "suggestion",
"mode": "passthrough"
"mode": "forward"
}
],
"retention": {
Expand Down
30 changes: 11 additions & 19 deletions src/generated/tw-api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Generated by tw-api (`tw_api::ts::export_all`). Do not edit by hand.

export const CONTROL_API_VERSION = 35;
export const CONTROL_API_VERSION = 36;

/**
* 一个账号上游登的是哪个账号。
Expand Down Expand Up @@ -672,7 +672,7 @@ export type Dialect = "anthropic" | "openai-chat" | "openai-responses" | "gemini
/**
* 一次试算的结论。
*/
export type DryRunOutcome = "route" | "deny" | "no_match" | "unavailable" | "intercepted" | "passthrough";
export type DryRunOutcome = "route" | "deny" | "no_match" | "unavailable" | "intercepted";

/**
* 「如果现在来这样一个请求,会走到哪儿」。
Expand Down Expand Up @@ -719,11 +719,11 @@ route: string,
strategy?: GroupKind | null,
/**
* `route` | `deny` | `no_match` | `unavailable`(选中的上游都服务不了,
* 见 `skipped`)| `intercepted` | `passthrough`
* 见 `skipped`)| `intercepted`
*
* **后两个说的是这个请求压根没到规则那一层。**客户端自己发的辅助
* 请求先过 `client_probes`:本地应答的一个字节都不出本机,原样放行的
* 直接转发 —— 两种情况下 `trace` 都是空的,因为确实一条规则都没求值。
* **`intercepted` 说的是这个请求压根没到规则那一层。**客户端自己发的辅助
* 请求先过 `client_probes`:本地应答的一个字节都不出本机,`trace` 是空的,
* 因为确实一条规则都没求值。转发的那几类照常走规则,和普通请求一样。
*/
outcome: DryRunOutcome,
/**
Expand Down Expand Up @@ -2501,22 +2501,21 @@ export type ProbeClass = "health_check" | "warmup" | "titling" | "topic_detect"
/**
* 一类辅助请求怎么处理。
*/
export type ProbeMode = "intercept" | "route" | "passthrough";
export type ProbeMode = "intercept" | "forward";

/**
* 一类客户端辅助请求的处置。
*
* **这一段以前在界面上完全不存在,而它的缺席是连锁的**:路由条件
* `when.intent` 只有在对应那一类被配成 `route` 时才可能命中,所以
* 界面上那些写了 `intent` 的规则永远不会生效,而用户无从知道为什么。
* 路由条件 `when.intent` 只对 `forward` 的类别命中 —— `intercept` 的一个字节都不出
* 本机,到不了规则那一层。
*/
export type ProbeView = {
/**
* `health_check` / `warmup` / `titling` / `topic_detect` / `suggestion`
*/
id: ProbeClass,
/**
* `intercept` / `route` / `passthrough`
* `intercept` / `forward`
*/
mode: ProbeMode, };

Expand Down Expand Up @@ -3165,14 +3164,7 @@ export type RouteSave = { route: RouteInput, base_version?: string | null,
* 原来用它、不在列表里的改用默认路由,和路由本身在同一个版本里写入。
* 不给就不动密钥的选择
*/
keys?: Array<string> | null,
/**
* 和路由一起写入:把这几类客户端辅助请求设为「交给路由」。
*
* **规则里的辅助请求条件只对交给路由的类别生效** —— 其余类别的请求在
* 进路由之前就被本地应答或原样放行,不带类别标记,那个条件永远不满足
*/
route_probes?: Array<string>, };
keys?: Array<string> | null, };

/**
* 一段时间里各条路由走了多少请求、各条规则命中了多少,以及这些数从哪一刻起是全的
Expand Down
1 change: 0 additions & 1 deletion src/i18n/core.zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,6 @@
"control.sheet_in_use": "价目表「{sheet}」仍被上游{upstreams!names}使用,请先解除关联再删除。",
"control.default_route_cannot_delete": "路由「{route}」是默认路由,不能删除。请先将其他路由设为默认路由。",
"control.reassign_to_deleted_route": "网关密钥不能改用正在删除的路由「{route}」。",
"control.unknown_probe_class": "没有「{class}」这一类辅助请求。",
"control.builtin_group_fixed": "每个上游的内置策略组随上游列表自动生成,不能编辑或删除。",
"control.route.duplicate_rule": "路由中有两条名为「{rule}」的规则。",
"control.rule.condition_no_value": "规则「{rule}」:条件 {field} 没有值。",
Expand Down
10 changes: 3 additions & 7 deletions src/routing/DryRunDialog.i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ export const dryRunText = messages(
denied: "拒绝",
unavailable: "选中的上游均无法服务此请求,请求将返回错误",
noMatch: "无规则命中,请求将返回错误",
// 这两类请求在规则之前就有了去向 —— 说清它去了哪儿,以及怎么让它走规则
// 本地应答的请求在规则之前就有了去向 —— 说清它去了哪儿,以及怎么让它走规则
intercepted: "本地应答",
interceptedWhat: "网关直接应答这一类请求,不发送到上游,也不产生费用。路由规则不参与。",
passedThrough: "原样放行",
passedThroughWhat: "作为普通请求转发,不经过路由规则。",
howToRoute: "要让它按规则走,在「辅助请求」中将这一类改为「交给路由」。",
howToRoute: "要让它按规则走,在「辅助请求」中将这一类改为「转发」。",
decides: "命中 · 决定去向",
applies: "命中 · 应用改写参数或安全要求",
decidedBy: (n: number) => `命中 · 去向已由第 ${n} 条决定`,
Expand Down Expand Up @@ -86,9 +84,7 @@ export const dryRunText = messages(
intercepted: "Answered locally",
interceptedWhat:
"The gateway answers this kind directly. Nothing is sent upstream and no cost is incurred. The routing rules take no part.",
passedThrough: "Passed through",
passedThroughWhat: "Forwarded as an ordinary request, without going through the routing rules.",
howToRoute: "To have the rules decide, set this kind to “Use routing” under Auxiliary.",
howToRoute: "To have the rules decide, set this kind to “Forward” under Auxiliary.",
decides: "Matched · decides the destination",
applies: "Matched · applies parameter rewrites or security requirements",
decidedBy: (n: number) => `Matched · destination already decided by rule ${n}`,
Expand Down
7 changes: 2 additions & 5 deletions src/routing/DryRunDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ function verdictTone(r: DryRunResult): StatusTone {
case "route":
return "ok";
case "intercepted":
case "passthrough":
return "idle";
default:
return "error";
Expand Down Expand Up @@ -368,7 +367,7 @@ function Result({
* **那时下面每一格都不适用** —— 路由、候选、改写说的都是规则走完之后
* 的事,而一条规则都没走。留着它们只会让人以为它真的去了那儿。
*/
const short = r.outcome === "intercepted" || r.outcome === "passthrough";
const short = r.outcome === "intercepted";
const target = r.outcome === "route" ? (r.via_group ?? r.candidates[0] ?? null) : null;

// 这一趟经过的路:密钥 → 路由 → 规则 → 去向。和路由图同一套标志
Expand Down Expand Up @@ -427,7 +426,7 @@ function Result({
{r.outcome === "deny" && r.reason && <p className="tw-body text-muted-foreground">{t.reason(r.reason)}</p>}
{short && (
<div className="flex flex-col gap-1 tw-body text-muted-foreground">
<span>{r.outcome === "intercepted" ? t.interceptedWhat : t.passedThroughWhat}</span>
<span>{t.interceptedWhat}</span>
<span>{t.howToRoute}</span>
</div>
)}
Expand Down Expand Up @@ -577,8 +576,6 @@ function headline(r: DryRunResult): string {
return m.unavailable;
case "intercepted":
return m.intercepted;
case "passthrough":
return m.passedThrough;
default:
return m.noMatch;
}
Expand Down
Loading
Loading