From 4a9f643b079d69c43c44a3baddbf637965a42e30 Mon Sep 17 00:00:00 2001 From: Zhangbo-cn <60600082+Zhangbo-cn@users.noreply.github.com> Date: Sun, 29 Nov 2026 13:07:34 +0800 Subject: [PATCH 1/8] feat(models): keep service capability detail folded in the service form Selecting many models in the add-service form expanded every capability card, so a single screen held one or two models while the user only wanted to know whether the service answers. Fold the availability and capability detail behind a per-row summary, keep the test result on the row, and drop the duplicated fetch status line and the selection filter from this dense form. Refs #574 --- src/canvas/ModelPicker.tsx | 41 +++++++++++++++------- src/canvas/ModelServiceForm.tsx | 48 +++++++++++++++----------- src/canvas/model-settings.css | 15 ++++++++ src/i18n/messages/en-US/models.ts | 1 + src/i18n/messages/zh-CN/models.ts | 1 + tests/browser/capability_discovery.mjs | 9 +++++ tests/browser/higgsfield_open.mjs | 1 + tests/browser/kling_video.mjs | 7 ++++ tests/browser/provider_settings.mjs | 19 ++++++++-- 9 files changed, 107 insertions(+), 35 deletions(-) diff --git a/src/canvas/ModelPicker.tsx b/src/canvas/ModelPicker.tsx index eb5ded86e..75ff3a533 100644 --- a/src/canvas/ModelPicker.tsx +++ b/src/canvas/ModelPicker.tsx @@ -23,6 +23,7 @@ export function ModelPicker({ onTest, results, renderDetails, + compact = false, }: { modelPlaceholder: string; available: string[]; @@ -38,6 +39,9 @@ export function ModelPicker({ onTest?: (id: string) => void; results: Record; renderDetails?: (id: string) => ReactNode; + /** Denser form layout: the count row carries the fetch result and the + selection filter stays out of the way. */ + compact?: boolean; }) { const t = useT(); const manualFieldId = useId(); @@ -55,6 +59,11 @@ export function ModelPicker({ ); const allSelected = visible.length > 0 && visible.every((id) => selected.includes(id)); + // The count row only exists for longer lists; without it the status line is + // the only fetch feedback and must stay. + const denseCount = compact && ids.length > 4; + const redundantStatus = + denseCount && loaded && !loading && !error && available.length > 0; const fetchLabel = loadsPreset ? "models.service.loadSupportedModels" : loaded ? "generation.picker.refresh" : "generation.picker.fetch"; @@ -119,9 +128,13 @@ export function ModelPicker({ -
- {status &&

{status}

} -
+ {/* The dense form shows the fetch result in the count row, so only a + pending, empty or failed fetch keeps its own status line. */} + {(!compact || !redundantStatus) && ( +
+ {status &&

{status}

} +
+ )} {error && (

{error} @@ -186,18 +199,22 @@ export function ModelPicker({ onChange={(event) => setQuery(event.target.value)} /> - + {!compact && ( + + )}

- {t("generation.picker.count", { count: visible.length })} + {denseCount && loaded && !loading && !error && available.length + ? t("generation.picker.fetched", { count: visible.length }) + : t("generation.picker.count", { count: visible.length })} + )} + + {children} + + ); +} diff --git a/src/canvas/ModelServiceForm.tsx b/src/canvas/ModelServiceForm.tsx index 724448c9c..b23f54832 100644 --- a/src/canvas/ModelServiceForm.tsx +++ b/src/canvas/ModelServiceForm.tsx @@ -1,4 +1,3 @@ -import { DraftAvailabilityCheck } from "./DraftAvailabilityCheck"; import { ProviderPicker } from "./ProviderPicker"; import { useId, useLayoutEffect, useState, type FormEvent, type Ref } from "react"; import { errorMessage } from "../backend/api.ts"; @@ -16,6 +15,7 @@ import { type ModelKind, } from "../backend/rules.ts"; import { ModelCapabilityCard } from "./ModelCapabilityCard"; +import { ModelRowDetails } from "./ModelRowDetails"; import { PROVIDER_PRESETS, matchingConnections, @@ -552,13 +552,11 @@ export function ModelServiceForm({ results={results} compact renderDetails={(id) => ( -
- {t("models.service.capabilityDetails")} - + ({ ...current, [id]: message })) } /> -
+ )} /> {segmentation && ( diff --git a/src/canvas/model-settings.css b/src/canvas/model-settings.css index 511e39b41..23acfb825 100644 --- a/src/canvas/model-settings.css +++ b/src/canvas/model-settings.css @@ -673,9 +673,56 @@ .cw-model-availability { padding: 12px 0; font-size: var(--settings-label-size, 13px); } .cw-model-option > .cw-model-availability { flex-basis: 100%; width: 100%; min-width: 0; border-top: 1px solid var(--settings-border); } .cw-model-availability-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; } +.cw-model-availability-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; } +.cw-availability-chips { display: flex; flex-wrap: wrap; gap: 6px; } +.cw-availability-chip { + display: inline-flex; + align-items: center; + gap: 7px; + padding: 3px 10px; + border: 1px solid var(--settings-border); + border-radius: 999px; + background: var(--settings-input); + color: var(--settings-text); + font-size: var(--settings-caption-size); + line-height: 1.5; + white-space: nowrap; +} +.cw-availability-chip .cw-availability-op { color: inherit; } +.cw-availability-chip[data-availability="available"] { + border-color: color-mix(in srgb, var(--settings-positive) 45%, transparent); + background: var(--settings-positive-background); + color: var(--settings-positive); +} +.cw-availability-chip[data-availability="unavailable"] { + border-color: color-mix(in srgb, var(--settings-negative) 45%, transparent); + background: var(--settings-negative-background); + color: var(--settings-negative); +} +.cw-availability-chip[data-availability="unknown"] { color: var(--settings-text); } .cw-model-availability p, .cw-model-availability small { color: var(--settings-muted); } .cw-model-availability ul { display: grid; gap: 8px; margin: 10px 0; padding: 0; list-style: none; } .cw-model-availability li { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(0, 3fr); gap: 12px; overflow-wrap: anywhere; } +.cw-availability-state { + display: inline-flex; + align-items: center; + gap: 5px; + color: var(--settings-muted); +} +.cw-availability-state::before { + content: ""; + width: 5px; + height: 5px; + flex: none; + border-radius: 50%; + background: currentColor; +} +.cw-availability-state[data-availability="available"] { color: var(--settings-positive); } +.cw-availability-state[data-availability="unavailable"] { + color: var(--settings-negative); + font-weight: 500; +} +.cw-availability-state[data-availability="unknown"] { color: var(--settings-muted); } .cw-model-availability-details { padding: 12px 16px; border-top: 1px solid var(--settings-border); } .cw-model-availability-details summary { cursor: pointer; } .cw-model-availability [data-availability="unavailable"] { color: var(--cw-danger, #b45336); } @@ -688,17 +735,6 @@ .cw-model-input-details small { display: block; } .cw-model-input-details summary small { display: inline; margin-inline-start: 8px; } -/* A selected model row shows its test result; capability detail stays folded. */ -.cw-model-row-details { - grid-column: 1 / -1; - margin: 2px 0 0 24px; -} -.cw-model-row-details > summary { - cursor: pointer; - width: fit-content; - padding: 2px 0; - color: var(--settings-muted); - font-size: var(--settings-caption-size); -} -.cw-model-row-details > summary:hover { color: var(--settings-text); } -.cw-model-row-details[open] > summary { margin-bottom: 6px; } +/* The check action rides on the model line; the capability card follows it on + its own line, so a row costs one line until the service answers. */ +.cw-model-row-test { margin-inline-start: auto; } diff --git a/src/canvas/themes.css b/src/canvas/themes.css index 6aaf75228..c8c581d70 100644 --- a/src/canvas/themes.css +++ b/src/canvas/themes.css @@ -10,6 +10,10 @@ --settings-input: #19191b; --settings-warning: #f3b7a6; --settings-warning-background: #45332c; + --settings-positive: #8ed3a8; + --settings-positive-background: #24382e; + --settings-negative: #f0a3a3; + --settings-negative-background: #43282a; } :root[data-theme="light"] { color-scheme: light; @@ -25,6 +29,10 @@ --settings-input: #fafbfc; --settings-warning: #9a4d36; --settings-warning-background: #fff1e9; + --settings-positive: #2f7a4f; + --settings-positive-background: #eaf6ee; + --settings-negative: #a63c3c; + --settings-negative-background: #fdeeee; } :root[data-theme="light"] .cw-workspace { background: #f7f8fa; diff --git a/src/i18n/messages/en-US/availability.ts b/src/i18n/messages/en-US/availability.ts index d54d31528..01efc4f8a 100644 --- a/src/i18n/messages/en-US/availability.ts +++ b/src/i18n/messages/en-US/availability.ts @@ -50,6 +50,9 @@ export const availability = { "availability.checkedAt": "Last checked: {time}", "availability.status.available": "Supported", "availability.status.unknown": "Unknown", + "availability.rowTest": "Test", + "availability.rowTested": "Tested", + "availability.rowExpired": "Expired", "availability.reason.not_checked": "Not checked", "availability.reason.supported": "Supported", "availability.reason.operation_unsupported": "Not supported", diff --git a/src/i18n/messages/zh-CN/availability.ts b/src/i18n/messages/zh-CN/availability.ts index 0f453af53..6b9bca899 100644 --- a/src/i18n/messages/zh-CN/availability.ts +++ b/src/i18n/messages/zh-CN/availability.ts @@ -50,6 +50,9 @@ export const availability = { "availability.checkedAt": "最近检查:{time}", "availability.status.available": "支持", "availability.status.unknown": "待确认", + "availability.rowTest": "测试", + "availability.rowTested": "已测试", + "availability.rowExpired": "已过期", "availability.reason.not_checked": "尚未检查", "availability.reason.supported": "支持", "availability.reason.operation_unsupported": "不支持", diff --git a/tests/browser/capability_discovery.mjs b/tests/browser/capability_discovery.mjs index e4881b76b..67a78b830 100644 --- a/tests/browser/capability_discovery.mjs +++ b/tests/browser/capability_discovery.mjs @@ -260,15 +260,14 @@ try { .locator(".cw-model-manual") .getByRole("button", { name: "Add", exact: true }) .click(); - // The selected row keeps its capability detail folded by default. - const rowDetails = page.locator(".cw-model-row-details").first(); - await rowDetails.waitFor(); + // The check action rides on the model line; the capability card follows it. + const test = page.locator(".cw-model-row-test").first(); + await test.waitFor(); assert.equal( - await rowDetails.evaluate((element) => element.hasAttribute("open")), - false, - "selecting a model must not expand its capability detail", + (await test.textContent())?.trim(), + "Test", + "a model that was never checked offers the check action", ); - await rowDetails.locator("summary").first().click(); const draft = page.locator(".cw-model-editor .cw-model-availability"); async function presentInBothLanguages(state, expected) { for (const locale of ["en-US", "zh-CN"]) { @@ -456,8 +455,16 @@ try { "Single-image editing", "Multi-image editing", ]) - assert.equal(await draft.getByText(label, { exact: true }).count(), 1); - assert.equal(await draft.locator("[data-availability=available]").count(), 3); + assert.equal( + await draft.getByText(label, { exact: true }).count(), + 1, + `${label} appears once, with its state beside it`, + ); + assert.equal( + await draft.locator(".cw-availability-chip[data-availability=available]").count(), + 3, + "every supported capability is marked on its chip", + ); await draft.getByText("Input requirements", { exact: true }).click(); await presentInBothLanguages("normal", null); assert.equal( @@ -483,7 +490,7 @@ try { }), ); }); - await draft.getByText("多图编辑", { exact: true }).waitFor(); + await draft.locator(".cw-availability-op", { hasText: "多图编辑" }).waitFor(); assert.equal(await draft.getByText("选区输入", { exact: true }).count(), 1); assert.equal(await draft.getByText("1–3 张", { exact: true }).count(), 1); assert.equal(await draft.getByText("服务声明", { exact: true }).count(), 1); @@ -500,7 +507,7 @@ try { }), ); }); - await draft.getByText("Multi-image editing", { exact: true }).waitFor(); + await draft.locator(".cw-availability-op", { hasText: "Multi-image editing" }).waitFor(); await checkDraft("partial"); assert.equal(await draft.getByRole("status").count(), 0); assert.equal( @@ -514,7 +521,10 @@ try { await draft.getByText("Service paused", { exact: true }).count(), 0, ); - assert.equal(await draft.locator("[data-availability=available]").count(), 3); + assert.equal( + await draft.locator(".cw-availability-chip[data-availability=available]").count(), + 3, + ); await checkDraft("partial"); await presentInBothLanguages("partial", { "en-US": "Image count not confirmed", @@ -582,7 +592,7 @@ try { 0, ); assert.equal( - await draft.locator("li [data-availability=unknown]").count(), + await draft.locator(".cw-availability-chip[data-availability=unknown]").count(), 3, ); } @@ -639,25 +649,16 @@ try { 0, ); assert.equal( - await draft.locator("[data-availability=available]").count(), + await draft.locator(".cw-availability-chip[data-availability=available]").count(), 3, "pause expiry restores the retained declaration", ); await page.clock.fastForward(25100); - await draft - .getByText("Results expired. Refresh to check again.", { exact: true }) - .waitFor(); - assert.equal( - await draft - .getByText("Results expired. Refresh to check again.", { exact: true }) - .count(), - 1, - ); - assert.equal(await draft.locator("li[data-stale]").count(), 3); - await presentInBothLanguages("expired", { - "en-US": "Results expired. Refresh to check again.", - "zh-CN": "检查结果已过期,请刷新", - }); + // An expired observation marks every capability and the row instead of + // repeating one banner line. + await draft.locator(".cw-availability-chip[data-stale]").first().waitFor(); + assert.equal(await draft.locator(".cw-availability-chip[data-stale]").count(), 3); + await presentInBothLanguages("expired", null); assert.equal(await draftUrl.inputValue(), serviceUrl); await page.clock.resume(); await page.clock.setSystemTime(new Date()); @@ -839,7 +840,10 @@ try { await page.unroute(refreshUrl); await page.waitForTimeout(100); assert.equal(await serviceCard.getByText("Not supported", { exact: true }).count(), 0); - assert.equal(await serviceCard.locator("[data-availability=available]").count(), 3); + assert.equal( + await serviceCard.locator(".cw-availability-chip[data-availability=available]").count(), + 3, + ); // A remote negative declaration already 21 days old must not block this // saved selection or the actual generation performed below. diff --git a/tests/browser/higgsfield_open.mjs b/tests/browser/higgsfield_open.mjs index 05f518f39..ee9689299 100644 --- a/tests/browser/higgsfield_open.mjs +++ b/tests/browser/higgsfield_open.mjs @@ -80,7 +80,6 @@ try { assert.equal(await page.getByLabel("API Key", { exact: true }).getAttribute("placeholder"), "KEY_ID:KEY_SECRET"); await page.getByLabel("API Key", { exact: true }).fill("fixture-id:fixture-secret"); await page.getByRole("checkbox", { name: "sand/magi-2", exact: true }).check(); - await page.locator(".cw-model-row-details summary").first().click(); await page.getByText(text.summary, { exact: true }).waitFor(); await page.getByText("1080P", { exact: true }).waitFor(); await page.screenshot({ path: join(output, `provider-${locale}.png`), fullPage: true }); diff --git a/tests/browser/kling_video.mjs b/tests/browser/kling_video.mjs index 4f1747249..fb7244f11 100644 --- a/tests/browser/kling_video.mjs +++ b/tests/browser/kling_video.mjs @@ -176,7 +176,6 @@ try { await page .getByLabel("API Key", { exact: true }) .fill("kling-browser-fixture-only"); - await page.locator(".cw-model-row-details summary").first().click(); await page.getByText(text.summary, { exact: true }).waitFor(); await page.getByText("720P / 1080P", { exact: true }).waitFor(); await page @@ -185,12 +184,13 @@ try { await page .getByRole("checkbox", { name: "kling-4.0-flash", exact: true }) .check(); - await page + const flashCard = page .locator(".cw-model-option") .filter({ hasText: "kling-4.0-flash" }) - .locator("summary") - .first() - .click(); + .locator(".cw-model-capability-card") + .first(); + if (!(await flashCard.evaluate((element) => element.open))) + await flashCard.locator("summary").click(); await page.getByText(text.flashSummary, { exact: true }).waitFor(); await page.getByText("720P", { exact: true }).waitFor(); await page diff --git a/tests/browser/provider_settings.mjs b/tests/browser/provider_settings.mjs index 148509a80..1a5929312 100644 --- a/tests/browser/provider_settings.mjs +++ b/tests/browser/provider_settings.mjs @@ -104,15 +104,9 @@ try { } finally { await page.unroute(discoveryEndpoint); } - // Capability detail stays folded until the row is expanded. - const capabilityRow = page.locator(".cw-model-row-details").first(); - await capabilityRow.waitFor(); - assert.equal( - await capabilityRow.evaluate((element) => element.hasAttribute("open")), - false, - "a selected model must not expand its capability detail by default", - ); - await capabilityRow.locator("summary").first().click(); + // The check action rides on the model line; the card is already visible. + await page.locator(".cw-model-row-test").first().waitFor(); + await page.locator(".cw-model-editor .cw-model-availability").first().waitFor(); await page .getByText("Text-to-video / first-last frame / multimodal references", { exact: true }).first() .waitFor(); @@ -144,11 +138,12 @@ try { .locator(".cw-model-option") .filter({ hasText: "image-card" }); const textCard = page.locator(".cw-model-option").filter({ hasText: "text-card" }); - // The row folds its capability detail; the card folds its own options inside. + // The row has no fold of its own; the capability card folds its options. const openDetails = async (option) => { - await option.locator("summary").first().click(); - const inner = option.locator("summary").nth(1); - if (await inner.count()) await inner.click(); + const card = option.locator(".cw-model-capability-card").first(); + if (!(await card.count())) return; + if (!(await card.evaluate((element) => element.open))) + await card.locator("summary").click(); }; await openDetails(textCard); await textCard.getByRole("checkbox", { name: "Image understanding", exact: true }).uncheck(); From 7510d13b14d6c3f4a5013c7288da8a071d76a6e6 Mon Sep 17 00:00:00 2001 From: Zhangbo-cn <60600082+Zhangbo-cn@users.noreply.github.com> Date: Mon, 30 Nov 2026 22:46:45 +0800 Subject: [PATCH 3/8] refactor(providers): drop the unused draft check wrapper and its dead label ModelRowDetails reads useDraftAvailability directly, so the wrapper component and the summary label for a details element that no longer exists had no reader. --- src/canvas/DraftAvailabilityCheck.tsx | 21 --------------------- src/i18n/messages/en-US/models.ts | 1 - src/i18n/messages/zh-CN/models.ts | 1 - 3 files changed, 23 deletions(-) diff --git a/src/canvas/DraftAvailabilityCheck.tsx b/src/canvas/DraftAvailabilityCheck.tsx index 4a5b5da1f..c96e8b614 100644 --- a/src/canvas/DraftAvailabilityCheck.tsx +++ b/src/canvas/DraftAvailabilityCheck.tsx @@ -5,7 +5,6 @@ import { } from "../backend/models.ts"; import type { ModelAvailability } from "../backend/availability.ts"; import { errorMessage } from "../backend/api.ts"; -import { ModelAvailabilityCard } from "./ModelAvailabilityCard"; /** * A draft check never publishes an observation into the saved model catalog. @@ -76,23 +75,3 @@ export function useDraftAvailability({ check: () => void check(), }; } - -export function DraftAvailabilityCheck({ - connection, - configId, - modelId, -}: { - connection: ModelConfigInput; - configId?: string; - modelId: string; -}) { - const draft = useDraftAvailability({ connection, configId, modelId }); - return ( - - ); -} diff --git a/src/i18n/messages/en-US/models.ts b/src/i18n/messages/en-US/models.ts index d9f2a4c65..70f5c5557 100644 --- a/src/i18n/messages/en-US/models.ts +++ b/src/i18n/messages/en-US/models.ts @@ -129,7 +129,6 @@ export const models = { }, "models.service.selectAtLeastOne": "Select at least one model", "models.service.saving": "Saving…", - "models.service.capabilityDetails": "Capabilities and parameters", "models.service.cancel": "Cancel", "models.service.advancedConnection": "Advanced connection settings", "models.service.existingConnections": diff --git a/src/i18n/messages/zh-CN/models.ts b/src/i18n/messages/zh-CN/models.ts index a79018459..4734a16a0 100644 --- a/src/i18n/messages/zh-CN/models.ts +++ b/src/i18n/messages/zh-CN/models.ts @@ -107,7 +107,6 @@ export const models = { "models.service.willEnable": "将启用 {count} 个模型", "models.service.selectAtLeastOne": "请选择至少一个模型", "models.service.saving": "保存中…", - "models.service.capabilityDetails": "服务能力与参数", "models.service.cancel": "取消", "models.service.advancedConnection": "高级连接设置", "models.service.existingConnections": "已有相同地址的连接", From fe1e912f4f1a6d03ba13580c3a67b815e820955f Mon Sep 17 00:00:00 2001 From: Zhangbo-cn <60600082+Zhangbo-cn@users.noreply.github.com> Date: Mon, 30 Nov 2026 23:16:47 +0800 Subject: [PATCH 4/8] ci: retrigger after a publication-lock timeout in the python lane tests/test_agent_job_lineage.py::test_one_turn_records_every_job_it_accepted_and_nothing_else failed with filelock.Timeout under load; the same test passes locally on this tip in 3.5s. From a17a9d63533bd757d78b57c2fc0eec23bd9e438a Mon Sep 17 00:00:00 2001 From: Zhangbo-cn <60600082+Zhangbo-cn@users.noreply.github.com> Date: Wed, 2 Dec 2026 00:41:11 +0800 Subject: [PATCH 5/8] fix(providers): fold the capability detail and keep one check entry per row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The row action and the card's refresh button called the same draft check, and the card stayed open under every selected model. Fold the card and the per-kind parameters behind the '服务能力与参数' summary, keep the row action as the only check entry, keep a readable sentence when an observation expires, and count the models the service returned instead of the filtered view. Refs #574 --- src/canvas/ModelAvailabilityCard.tsx | 15 +++++------ src/canvas/ModelPicker.tsx | 2 +- src/canvas/ModelRowDetails.tsx | 22 +++++++++------- src/canvas/model-settings.css | 35 ++++++++++++++++++++++++++ src/i18n/messages/en-US/models.ts | 1 + src/i18n/messages/zh-CN/models.ts | 1 + tests/browser/capability_discovery.mjs | 34 ++++++++++++++++++++++++- tests/browser/provider_settings.mjs | 4 +++ 8 files changed, 96 insertions(+), 18 deletions(-) diff --git a/src/canvas/ModelAvailabilityCard.tsx b/src/canvas/ModelAvailabilityCard.tsx index 83b85bfb8..0c9542ec6 100644 --- a/src/canvas/ModelAvailabilityCard.tsx +++ b/src/canvas/ModelAvailabilityCard.tsx @@ -20,12 +20,15 @@ export function ModelAvailabilityCard({ checking = false, title, error, + actions = true, }: { value?: ModelAvailability | null; onRefresh?: () => void; checking?: boolean; title?: string; error?: string; + /** The service form owns the single check entry on the row itself. */ + actions?: boolean; }) { const { t, locale } = useI18n(); const [tick, setTick] = useState(0); @@ -40,14 +43,12 @@ export function ModelAvailabilityCard({ }, [value, tick]); const current = value ? currentAvailability(value) : null; const notice = availabilityNotice(current); - // An expired observation shows on every chip and on the row, so a banner would - // only repeat it. A model that was never checked still needs the sentence. + // Every shared notice keeps one readable sentence. Chips alone are not enough: + // an expired observation greys them out and the row still reads "tested", so + // the reason has to stay in words. const message = checking ? null - : error || - (notice && notice !== "observation_expired" - ? availabilityReason(notice) - : null); + : error || (notice ? availabilityReason(notice) : null); const details = availabilityCardDetails(current?.operations ?? []); const commonSource = details.length > 0 && @@ -88,7 +89,7 @@ export function ModelAvailabilityCard({ ) : null}
- {onRefresh && ( + {actions && onRefresh && (