fix(web): agent check default model fallback; ensure browser session before desktop iframe (FIX-5)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-29 19:37:12 +08:00
1 parent 6aaf8c0704
commit 9244315768
4 files changed
+63 -22

No files matched your search

@@ -31,7 +31,12 @@ const plainSummary = (t: string) =>
const capTitle = (id: string) => CAPABILITY_CATALOG[id as KnownCapabilityId]?.title ?? id;
/** 默认上游(巡检没有单独的上游设置,跟随 Agent 设置里的默认上游) */
export type DefaultUpstream = { name: string; model: string | null } | null;
export type DefaultUpstream = {
name: string;
/** 上游的默认模型;上游没填时是模型目录的第一个(modelFromCatalog) */
model: string | null;
modelFromCatalog?: boolean;
} | null;
const modelsTitle = (models: { provider: string | null; model: string; count: number }[]) =>
models.map((m) => `${m.provider ? `${m.provider} · ` : ""}${m.model}:${m.count} 次`).join("\n");
@@ -152,9 +157,16 @@ export function AgentCheckCard({
) : null}
</span>
) : upstream ? (
<span className="break-words">
默认上游 {upstream.name}
{upstream.model ? ` · ${upstream.model}` : ""}
<span
className="break-words"
title={
upstream.modelFromCatalog
? "上游没有指定默认模型,运行时使用模型目录里的第一个"
: "还没有运行记录,按默认上游显示"
}
>
默认上游 {upstream.name} · {upstream.model ?? "模型未指定"}
{upstream.modelFromCatalog ? <span className="text-muted-foreground">(目录首个)</span> : null}
</span>
) : (
<span className="text-muted-foreground">未配置 Agent 上游</span>
@@ -3,7 +3,7 @@ import { SCHEDULE_CHANGED_EVENT, type ScheduledJob } from "@umt/contracts";
import { AlertTriangle, Bot, CalendarClock, CircleCheck, Coins, LoaderCircle, Plus, XCircle } from "lucide-react";
import { type ReactNode, useEffect, useRef, useState } from "react";
import { useLocation } from "react-router";
import { usePiUpstreams } from "~/api/pi.ts";
import { usePiUpstreamModels, usePiUpstreams } from "~/api/pi.ts";
import { useScheduleBoard } from "~/api/schedules.ts";
import { EmptyState, ErrorState, LoadingState } from "~/components/console/empty-state.tsx";
import { StatTile } from "~/components/console/stat-tile.tsx";
@@ -96,7 +96,16 @@ export function PlanBoard({ highlightJob }: { highlightJob?: string }) {
const autoJobs = items.filter((j) => j.kind === "task");
const checks = items.filter((j) => j.kind === "agent_check");
const def = upstreams.data?.items.find((u) => u.isDefault);
const upstream: DefaultUpstream = def ? { name: def.name, model: def.defaultModel ?? null } : null;
// 上游没填默认模型时,运行时用模型目录的第一个(packages/agent pi/upstream.ts pickModel),这里同样取目录首个
const catalog = usePiUpstreamModels(def && !def.defaultModel ? def.id : null);
const catalogModel = catalog.data?.models[0]?.id ?? null;
const upstream: DefaultUpstream = def
? {
name: def.name,
model: def.defaultModel ?? catalogModel,
modelFromCatalog: !def.defaultModel && !!catalogModel,
}
: null;
const s = planStats(items);
const val = (n: number) => (board.isPending ? "…" : board.isError ? "—" : n);