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
8 changes: 4 additions & 4 deletions src-tauri/Cargo.lock

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

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions src/i18n/core.i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ const ZH: Record<string, Say> = {
"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 在请求完成前停止运行,请求已中断。",

Expand Down
6 changes: 4 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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` */
Expand All @@ -895,7 +897,7 @@ export interface SpeedResult {
total_ms: number;
input_tokens: number | null;
output_tokens: number | null;
error: string | null;
error?: Msg | null;
}

/** 一个出站代理。**用户名和密码都不在这里** —— 服务端只给「有没有认证」 */
Expand Down
8 changes: 6 additions & 2 deletions src/upstreams/TestDialogs.i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export const testDialogsText = messages(
maxOutput: "输出上限",
estimatedCost: "预估费用",
uncalculable: "无法计算",
totalUncalculable: "无法计算:部分模型未定价",
noLimit: "不限",
byUsage: "按实际用量",
totalUncalculable: "无法计算:部分上游没有金额",
noneSelected: "未选择上游",
results: "测速结果",
firstToken: "首 token",
Expand Down Expand Up @@ -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",
Expand Down
17 changes: 14 additions & 3 deletions src/upstreams/TestDialogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -412,12 +413,20 @@ export function SpeedTestDialog({
<TableRow key={i.provider}>
<TableCell className="font-mono">{i.provider}</TableCell>
<TableCell className="text-right tabular-nums">{i.input_tokens}</TableCell>
<TableCell className="text-right tabular-nums">{i.max_output_tokens}</TableCell>
<TableCell className="text-right tabular-nums">
{i.max_output_tokens ?? (
<span className="text-muted-foreground">{t.speed.noLimit}</span>
)}
</TableCell>
<TableCell className="text-right tabular-nums">
{i.cost_micros != null ? (
usd(i.cost_micros)
) : (
<span className="text-muted-foreground">{t.speed.uncalculable}</span>
// 上限报不出来的那种上游(ChatGPT 账号)不是「未定价」,
// 是回答有多长由模型决定
<span className="text-muted-foreground">
{i.max_output_tokens == null ? t.speed.byUsage : t.speed.uncalculable}
</span>
)}
</TableCell>
</TableRow>
Expand Down Expand Up @@ -463,7 +472,9 @@ export function SpeedTestDialog({
<TableCell className="font-mono">
{r.provider}
{!r.ok && r.error && (
<div className="font-sans tw-label whitespace-normal text-destructive">{r.error}</div>
<div className="font-sans tw-label whitespace-normal text-destructive">
{coreText(r.error)}
</div>
)}
</TableCell>
<TableCell className="text-right tabular-nums">
Expand Down
Loading