diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 857e7144..11e947e9 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -5008,8 +5008,8 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tw-api" -version = "0.27.0" -source = "git+https://github.com/ThinkWatchProject/ThinkWatch-Core.git?tag=v0.27.0#ca6a4faff37de3c708aa2cbc73ff11f525515774" +version = "0.28.0" +source = "git+https://github.com/ThinkWatchProject/ThinkWatch-Core.git?tag=v0.28.0#914444e1648dc1186b7c4578f8e2efeb38fdb53e" dependencies = [ "serde", "serde_json", @@ -5018,8 +5018,8 @@ dependencies = [ [[package]] name = "tw-types" -version = "0.27.0" -source = "git+https://github.com/ThinkWatchProject/ThinkWatch-Core.git?tag=v0.27.0#ca6a4faff37de3c708aa2cbc73ff11f525515774" +version = "0.28.0" +source = "git+https://github.com/ThinkWatchProject/ThinkWatch-Core.git?tag=v0.28.0#914444e1648dc1186b7c4578f8e2efeb38fdb53e" dependencies = [ "serde", "serde_json", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 93f5c763..6b21e17c 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -31,7 +31,7 @@ tauri-plugin-deep-link = "2" # 编出来的东西不一样;而更要紧的是,打进 `.app` 的那个 twcore 二进制 # 必须和这里编译进去的协议镜像来自同一个 core 版本 —— 打包脚本正是从 # 这个 tag 去取二进制的(见 scripts/fetch-core.sh)。 -tw-api = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.27.0" } +tw-api = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.28.0" } anyhow = "1" libc = "0.2" diff --git a/src/i18n/core.i18n.ts b/src/i18n/core.i18n.ts index 35174fde..45113dbc 100644 --- a/src/i18n/core.i18n.ts +++ b/src/i18n/core.i18n.ts @@ -184,6 +184,11 @@ const ZH: Record = { "l1.http_proxy.connect_rejected": (a) => `代理拒绝了 CONNECT 请求(HTTP ${a.status}):${a.line}`, + // ── l3:推理测速 ──────────────────────────────────────────────── + "l3.refused": (a) => `上游返回 ${a.status}:${a.detail}`, + "l3.stream_failed": (a) => `上游在回答过程中报错:${a.detail}`, + "l3.not_streamed": () => "上游没有以流式回答,无法测得首 token 时间。", + // ── lite:桌面版自己说的。core 停了,没法再替那些请求说话 ───────── "lite.core_stopped": () => "core 在请求完成前停止运行,请求已中断。", diff --git a/src/types.ts b/src/types.ts index b9c74bbe..eceaaedd 100644 --- a/src/types.ts +++ b/src/types.ts @@ -868,7 +868,9 @@ export interface SpeedEstimate { model: string; /** 输入 token。**精确值** —— 请求是固定的 */ input_tokens: number; - max_output_tokens: number; + /** 输出上限。**没有 = 这家不接受输出上限**(ChatGPT 账号),那时 + `cost_micros` 也没有 —— 回答有多长由模型决定 */ + max_output_tokens?: number | null; /** 按量计费算得出来时是那个数,不计费时是 0,无法计价时是 null */ cost_micros?: number | null; /** `per-token` / `free` */ @@ -895,7 +897,7 @@ export interface SpeedResult { total_ms: number; input_tokens: number | null; output_tokens: number | null; - error: string | null; + error?: Msg | null; } /** 一个出站代理。**用户名和密码都不在这里** —— 服务端只给「有没有认证」 */ diff --git a/src/upstreams/TestDialogs.i18n.ts b/src/upstreams/TestDialogs.i18n.ts index 8b686643..7e9c4428 100644 --- a/src/upstreams/TestDialogs.i18n.ts +++ b/src/upstreams/TestDialogs.i18n.ts @@ -33,7 +33,9 @@ export const testDialogsText = messages( maxOutput: "输出上限", estimatedCost: "预估费用", uncalculable: "无法计算", - totalUncalculable: "无法计算:部分模型未定价", + noLimit: "不限", + byUsage: "按实际用量", + totalUncalculable: "无法计算:部分上游没有金额", noneSelected: "未选择上游", results: "测速结果", firstToken: "首 token", @@ -75,7 +77,9 @@ export const testDialogsText = messages( maxOutput: "Max output", estimatedCost: "Estimated cost", uncalculable: "Unknown", - totalUncalculable: "Unknown: unpriced models", + noLimit: "No limit", + byUsage: "By actual usage", + totalUncalculable: "Unknown for some upstreams", noneSelected: "No upstreams selected", results: "Results", firstToken: "First token", diff --git a/src/upstreams/TestDialogs.tsx b/src/upstreams/TestDialogs.tsx index 655fdc5a..f139bbcc 100644 --- a/src/upstreams/TestDialogs.tsx +++ b/src/upstreams/TestDialogs.tsx @@ -31,6 +31,7 @@ import { } from "@/types"; import { useText } from "@/i18n"; import { commonText } from "@/i18n/common.i18n"; +import { coreText } from "@/i18n/core.i18n"; import { api } from "./api"; import { TestLine } from "./ConnectionSection"; import { billingSummary, egressLabel, errorText, l1ErrorText, l1SkipText, l1StageLabel, skipLabel } from "./labels"; @@ -412,12 +413,20 @@ export function SpeedTestDialog({ {i.provider} {i.input_tokens} - {i.max_output_tokens} + + {i.max_output_tokens ?? ( + {t.speed.noLimit} + )} + {i.cost_micros != null ? ( usd(i.cost_micros) ) : ( - {t.speed.uncalculable} + // 上限报不出来的那种上游(ChatGPT 账号)不是「未定价」, + // 是回答有多长由模型决定 + + {i.max_output_tokens == null ? t.speed.byUsage : t.speed.uncalculable} + )} @@ -463,7 +472,9 @@ export function SpeedTestDialog({ {r.provider} {!r.ok && r.error && ( -
{r.error}
+
+ {coreText(r.error)} +
)}