Skip to content

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io

fix(agy): show the endpoint on provider cards instead of the gateway model

Jason82fc176fa6ee
diff --git a/src/components/providers/ProviderCard.tsx b/src/components/providers/ProviderCard.tsx
index 80872a7fe..02753fc42 100644
--- a/src/components/providers/ProviderCard.tsx
+++ b/src/components/providers/ProviderCard.tsx
@@ -69,7 +69,6 @@ import {
terminalNeedsRoute,
} from "./OpenTerminalDialog";
import type { CardChip, CardPresentation, CardTone } from "./presentation";
-import { agyGatewayFromSettings, agyModelIds } from "./forms/AgyGatewayFields";
import { appHas } from "@/config/appSpecs";
const copilotPlan = (data: unknown) => (data as CopilotQuota).plan;
@@ -200,31 +199,6 @@ function extractCopilotSummary(provider: Provider): string | null {
return model || baseUrl || null;
}
-/**
- * Antigravity 卡片直接显示模型,省得进编辑才知道。Key 卡写的是网关:显示网关的默认模型
- * (多个时带 +N),没填模型 ID 时 agy 向地址取列表,返回 null 让副标题回落成地址。旧卡
- * `config.model.name` / `GEMINI_MODEL` 里的显示名网关不认,只对官方登录卡有意义。
- */
-function extractAgyModel(provider: Provider): string | null {
- const config = provider.settingsConfig as Record<string, any>;
- const apiKey = config?.env?.GEMINI_API_KEY;
- if (
- !isOfficialProvider(provider, "agy") &&
- typeof apiKey === "string" &&
- apiKey.trim()
- ) {
- const ids = agyModelIds(agyGatewayFromSettings(config));
- if (ids.length === 0) return null;
- return ids.length > 1 ? `${ids[0]} +${ids.length - 1}` : ids[0];
- }
- const model = config?.config?.model?.name;
- if (typeof model === "string" && model.trim()) return model.trim();
- const envModel = config?.env?.GEMINI_MODEL;
- return typeof envModel === "string" && envModel.trim()
- ? envModel.trim()
- : null;
-}
-
const extractApiUrl = (provider: Provider, fallbackText: string) => {
if (provider.notes?.trim()) {
return provider.notes.trim();
@@ -285,13 +259,8 @@ export function ProviderCard({
return extractApiUrl(provider, fallbackUrlText);
}, [provider, fallbackUrlText]);
- const agyModel = useMemo(
- () =>
- appId === "agy"
- ? extractAgyModel(provider)
- : appId === "copilot"
- ? extractCopilotSummary(provider)
- : null,
+ const copilotSummary = useMemo(
+ () => (appId === "copilot" ? extractCopilotSummary(provider) : null),
[appId, provider],
);
@@ -637,14 +606,13 @@ export function ProviderCard({
) : canShowAgyAccount ? (
<AgyOfficialSubtitle
boundAccountId={agyBoundAccountId}
- agyModel={agyModel}
planSuffix={planSuffix("-ms-0.5")}
fallback={oauthSubtitle}
/>
- ) : agyModel ? (
+ ) : copilotSummary ? (
<div className="mt-0.5 flex min-w-0 items-center gap-1.5 text-caption text-fg-2">
- <span className="min-w-0 truncate" title={agyModel}>
- {agyModel}
+ <span className="min-w-0 truncate" title={copilotSummary}>
+ {copilotSummary}
</span>
{planSuffix("-ms-0.5")}
</div>
diff --git a/src/components/providers/ProviderCardAccountLines.tsx b/src/components/providers/ProviderCardAccountLines.tsx
index 2d71fef05..6a43c38b9 100644
--- a/src/components/providers/ProviderCardAccountLines.tsx
+++ b/src/components/providers/ProviderCardAccountLines.tsx
@@ -19,37 +19,27 @@ function useResolvedAgyAccount(boundAccountId: string | null) {
return { account };
}
-/** Antigravity 官方卡副标题(账号邮箱 + 当前模型 + 套餐),未查到账号且无模型时回落默认副标题。 */
+/** Antigravity 官方卡副标题(账号邮箱 + 套餐),和 Claude / Codex 的绑号卡一样;未查到账号时回落默认副标题。 */
export function AgyOfficialSubtitle({
boundAccountId,
- agyModel,
planSuffix,
fallback,
}: {
boundAccountId: string | null;
- agyModel: string | null;
planSuffix: ReactNode;
fallback: ReactNode;
}) {
const { account } = useResolvedAgyAccount(boundAccountId);
- if (!account && !agyModel) {
+ if (!account) {
return fallback;
}
return (
<div className="mt-0.5 flex min-w-0 items-center gap-1.5 text-caption text-fg-2">
- {account && (
- <span className="min-w-0 truncate" title={account.login}>
- {account.login}
- </span>
- )}
- {account && agyModel && <span aria-hidden="true">·</span>}
- {agyModel && (
- <span className="min-w-0 truncate" title={agyModel}>
- {agyModel}
- </span>
- )}
+ <span className="min-w-0 truncate" title={account.login}>
+ {account.login}
+ </span>
{planSuffix}
</div>
);
diff --git a/tests/components/ProviderCard.agyModel.test.tsx b/tests/components/ProviderCard.agy.test.tsx
similarity index 92%
rename from tests/components/ProviderCard.agyModel.test.tsx
rename to tests/components/ProviderCard.agy.test.tsx
index a057c9325..01d6d3207 100644
--- a/tests/components/ProviderCard.agyModel.test.tsx
+++ b/tests/components/ProviderCard.agy.test.tsx
@@ -83,8 +83,8 @@ const relay: Provider = {
},
};
-describe("ProviderCard Antigravity model", () => {
- it("shows the gateway default model on key cards, not the legacy display name", () => {
+describe("ProviderCard Antigravity subtitle", () => {
+ it("shows the endpoint on key cards like Claude Code / Codex, not the gateway models", () => {
renderCard({
...relay,
settingsConfig: {
@@ -95,27 +95,19 @@ describe("ProviderCard Antigravity model", () => {
},
},
});
- expect(screen.getByText("gemini-3.8-flash +1")).toBeInTheDocument();
- expect(screen.queryByText("Gemini 3.1 Pro (High)")).not.toBeInTheDocument();
- });
-
- it("shows the endpoint on key cards without gateway models", () => {
- renderCard(relay);
expect(screen.getByText("https://relay.example.com")).toBeInTheDocument();
+ expect(screen.queryByText("gemini-3.8-flash +1")).not.toBeInTheDocument();
expect(screen.queryByText("Gemini 3.1 Pro (High)")).not.toBeInTheDocument();
});
- it("falls back to GEMINI_MODEL and leaves other apps alone", () => {
+ it("does not show the legacy display-name model", () => {
renderCard({
...relay,
settingsConfig: { env: { GEMINI_MODEL: "Gemini 3.8 Flash (Low)" } },
});
- expect(screen.getByText("Gemini 3.8 Flash (Low)")).toBeInTheDocument();
- });
-
- it("keeps showing the endpoint for Gemini CLI cards", () => {
- renderCard(relay, "gemini");
- expect(screen.queryByText("Gemini 3.1 Pro (High)")).not.toBeInTheDocument();
+ expect(
+ screen.queryByText("Gemini 3.8 Flash (Low)"),
+ ).not.toBeInTheDocument();
});
});