Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(models): remove the Tools tab's check-all; checks run one pair at a time (#2634)

Call White7adfcc8bb476
diff --git a/tests/scenarios/model_hub/catalog.yaml b/tests/scenarios/model_hub/catalog.yaml
index e204c5239..1eec39642 100644
--- a/tests/scenarios/model_hub/catalog.yaml
+++ b/tests/scenarios/model_hub/catalog.yaml
@@ -445,9 +445,7 @@ scenarios:
- 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-003: lets the locale compose a price with its extras'
- 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-003: says a check''s cost is unknown before it runs, when no estimate is known'
- 'ui/src/components/settings/models/SourceDetailPanel.test.tsx::MH-HOSTED-UI-003: says a re-check''s cost is unknown when no estimate is known'
- - 'ui/src/components/settings/models/hostedTools.test.ts::MH-HOSTED-UI-003: totals a check only from what the server estimates, and never counts unknown as zero'
- 'ui/src/components/settings/models/format.test.ts::MH-HOSTED-UI-003: keeps the first significant digits of a per-call price, and never shows a nonzero price as zero'
- - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-003: lets the locale compose a set''s cost with its unpriced checks'
- id: MH-HOSTED-UI-004
name: The Tools tab says how many checks an engine upgrade made stale, and nothing when none did
status: covered
@@ -491,18 +489,17 @@ scenarios:
- 'ui/src/components/settings/models/useHostedTools.test.tsx::MH-HOSTED-UI-007: keeps a tool pending until the read reconciling its lost write lands'
- 'ui/src/components/settings/models/useHostedTools.test.tsx::MH-HOSTED-UI-007: drops a write answer asked under another Source identity'
- id: MH-HOSTED-UI-013
- name: A hosted-tool check runs only on the user's ask with its estimated cost shown first, and an answer that is not evidence reads as not verified with a retry
+ name: A hosted-tool check runs only on the user's ask, one pair at a time, with its estimated cost shown first, and an answer that is not evidence reads as not verified with a retry
status: covered
kind: contract
layer: unit
test:
- 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-013: checks one row with its cost on the button, and says when the answer was not evidence'
- - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-013: runs the header check only after the dialog shows what it sends and costs'
+ - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-013: offers a check one pair at a time, never all pairs at once'
- 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-013: says why a failed check failed, and never shows the server''s key as text'
- 'ui/src/components/settings/models/SourceDetailPanel.test.tsx::MH-HOSTED-UI-013: checks a tool again from its chip, with the cost on the action, and answers there when the check is not evidence'
- 'ui/src/components/settings/models/useHostedTools.test.tsx::MH-HOSTED-UI-013: reads the record before calling a probe unanswered when its answer was lost'
- 'ui/src/components/settings/models/useHostedTools.test.tsx::MH-HOSTED-UI-013: reads a verdict the status does not carry as not verified, with why'
- - 'ui/src/components/settings/models/hostedTools.test.ts::MH-HOSTED-UI-013: offers to check every pair with no current answer, images included'
- id: MH-HOSTED-UI-016
name: A hosted-tool check is a real call on exactly one Source, so the Models page reads its Sources again after one, and a Source the probe verified shows as verified
status: covered
diff --git a/ui/src/components/settings/models/HostedCapabilityChips.tsx b/ui/src/components/settings/models/HostedCapabilityChips.tsx
index fdb77e920..abf6af81a 100644
--- a/ui/src/components/settings/models/HostedCapabilityChips.tsx
+++ b/ui/src/components/settings/models/HostedCapabilityChips.tsx
@@ -16,7 +16,7 @@ import { cn } from '@/lib/utils';
import { formatDayTime, formatMonthDay, formatSentences } from './format';
import { probeKey, type ModelCapability, type ProbeTarget } from './hostedTools';
import type { HostedToolName, HostedToolProbeResult, RefusedEffort } from './types';
-import { ProbeAnswerNote } from './HostedProbeDialog';
+import { ProbeAnswerNote } from './ProbeAnswerNote';
import { useEstimateLabel } from './useEstimateLabel';
const TOOL_ICON: Record<HostedToolName, React.ComponentType<{ className?: string }>> = {
diff --git a/ui/src/components/settings/models/HostedProbeDialog.tsx b/ui/src/components/settings/models/HostedProbeDialog.tsx
deleted file mode 100644
index f9aae17d2..000000000
--- a/ui/src/components/settings/models/HostedProbeDialog.tsx
+++ /dev/null
@@ -1,237 +0,0 @@
-// 检测可用工具 — the confirm and result dialogs (design.pen frame vQPXo).
-//
-// A check sends real, cost-bearing requests, so it runs only after the user has
-// seen what will be sent and what it is estimated to cost. Probes run one at a
-// time; only verified and unsupported become evidence, so a probe that did not
-// get an answer is reported as "not verified", never as "not supported".
-import * as React from 'react';
-import { Trans, useTranslation } from 'react-i18next';
-import { AlertCircle, AtSign, Check, Globe, Image as ImageIcon, Loader2, RotateCw, ShieldCheck } from 'lucide-react';
-
-import { Button } from '@/components/ui/button';
-import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@/components/ui/dialog';
-import { cn } from '@/lib/utils';
-import { probeCostSummary, probeKey, probeUnanswered, type ProbeTarget } from './hostedTools';
-import { serverText } from './serverCopy';
-import type { HostedToolName, HostedToolProbeResult, Source } from './types';
-import { useCostSummaryLabel, useEstimateLabel } from './useEstimateLabel';
-
-const TOOL_ICON: Record<HostedToolName, React.ComponentType<{ className?: string }>> = {
- web_search: Globe,
- x_search: AtSign,
- image_generation: ImageIcon,
-};
-
-type Outcome = HostedToolProbeResult['call']['outcome'] | 'failed';
-
-const outcomeOf = (result: HostedToolProbeResult | null): Outcome => result?.call.outcome ?? 'failed';
-
-const TargetLine: React.FC<{ target: ProbeTarget; sources: ReadonlyMap<string, Source>; trailing: React.ReactNode }> = ({ target, sources, trailing }) => {
- const { t } = useTranslation();
- const Icon = TOOL_ICON[target.tool];
- return (
- <li className="model-hub-probe-row flex items-center gap-2.5 rounded-lg border border-border bg-background" data-probe={probeKey(target)}>
- <Icon className="model-hub-ink-mint size-[14px] shrink-0" aria-hidden />
- {/* The pair reads as the locale composes it; each part keeps its own style. */}
- <Trans
- i18nKey="settings.models.tools.dialog.pair"
- values={{
- tool: t(`settings.models.tools.tool.${target.tool}.name`),
- source: sources.get(target.candidate.source_id)?.display_name ?? target.candidate.source_id,
- model: target.candidate.model_id,
- }}
- components={{
- tool: <span className="shrink-0 font-semibold text-foreground" />,
- source: <span className="min-w-0 truncate text-foreground" />,
- model: <span className="min-w-0 truncate font-mono text-muted" />,
- muted: <span className="text-muted" />,
- }}
- />
- <span className="ml-auto shrink-0">{trailing}</span>
- </li>
- );
-};
-
-const OutcomeChip: React.FC<{ outcome: Outcome }> = ({ outcome }) => {
- const { t } = useTranslation();
- if (outcome === 'verified') {
- return <span className="model-hub-pill model-hub-status-mint gap-1 border"><Check className="size-3" aria-hidden />{t('settings.models.tools.result.outcome.verified')}</span>;
- }
- if (outcome === 'unsupported') {
- return <span className="model-hub-pill model-hub-fill-0a gap-1 border border-border text-muted">{t('settings.models.tools.result.outcome.unsupported')}</span>;
- }
- return <span className="model-hub-pill model-hub-status-gold gap-1 border"><AlertCircle className="size-3" aria-hidden />{t('settings.models.tools.result.outcome.unverified')}</span>;
-};
-
-/**
- * What a probe that became no evidence says where it was asked (a Tools row, a
- * Source chip): a request that failed says why, and one that completed without
- * the tool says that. Nothing for an answer that is evidence.
- */
-export const ProbeAnswerNote: React.FC<{ result: HostedToolProbeResult | null }> = ({ result }) => {
- const { t } = useTranslation();
- if (!probeUnanswered(result)) return result ? <ReplayNote replay={result.replay} /> : null;
- const failure = serverText(t, result?.call.error);
- return (
- <span className="model-hub-tool-cost-note flex items-center gap-1 model-hub-ink-gold" role="status">
- <AlertCircle className="size-3 shrink-0" aria-hidden />
- {failure
- ? t('settings.models.tools.probe.outcome.transientReason', { reason: failure })
- : result?.call.outcome === 'inconclusive'
- ? t('settings.models.tools.probe.outcome.inconclusive')
- : t('settings.models.tools.probe.outcome.transient')}
- </span>
- );
-};
-
-/**
- * The replay step a verified call is followed by, when it ran and did not verify.
- * Null (no replay ran) and a verified replay say nothing; a replay that got no
- * answer asks for another try, never reads as a failure.
- */
-const ReplayNote: React.FC<{ replay: HostedToolProbeResult['replay'] }> = ({ replay }) => {
- const { t } = useTranslation();
- if (!replay || replay.outcome === 'verified') return null;
- return (
- <span className="model-hub-tool-cost-note flex items-center gap-1 model-hub-ink-gold" role="status">
- <AlertCircle className="size-3 shrink-0" aria-hidden />
- {t(replay.outcome === 'unsupported' ? 'settings.models.tools.probe.replay.unsupported' : 'settings.models.tools.probe.replay.unverified')}
- </span>
- );
-};
-
-/** Mounted for one check: the set it shows is the one it was opened with. */
-export const HostedProbeDialog: React.FC<{
- targets: readonly ProbeTarget[];
- sources: ReadonlyMap<string, Source>;
- onRun: (target: ProbeTarget) => Promise<HostedToolProbeResult | null>;
- onClose: () => void;
-}> = ({ targets, sources, onRun, onClose }) => {
- const { t } = useTranslation();
- const estimateLabel = useEstimateLabel();
- const costSummaryLabel = useCostSummaryLabel();
- // The set is fixed when the dialog opens: the read refreshes under it as probes land.
- const [planned, setPlanned] = React.useState<readonly ProbeTarget[]>(targets);
- const [phase, setPhase] = React.useState<'confirm' | 'running' | 'result'>('confirm');
- const [results, setResults] = React.useState<ReadonlyMap<string, HostedToolProbeResult | null>>(() => new Map());
-
- const run = async (batch: readonly ProbeTarget[]) => {
- setPhase('running');
- for (const target of batch) {
- const result = await onRun(target);
- setResults((previous) => new Map(previous).set(probeKey(target), result));
- }
- setPhase('result');
- };
-
- const totalLabel = costSummaryLabel(probeCostSummary(planned));
- const outcomes = planned.map((target) => outcomeOf(results.get(probeKey(target)) ?? null));
- const unverified = planned.filter((target) => results.has(probeKey(target)) && probeUnanswered(results.get(probeKey(target)) ?? null));
- const count = (wanted: (outcome: Outcome) => boolean) => outcomes.filter(wanted).length;
- // A retry is as paid as the first run, so it says its cost the same way.
- const retryLabel = costSummaryLabel(probeCostSummary(unverified));
- const done = results.size;
-
- return (
- <Dialog open onOpenChange={(next) => { if (!next && phase !== 'running') onClose(); }}>
- <DialogContent className="model-hub-probe-dialog flex max-h-[calc(100dvh-2rem)] flex-col gap-0 overflow-hidden p-0 sm:max-w-[560px]">
- <div className="model-hub-probe-head border-b border-border">
- <DialogTitle className="font-bold text-foreground">
- {t(phase === 'result' ? 'settings.models.tools.result.title' : 'settings.models.tools.dialog.title')}
- </DialogTitle>
- <DialogDescription className="text-muted">{t('settings.models.tools.dialog.subtitle')}</DialogDescription>
- </div>
- <div className="model-hub-probe-body flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto">
- {phase === 'confirm' && (
- <>
- <p className="text-foreground">{t('settings.models.tools.dialog.body', { count: planned.length })}</p>
- <p className="model-hub-probe-privacy flex items-start gap-2 rounded-lg">
- <ShieldCheck className="model-hub-ink-mint mt-px size-[14px] shrink-0" aria-hidden />
- <span>{t('settings.models.tools.dialog.privacy')}</span>
- </p>
- <span className="model-hub-probe-label">{t('settings.models.tools.dialog.listTitle')}</span>
- <ul className="flex flex-col gap-1.5">
- {planned.map((target) => (
- <TargetLine key={probeKey(target)} target={target} sources={sources} trailing={<span className="font-semibold text-foreground">{estimateLabel(target.candidate.probe_estimate) ?? t('settings.models.tools.probe.unknown')}</span>} />
- ))}
- </ul>
- <div className="model-hub-probe-total flex items-center justify-between gap-3">
- <span className="flex flex-col">
- <span className="font-semibold text-foreground">{t('settings.models.tools.dialog.total')}</span>
- <span className="text-muted">{t('settings.models.tools.dialog.totalNote')}</span>
- </span>
- <span className="font-bold text-foreground">{totalLabel}</span>
- </div>
- </>
- )}
- {phase !== 'confirm' && (
- <>
- {phase === 'result' && (
- <span className="flex flex-wrap gap-1.5" role="status">
- {count((outcome) => outcome === 'verified') > 0 && <span className="model-hub-pill model-hub-status-mint gap-1 border"><Check className="size-3" aria-hidden />{t('settings.models.tools.result.verified', { count: count((outcome) => outcome === 'verified') })}</span>}
- {count((outcome) => outcome === 'unsupported') > 0 && <span className="model-hub-pill model-hub-fill-0a border border-border text-muted">{t('settings.models.tools.result.unsupported', { count: count((outcome) => outcome === 'unsupported') })}</span>}
- {unverified.length > 0 && <span className="model-hub-pill model-hub-status-gold gap-1 border"><AlertCircle className="size-3" aria-hidden />{t('settings.models.tools.result.unverified', { count: unverified.length })}</span>}
- </span>
- )}
- {phase === 'running' && <p className="flex items-center gap-2 text-muted" role="status"><Loader2 className="size-3.5 animate-spin" aria-hidden />{t('settings.models.tools.dialog.running', { done, count: planned.length })}</p>}
- <ul className="flex flex-col gap-1.5">
- {planned.map((target, index) => {
- const key = probeKey(target);
- const result = results.get(key);
- // A request that failed says why; one that completed without the tool says that.
- const failure = serverText(t, result?.call.error);
- const reason = outcomes[index] === 'verified' || outcomes[index] === 'unsupported'
- ? null
- : outcomes[index] === 'inconclusive' && !failure
- ? t('settings.models.tools.result.reason.inconclusive')
- : failure
- ? t('settings.models.tools.result.reason.transientReason', { reason: failure })
- : t('settings.models.tools.result.reason.transient');
- return (
- <React.Fragment key={key}>
- <TargetLine
- target={target}
- sources={sources}
- trailing={results.has(key)
- ? <OutcomeChip outcome={outcomes[index]} />
- : <Loader2 className="size-3.5 animate-spin text-muted" aria-label={t('settings.models.tools.probe.running') as string} />}
- />
- {results.has(key) && reason && <p className="model-hub-probe-reason">{reason}</p>}
- {results.has(key) && !reason && result && <ReplayNote replay={result.replay} />}
- </React.Fragment>
- );
- })}
- </ul>
- {phase === 'result' && <p className="text-muted">{t('settings.models.tools.result.note')}</p>}
- </>
- )}
- </div>
- <div className={cn('model-hub-probe-foot flex items-center gap-2 border-t border-border', phase === 'result' && unverified.length > 0 ? 'justify-between' : 'justify-end')}>
- {phase === 'confirm' && (
- <>
- <Button variant="outline" size="sm" onClick={onClose}>{t('settings.models.tools.dialog.cancel')}</Button>
- <Button size="sm" disabled={planned.length === 0} onClick={() => void run(planned)}>
- {t('settings.models.tools.dialog.startCost', { cost: totalLabel })}
- </Button>
- </>
- )}
- {phase === 'result' && (
- <>
- {unverified.length > 0 && (
- <Button variant="outline" size="sm" onClick={() => {
- setPlanned(unverified);
- setResults(new Map());
- void run(unverified);
- }}>
- <RotateCw className="size-3.5" aria-hidden />
- {t('settings.models.tools.result.retryCost', { count: unverified.length, cost: retryLabel })}
- </Button>
- )}
- <Button size="sm" onClick={onClose}>{t('settings.models.tools.result.done')}</Button>
- </>
- )}
- </div>
- </DialogContent>
- </Dialog>
- );
-};
diff --git a/ui/src/components/settings/models/ProbeAnswerNote.tsx b/ui/src/components/settings/models/ProbeAnswerNote.tsx
new file mode 100644
index 000000000..0df6ef0cd
--- /dev/null
+++ b/ui/src/components/settings/models/ProbeAnswerNote.tsx
@@ -0,0 +1,46 @@
+// What a single check says where it was asked (a Tools row, a Source chip) when
+// its answer is not plain evidence: why a request failed, that the model did not
+// use the tool, or that the replay after a verified call did not verify.
+import { useTranslation } from 'react-i18next';
+import { AlertCircle } from 'lucide-react';
+
+import { probeUnanswered } from './hostedTools';
+import { serverText } from './serverCopy';
+import type { HostedToolProbeResult } from './types';
+
+/**
+ * What a probe that became no evidence says where it was asked (a Tools row, a
+ * Source chip): a request that failed says why, and one that completed without
+ * the tool says that. Nothing for an answer that is evidence.
+ */
+export const ProbeAnswerNote: React.FC<{ result: HostedToolProbeResult | null }> = ({ result }) => {
+ const { t } = useTranslation();
+ if (!probeUnanswered(result)) return result ? <ReplayNote replay={result.replay} /> : null;
+ const failure = serverText(t, result?.call.error);
+ return (
+ <span className="model-hub-tool-cost-note flex items-center gap-1 model-hub-ink-gold" role="status">
+ <AlertCircle className="size-3 shrink-0" aria-hidden />
+ {failure
+ ? t('settings.models.tools.probe.outcome.transientReason', { reason: failure })
+ : result?.call.outcome === 'inconclusive'
+ ? t('settings.models.tools.probe.outcome.inconclusive')
+ : t('settings.models.tools.probe.outcome.transient')}
+ </span>
+ );
+};
+
+/**
+ * The replay step a verified call is followed by, when it ran and did not verify.
+ * Null (no replay ran) and a verified replay say nothing; a replay that got no
+ * answer asks for another try, never reads as a failure.
+ */
+const ReplayNote: React.FC<{ replay: HostedToolProbeResult['replay'] }> = ({ replay }) => {
+ const { t } = useTranslation();
+ if (!replay || replay.outcome === 'verified') return null;
+ return (
+ <span className="model-hub-tool-cost-note flex items-center gap-1 model-hub-ink-gold" role="status">
+ <AlertCircle className="size-3 shrink-0" aria-hidden />
+ {t(replay.outcome === 'unsupported' ? 'settings.models.tools.probe.replay.unsupported' : 'settings.models.tools.probe.replay.unverified')}
+ </span>
+ );
+};
diff --git a/ui/src/components/settings/models/ToolsTab.test.tsx b/ui/src/components/settings/models/ToolsTab.test.tsx
index 6297ad271..f5a7d5641 100644
--- a/ui/src/components/settings/models/ToolsTab.test.tsx
+++ b/ui/src/components/settings/models/ToolsTab.test.tsx
@@ -370,38 +370,13 @@ describe('ToolsTab checks', () => {
.getByRole('button', { name: 'Check · cost unknown' });
});
- it('MH-HOSTED-UI-013: runs the header check only after the dialog shows what it sends and costs', async () => {
- const onProbe = vi.fn<RunProbe>(async (target) => target.tool === 'web_search' && target.candidate.source_id === RELAY.id
- ? result('verified', target.candidate.source_id, target.candidate.model_id)
- : { ...result('transient', target.candidate.source_id, target.candidate.model_id), call: { outcome: 'transient', error: 'models.source.cooldown.rate_limited' } });
- renderTab(searchable(), { onProbe });
-
- // Three unchecked pairs (the verified one is not offered): the priced one is summed,
- // the included and the unpriced image are counted, and nothing is added as $0.
- screen.getByText('3 pairs to check · about $0.02 + 1 included + 1 without a price in total');
- await userEvent.click(screen.getByRole('button', { name: 'Check available tools' }));
- const dialog = await screen.findByRole('dialog');
- within(dialog).getByText('This sends 3 real requests to the Sources below to confirm they can run these tools natively.');
- expect(onProbe).not.toHaveBeenCalled();
-
- await userEvent.click(within(dialog).getByRole('button', { name: 'Start check · about $0.02 + 1 included + 1 without a price' }));
- await within(dialog).findByText('Check finished');
- expect(onProbe).toHaveBeenCalledTimes(3);
- within(dialog).getByText('1 runs natively');
- within(dialog).getByText('2 not verified');
- // The reason sits where the locale puts it in the sentence.
- expect(within(dialog).getAllByText('Couldn\'t verify this time (Rate limited). Try again; this is not recorded as unsupported.')).toHaveLength(2);
-
- // Retrying runs only the pairs that got no answer, with their cost said the same way.
- await userEvent.click(within(dialog).getByRole('button', { name: 'Retry 2 · included in subscription + 1 without a price' }));
- await within(dialog).findByText('Check finished');
- expect(onProbe).toHaveBeenCalledTimes(5);
- expect(onProbe.mock.calls.slice(3).map(([target]) => target.candidate.source_id).sort()).toEqual([RELAY.id, SUBSCRIPTION.id].sort());
- });
-
- it('MH-HOSTED-UI-003: lets the locale compose a set\'s cost with its unpriced checks', () => {
- renderTab(searchable(), { lng: 'zh' });
- screen.getByText('3 项可检测 · 共约 $0.02,另 1 项订阅内含,另 1 项暂无单价');
+ it('MH-HOSTED-UI-013: offers a check one pair at a time, never all pairs at once', () => {
+ // A check is a real, paid request: with real Sources a check-all would probe hundreds of models.
+ renderTab(searchable());
+ expect(screen.queryByRole('button', { name: /Check available tools|检测可用工具/ })).toBeNull();
+ expect(screen.queryByText(/pairs? to check|项可检测/)).toBeNull();
+ // Each row still has its own check.
+ expect(within(card('Web search')).getAllByRole('button', { name: /^Check/ })).toHaveLength(3);
});
it('MH-HOSTED-UI-019: shows a replay that did not verify as its own result, and nothing when no replay ran', async () => {
diff --git a/ui/src/components/settings/models/ToolsTab.tsx b/ui/src/components/settings/models/ToolsTab.tsx
index af7e9496e..0d70377c5 100644
--- a/ui/src/components/settings/models/ToolsTab.tsx
+++ b/ui/src/components/settings/models/ToolsTab.tsx
@@ -15,12 +15,10 @@ import { Select } from '@/components/ui/select';
import { cn } from '@/lib/utils';
import { ToggleSwitch } from '../SettingsPrimitives';
import { formatMonthDay, formatNameList, formatSmallUsd } from './format';
-import { HostedProbeDialog, ProbeAnswerNote } from './HostedProbeDialog';
+import { ProbeAnswerNote } from './ProbeAnswerNote';
import {
evidenceChip,
- pendingChecks,
probeKey,
- probeCostSummary,
probeUnanswered,
sameExecutor,
verifiedCandidates,
@@ -39,7 +37,7 @@ import type {
HostedToolStatus,
Source,
} from './types';
-import { useCostSummaryLabel, useEstimateLabel } from './useEstimateLabel';
+import { useEstimateLabel } from './useEstimateLabel';
type RunProbe = (target: ProbeTarget) => Promise<HostedToolProbeResult | null>;
@@ -328,11 +326,9 @@ export const ToolsTab: React.FC<{
onRetry: () => void;
}> = ({ read, sources, pending, probing, onChange, onProbe, onRetry }) => {
const { t } = useTranslation();
- const costSummaryLabel = useCostSummaryLabel();
// A row's last answer that did not become evidence (inconclusive, transient, a
// failed request) shows where it was asked, until that row is checked again.
const [lastProbes, setLastProbes] = React.useState<ReadonlyMap<string, HostedToolProbeResult | null>>(() => new Map());
- const [checking, setChecking] = React.useState<readonly ProbeTarget[] | null>(null);
const runProbe = React.useCallback<RunProbe>(async (target) => {
const result = await onProbe(target);
setLastProbes((previous) => new Map(previous).set(probeKey(target), result));
@@ -347,15 +343,6 @@ export const ToolsTab: React.FC<{
const byId = React.useMemo(() => new Map(sources.map((source) => [source.id, source])), [sources]);
const hubSources = React.useMemo(() => sources.filter((source) => source.supply_channel === 'hub'), [sources]);
const reverify = status?.reverify;
- const toCheck = status ? pendingChecks(status) : [];
- // 「全部已检测」 holds only where there is something a check could run on.
- const checkable = status?.tools.some((tool) => tool.candidates.length > 0) ?? false;
- const toCheckSummary = probeCostSummary(toCheck);
- const toCheckCost = toCheckSummary.priced === 0 && toCheckSummary.included === 0
- ? t('settings.models.tools.header.totalUnknown')
- : toCheckSummary.priced === 0 && toCheckSummary.unpriced === 0
- ? t('settings.models.tools.header.totalIncluded')
- : t('settings.models.tools.header.total', { cost: costSummaryLabel(toCheckSummary) });
return (
<section className="model-hub-tools flex flex-col" aria-label={t('settings.models.tools.title') as string}>
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between">
@@ -364,23 +351,6 @@ export const ToolsTab: React.FC<{
<p className="model-hub-tools-subtitle">{t('settings.models.tools.subtitle')}</p>
</div>
<div className="flex shrink-0 flex-col items-start gap-1.5 sm:items-end">
- <span className="flex flex-wrap items-center gap-x-3 gap-y-1.5">
- {checkable && (
- <span className="model-hub-tools-reverify">
- {toCheck.length > 0
- ? t('settings.models.tools.header.summary', { pending: t('settings.models.tools.header.pending', { count: toCheck.length }), cost: toCheckCost })
- : t('settings.models.tools.header.none')}
- </span>
- )}
- <Button
- size="sm"
- variant={toCheck.length > 0 ? 'default' : 'outline'}
- disabled={!status || toCheck.length === 0 || probing.size > 0}
- onClick={() => setChecking(toCheck)}
- >
- <Radar aria-hidden />{t('settings.models.tools.header.action')}
- </Button>
- </span>
{reverify && (reverify.engine_upgraded > 0 || reverify.aged > 0) && (
<p className="model-hub-tools-reverify flex flex-wrap items-center gap-x-2" role="status">
{/* Both counts read as one sentence the locale composes. */}
@@ -422,7 +392,6 @@ export const ToolsTab: React.FC<{
))}
<p className="model-hub-tools-foot">{t('settings.models.tools.footnote')}</p>
</>}
- {checking && <HostedProbeDialog targets={checking} sources={byId} onRun={runProbe} onClose={() => setChecking(null)} />}
</section>
);
};
diff --git a/ui/src/components/settings/models/hostedTools.test.ts b/ui/src/components/settings/models/hostedTools.test.ts
index 4e9cbc585..1d195edb0 100644
--- a/ui/src/components/settings/models/hostedTools.test.ts
+++ b/ui/src/components/settings/models/hostedTools.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { evidenceChip, modelCapabilities, pendingChecks, probeCostSummary, type ProbeTarget } from './hostedTools';
+import { evidenceChip, modelCapabilities } from './hostedTools';
import type { HostedEvidence, HostedToolCandidate } from './types';
const evidence = (overrides: Partial<HostedEvidence>): HostedEvidence => ({
@@ -45,38 +45,6 @@ describe('hosted-tool evidence projection', () => {
for (const [name, call, chip] of cases) expect(evidenceChip(call), name).toEqual(chip);
});
- it('MH-HOSTED-UI-003: totals a check only from what the server estimates, and never counts unknown as zero', () => {
- const at = (estimate: HostedToolCandidate['probe_estimate']): ProbeTarget => ({
- tool: 'web_search',
- candidate: { ...candidate('src_relay001', 'gpt-6-astra', evidence({})), probe_estimate: estimate },
- });
-
- expect(probeCostSummary([at({ basis: 'list', usd: 0.02 }), at({ basis: 'included' }), at({ basis: 'list', usd: 0.03 })]))
- .toEqual({ usd: 0.05, priced: 2, included: 1, unpriced: 0 });
- // An unknown estimate is counted, never added as zero.
- expect(probeCostSummary([at({ basis: 'list', usd: 0.02 }), at(null)])).toEqual({ usd: 0.02, priced: 1, included: 0, unpriced: 1 });
- expect(probeCostSummary([at({ basis: 'included' })])).toEqual({ usd: 0, priced: 0, included: 1, unpriced: 0 });
- });
-
- it('MH-HOSTED-UI-013: offers to check every pair with no current answer, images included', () => {
- const verified = evidence({ status: 'verified', basis: 'probe', observed_at: AT });
- const status = {
- tools: [
- { name: 'web_search' as const, enabled: false, executor: null, bound: null, candidates: [
- candidate('src_relay001', 'gpt-6-astra', evidence({})),
- candidate('src_relay001', 'gpt-6-sol', verified),
- candidate('src_relay001', 'gpt-6-luna', evidence({ status: 'unknown', stale: 'wire', basis: 'probe', observed_at: AT })),
- candidate('src_relay001', 'gpt-6-terra', evidence({ status: 'verified', stale: 'age', basis: 'probe', observed_at: AT })),
- ] },
- { name: 'image_generation' as const, enabled: false, executor: null, bound: null, candidates: [candidate('src_relay001', 'gpt-6.1-sol', evidence({}))] },
- ],
- reverify: { engine_upgraded: 1, aged: 1 },
- };
-
- expect(pendingChecks(status).map(({ tool, candidate: c }) => `${tool}:${c.model_id}`))
- .toEqual(['web_search:gpt-6-astra', 'web_search:gpt-6-luna', 'web_search:gpt-6-terra', 'image_generation:gpt-6.1-sol']);
- });
-
it('MH-HOSTED-UI-006: gives a Source model one capability per tool with evidence, in catalog order', () => {
const verified = evidence({ status: 'verified', basis: 'probe', observed_at: AT });
const refused = evidence({ status: 'unsupported', basis: 'observed', observed_at: AT, detail: '400 · unsupported_tool_type' });
diff --git a/ui/src/components/settings/models/hostedTools.ts b/ui/src/components/settings/models/hostedTools.ts
index e1d3856f4..cb9e0e266 100644
--- a/ui/src/components/settings/models/hostedTools.ts
+++ b/ui/src/components/settings/models/hostedTools.ts
@@ -73,30 +73,6 @@ export type ProbeTarget = { tool: HostedToolName; candidate: HostedToolCandidate
export const probeKey = ({ tool, candidate }: ProbeTarget): string => `${tool}:${candidate.source_id}:${candidate.model_id}`;
-/**
- * What the header check offers to run: every pair with no current answer, i.e.
- * no record, or one an engine upgrade or age made stale.
- */
-export const pendingChecks = (status: HostedToolsStatus): ProbeTarget[] =>
- status.tools.flatMap((tool) => tool.candidates
- .filter((candidate) => candidate.call.status === 'unknown' || candidate.call.stale !== null)
- .map((candidate) => ({ tool: tool.name, candidate })));
-
/** Whether a probe's answer became no evidence: inconclusive, transient, or a request that failed (null). */
export const probeUnanswered = (result: HostedToolProbeResult | null): boolean =>
result === null || result.call.outcome === 'inconclusive' || result.call.outcome === 'transient';
-
-/**
- * What running these probes costs, as the server estimates each one: the sum of
- * the priced ones, and how many are included in a subscription or have no price
- * (an image, say). Unknown is never added as zero; it is counted.
- */
-export type ProbeCostSummary = { usd: number; priced: number; included: number; unpriced: number };
-
-export const probeCostSummary = (targets: readonly ProbeTarget[]): ProbeCostSummary =>
- targets.reduce<ProbeCostSummary>((summary, { candidate }) => {
- const estimate = candidate.probe_estimate;
- if (!estimate) return { ...summary, unpriced: summary.unpriced + 1 };
- if (estimate.basis === 'included') return { ...summary, included: summary.included + 1 };
- return { ...summary, usd: summary.usd + estimate.usd, priced: summary.priced + 1 };
- }, { usd: 0, priced: 0, included: 0, unpriced: 0 });
diff --git a/ui/src/components/settings/models/modelHubSurface.css b/ui/src/components/settings/models/modelHubSurface.css
index 1dd9e6660..c047b5cb6 100644
--- a/ui/src/components/settings/models/modelHubSurface.css
+++ b/ui/src/components/settings/models/modelHubSurface.css
@@ -2157,26 +2157,6 @@
font-size: var(--model-hub-usage-note-size);
line-height: 16px;
}
-/* Check dialogs (frame vQPXo). */
-.model-hub-probe-head { padding: 16px 20px 12px; font-size: var(--model-hub-usage-cell-size); }
-.model-hub-probe-body { padding: 14px 20px; font-size: var(--model-hub-usage-cell-size); line-height: 18px; }
-.model-hub-probe-foot { padding: 12px 20px; }
-.model-hub-probe-row { padding: 9px 12px; font-size: var(--model-hub-usage-cell-size); }
-.model-hub-probe-privacy {
- padding: 9px 12px;
- background: var(--model-hub-mint-14);
- color: var(--foreground);
-}
-.model-hub-probe-label {
- color: var(--model-hub-ink-73);
- font-size: var(--model-hub-usage-label-size);
-}
-.model-hub-probe-total { padding: 6px 12px 0; }
-.model-hub-probe-reason {
- padding: 0 12px;
- color: var(--model-hub-usage-note-ink);
- font-size: var(--model-hub-usage-note-size);
-}
.model-hub-tool-executor {
padding: 12px var(--model-hub-tool-pad-x);
font-size: var(--model-hub-usage-cell-size);
diff --git a/ui/src/components/settings/models/useEstimateLabel.ts b/ui/src/components/settings/models/useEstimateLabel.ts
index f8031d552..66146a9bf 100644
--- a/ui/src/components/settings/models/useEstimateLabel.ts
+++ b/ui/src/components/settings/models/useEstimateLabel.ts
@@ -1,7 +1,6 @@
import { useTranslation } from 'react-i18next';
-import { formatSentences, formatSmallUsd } from './format';
-import type { ProbeCostSummary } from './hostedTools';
+import { formatSmallUsd } from './format';
import type { HostedCostEstimate } from './types';
/** 「约 $0.02」, 「订阅内含」, or nothing when the estimate is unknown. */
@@ -14,25 +13,3 @@ export const useEstimateLabel = () => {
: t('settings.models.tools.probe.about', { usd: formatSmallUsd(estimate.usd) }) as string;
};
};
-
-/**
- * A set of probes' cost in one phrase: the priced sum, then how many are included
- * or have no price, e.g. 「约 $0.04,另 2 项暂无单价」. Only included reads as
- * included; nothing priced at all reads as unknown. The locale composes it.
- */
-export const useCostSummaryLabel = () => {
- const { t, i18n } = useTranslation();
- const estimateLabel = useEstimateLabel();
- return ({ usd, priced, included, unpriced }: ProbeCostSummary): string => {
- if (priced === 0 && included === 0) return t('settings.models.tools.probe.unknown') as string;
- const base = priced > 0
- ? estimateLabel({ basis: 'list', usd }) as string
- : t('settings.models.tools.probe.included') as string;
- const extras = [
- ...(priced > 0 && included > 0 ? [t('settings.models.tools.probe.plusIncluded', { count: included }) as string] : []),
- ...(unpriced > 0 ? [t('settings.models.tools.probe.plusUnpriced', { count: unpriced }) as string] : []),
- ];
- return extras.length === 0 ? base : formatSentences([base, ...extras], i18n.language);
- };
-};
-
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 02d650a03..28d214310 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -2450,10 +2450,6 @@
"included": "included in subscription",
"unknown": "cost unknown",
"notRecorded": "the result couldn't be recorded",
- "plusIncluded_one": "+ {{count}} included",
- "plusIncluded_other": "+ {{count}} included",
- "plusUnpriced_one": "+ {{count}} without a price",
- "plusUnpriced_other": "+ {{count}} without a price",
"replay": {
"unverified": "Replay not verified · try again",
"unsupported": "Replay not supported on this Source"
@@ -2463,57 +2459,6 @@
"transient": "Couldn't verify · try again",
"transientReason": "Couldn't verify · {{reason}}"
}
- },
- "header": {
- "pending_one": "{{count}} pair to check",
- "pending_other": "{{count}} pairs to check",
- "total": "{{cost}} in total",
- "totalIncluded": "included in subscriptions",
- "totalUnknown": "cost unknown",
- "summary": "{{pending}} · {{cost}}",
- "none": "Everything is checked",
- "action": "Check available tools"
- },
- "dialog": {
- "title": "Check available tools",
- "subtitle": "Hosted tools · Vibey",
- "body_one": "This sends {{count}} real request to the Source below to confirm it can run the tool natively.",
- "body_other": "This sends {{count}} real requests to the Sources below to confirm they can run these tools natively.",
- "privacy": "Each request carries one fixed test query and none of your conversation. Checking turns no tool on and changes no route.",
- "listTitle": "To check",
- "pair": "<tool>{{tool}}</tool><muted>·</muted><source>{{source}}</source><model>{{model}}</model>",
- "total": "Total",
- "totalNote": "Estimated at API price; a relay may bill differently",
- "cancel": "Cancel",
- "start": "Start check",
- "startCost": "Start check · {{cost}}",
- "running_one": "Checking {{done}} of {{count}}…",
- "running_other": "Checking {{done}} of {{count}}…"
- },
- "result": {
- "title": "Check finished",
- "verified_one": "{{count}} runs natively",
- "verified_other": "{{count}} run natively",
- "unsupported_one": "{{count}} not supported",
- "unsupported_other": "{{count}} not supported",
- "unverified_one": "{{count}} not verified",
- "unverified_other": "{{count}} not verified",
- "outcome": {
- "verified": "Runs natively",
- "unsupported": "Not supported",
- "unverified": "Not verified"
- },
- "reason": {
- "inconclusive": "The model didn't use the tool. Try again; this is not recorded as unsupported.",
- "transient": "Couldn't verify this time. Try again; this is not recorded as unsupported.",
- "transientReason": "Couldn't verify this time ({{reason}}). Try again; this is not recorded as unsupported."
- },
- "note": "Verified models call the tool natively; other models use the proxy executor. Tools stay off until you turn them on.",
- "retry_one": "Retry {{count}}",
- "retry_other": "Retry {{count}}",
- "retryCost_one": "Retry {{count}} · {{cost}}",
- "retryCost_other": "Retry {{count}} · {{cost}}",
- "done": "Done"
}
},
"capability": {
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 2e35852c4..b932a1707 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -2450,10 +2450,6 @@
"included": "订阅内含",
"unknown": "费用未知",
"notRecorded": "结果未能记录",
- "plusIncluded_one": ",另 {{count}} 项订阅内含",
- "plusIncluded_other": ",另 {{count}} 项订阅内含",
- "plusUnpriced_one": ",另 {{count}} 项暂无单价",
- "plusUnpriced_other": ",另 {{count}} 项暂无单价",
"replay": {
"unverified": "回放未验证 · 请重试",
"unsupported": "此供应商不支持回放"
@@ -2463,57 +2459,6 @@
"transient": "未能检测 · 请重试",
"transientReason": "未能检测 · {{reason}}"
}
- },
- "header": {
- "pending_one": "{{count}} 项可检测",
- "pending_other": "{{count}} 项可检测",
- "total": "共{{cost}}",
- "totalIncluded": "均为订阅内含",
- "totalUnknown": "费用未知",
- "summary": "{{pending}} · {{cost}}",
- "none": "均已检测",
- "action": "检测可用工具"
- },
- "dialog": {
- "title": "检测可用工具",
- "subtitle": "托管工具 · Vibey",
- "body_one": "检测会向下面的供应商发送 {{count}} 次真实请求,确认它们能否原生运行这些工具。",
- "body_other": "检测会向下面的供应商发送 {{count}} 次真实请求,确认它们能否原生运行这些工具。",
- "privacy": "请求只带一条固定的测试查询,不含你的对话。检测不会开启任何工具,也不会改动路由。",
- "listTitle": "将检测",
- "pair": "<tool>{{tool}}</tool><muted>·</muted><source>{{source}}</source><model>{{model}}</model>",
- "total": "合计",
- "totalNote": "按 API 标价估算;中转的实际账单可能不同",
- "cancel": "取消",
- "start": "开始检测",
- "startCost": "开始检测 · {{cost}}",
- "running_one": "正在检测 {{done}}/{{count}}…",
- "running_other": "正在检测 {{done}}/{{count}}…"
- },
- "result": {
- "title": "检测完成",
- "verified_one": "{{count}} 项原生可用",
- "verified_other": "{{count}} 项原生可用",
- "unsupported_one": "{{count}} 项不支持",
- "unsupported_other": "{{count}} 项不支持",
- "unverified_one": "{{count}} 项未能检测",
- "unverified_other": "{{count}} 项未能检测",
- "outcome": {
- "verified": "原生可用",
- "unsupported": "不支持",
- "unverified": "未能检测"
- },
- "reason": {
- "inconclusive": "模型没有调用工具。可重试,不会记为“不支持”。",
- "transient": "这次未能检测。可重试,不会记为“不支持”。",
- "transientReason": "这次未能检测({{reason}})。可重试,不会记为“不支持”。"
- },
- "note": "已验证的模型会直接原生调用;其他模型由代理执行者代为调用。工具开关在“工具”页,默认仍是关闭。",
- "retry_one": "重试 {{count}} 项",
- "retry_other": "重试 {{count}} 项",
- "retryCost_one": "重试 {{count}} 项 · {{cost}}",
- "retryCost_other": "重试 {{count}} 项 · {{cost}}",
- "done": "完成"
}
},
"capability": {