feat: add Ark provider setup links

This commit is contained in:
fanziqing
2026-08-14 16:58:53 +08:00
parent e74bbf1b1a
commit 4bfd75a4df
2 changed files with 29 additions and 1 deletions
@@ -2,7 +2,7 @@
// only the selected method's fields render, and clicking a segment switches them. // only the selected method's fields render, and clicking a segment switches them.
import { afterEach, describe, expect, it, vi } from "vitest"; import { afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render, screen } from "@testing-library/react"; import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { ProviderForm, type ProviderSetupState } from "./ProviderSetup"; import { KEY_HELP, ProviderForm, ProviderMark, type ProviderSetupState } from "./ProviderSetup";
import type { ProviderInfo } from "../api"; import type { ProviderInfo } from "../api";
vi.mock("../tauri", () => ({ openExternal: vi.fn() })); vi.mock("../tauri", () => ({ openExternal: vi.fn() }));
@@ -94,3 +94,29 @@ describe("ProviderForm auth-method choice", () => {
expect(screen.queryByTestId("t-field-bedrock_api_key")).toBeNull(); expect(screen.queryByTestId("t-field-bedrock_api_key")).toBeNull();
}); });
}); });
describe("Ark provider presentation", () => {
it("uses separate BytePlus and Volcengine brand marks", () => {
const { container, rerender } = render(
<ProviderMark name="ark" title="BytePlus Ark" />,
);
expect(container.querySelector("img")).toBeTruthy();
rerender(
<ProviderMark
name="ark-agent-plan-cn"
title="Volcengine Ark Agent Plan"
/>,
);
expect(container.querySelector("img")).toBeTruthy();
});
it("links each provider to its own API key console", () => {
expect(KEY_HELP.ark.url).toBe(
"https://console.byteplus.com/ark/region:ark+ap-southeast-1/apiKey",
);
expect(KEY_HELP["ark-agent-plan-cn"].url).toContain(
"advancedActiveKey=agentPlan",
);
});
});
@@ -21,6 +21,8 @@ export const KEY_HELP: Record<string, { url: string; label: string }> = {
anthropic: { url: "https://console.anthropic.com/settings/keys", label: "console.anthropic.com" }, anthropic: { url: "https://console.anthropic.com/settings/keys", label: "console.anthropic.com" },
openai: { url: "https://platform.openai.com/api-keys", label: "platform.openai.com" }, openai: { url: "https://platform.openai.com/api-keys", label: "platform.openai.com" },
gemini: { url: "https://aistudio.google.com/apikey", label: "aistudio.google.com" }, gemini: { url: "https://aistudio.google.com/apikey", label: "aistudio.google.com" },
ark: { url: "https://console.byteplus.com/ark/region:ark+ap-southeast-1/apiKey", label: "console.byteplus.com" },
"ark-agent-plan-cn": { url: "https://console.volcengine.com/ark/region:cn-beijing/openManagement?LLM=%7B%7D&advancedActiveKey=agentPlan", label: "console.volcengine.com" },
openrouter: { url: "https://openrouter.ai/keys", label: "openrouter.ai" }, openrouter: { url: "https://openrouter.ai/keys", label: "openrouter.ai" },
bedrock: { url: "https://console.aws.amazon.com/bedrock/home#/api-keys", label: "the AWS Bedrock console" }, bedrock: { url: "https://console.aws.amazon.com/bedrock/home#/api-keys", label: "the AWS Bedrock console" },
fireworks: { url: "https://fireworks.ai/account/api-keys", label: "fireworks.ai" }, fireworks: { url: "https://fireworks.ai/account/api-keys", label: "fireworks.ai" },