mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-03-20 13:57:06 +08:00
* Add AWS Bedrock provider integration design document Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add AWS Bedrock provider implementation plan Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Update implementation plan: add OpenCode Bedrock support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add cloud_provider category to ProviderCategory type Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add AWS Bedrock (AKSK) Claude Code provider preset with tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add AWS Bedrock (API Key) Claude Code provider preset with tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add AWS Bedrock OpenCode provider preset with @ai-sdk/amazon-bedrock Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add AWS Bedrock provider feature summary for PR Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove internal planning documents Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add AWS Bedrock support to README (EN/ZH/JA) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add AWS Bedrock UI merge design document Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add AWS Bedrock UI merge implementation plan Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: skip optional template values in validation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: support isSecret template fields and hide base URL for Bedrock Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add Bedrock validation, cleanup, and isBedrock prop in ProviderForm Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: extend TemplateValueConfig and merge Bedrock presets Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: mask Bedrock API Key as secret and support GovCloud regions - Add isSecret: true to BEDROCK_API_KEY template value - Update region regex to support multi-segment regions (us-gov-west-1) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: replace AWS icon with updated logo Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: replace AWS icon with updated logo Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: replace AWS icon with new PNG image Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address code review findings - Fix AWS icon: use SVG with embedded <image> instead of raw <img> tag - Hide duplicate ApiKeySection for Bedrock (auth via template fields only) - Guard settingsConfig cleanup against unresolved template placeholders Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove planning documents Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: address PR review - split Bedrock into two presets, restore SVG icon Based on maintainer review feedback on PR #1047: 1. Split merged "AWS Bedrock" back into two separate presets: - "AWS Bedrock (AKSK)": uses AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY - "AWS Bedrock (API Key)": uses top-level apiKey field via standard UI input 2. Restore aws.svg to pure vector SVG (was PNG-in-SVG) 3. Remove all Bedrock-specific logic from shared components: - Remove isBedrock prop from ClaudeFormFields - Remove Bedrock validation/cleanup blocks from ProviderForm - Remove optional/isSecret from TemplateValueConfig - Remove optional skip from useTemplateValues 4. Add cloud_provider category handling: - Skip API Key/Base URL required validation - Hide Speed Test and Base URL for cloud_provider - Hide API format selector for cloud_provider (always Anthropic) - Show API Key input only when config has apiKey field 5. Fix providerConfigUtils to support top-level apiKey: - getApiKeyFromConfig: check config.apiKey before env fields - setApiKeyInConfig: write to config.apiKey when present - hasApiKeyField: detect top-level apiKey property 6. Add OpenClaw Bedrock preset (bedrock-converse-stream protocol) 7. Update model IDs: - Sonnet: global.anthropic.claude-sonnet-4-6 - Opus: global.anthropic.claude-opus-4-6-v1 - Haiku: global.anthropic.claude-haiku-4-5-20251001-v1:0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(test): align Bedrock API Key test assertions with preset implementation The API Key preset was refactored to use standard UI input (apiKey: "") instead of template variables, but the tests were not updated accordingly. --------- Co-authored-by: root <root@ip-10-0-11-189.ap-northeast-1.compute.internal> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Jason <farion1231@gmail.com>
69 lines
2.2 KiB
TypeScript
69 lines
2.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
opencodeProviderPresets,
|
|
opencodeNpmPackages,
|
|
OPENCODE_PRESET_MODEL_VARIANTS,
|
|
} from "@/config/opencodeProviderPresets";
|
|
|
|
describe("AWS Bedrock OpenCode Provider Presets", () => {
|
|
it("should include @ai-sdk/amazon-bedrock in npm packages", () => {
|
|
const bedrockPkg = opencodeNpmPackages.find(
|
|
(p) => p.value === "@ai-sdk/amazon-bedrock",
|
|
);
|
|
expect(bedrockPkg).toBeDefined();
|
|
expect(bedrockPkg!.label).toBe("Amazon Bedrock");
|
|
});
|
|
|
|
it("should include Bedrock model variants", () => {
|
|
const variants = OPENCODE_PRESET_MODEL_VARIANTS["@ai-sdk/amazon-bedrock"];
|
|
expect(variants).toBeDefined();
|
|
expect(variants.length).toBeGreaterThan(0);
|
|
|
|
const opusModel = variants.find((v) =>
|
|
v.id.includes("anthropic.claude-opus-4-6"),
|
|
);
|
|
expect(opusModel).toBeDefined();
|
|
});
|
|
|
|
const bedrockPreset = opencodeProviderPresets.find(
|
|
(p) => p.name === "AWS Bedrock",
|
|
);
|
|
|
|
it("should include AWS Bedrock preset", () => {
|
|
expect(bedrockPreset).toBeDefined();
|
|
});
|
|
|
|
it("Bedrock preset should use @ai-sdk/amazon-bedrock npm package", () => {
|
|
expect(bedrockPreset!.settingsConfig.npm).toBe(
|
|
"@ai-sdk/amazon-bedrock",
|
|
);
|
|
});
|
|
|
|
it("Bedrock preset should have region in options", () => {
|
|
expect(bedrockPreset!.settingsConfig.options).toHaveProperty("region");
|
|
});
|
|
|
|
it("Bedrock preset should have cloud_provider category", () => {
|
|
expect(bedrockPreset!.category).toBe("cloud_provider");
|
|
});
|
|
|
|
it("Bedrock preset should have template values for AWS credentials", () => {
|
|
expect(bedrockPreset!.templateValues).toBeDefined();
|
|
expect(bedrockPreset!.templateValues!.region).toBeDefined();
|
|
expect(bedrockPreset!.templateValues!.region.editorValue).toBe(
|
|
"us-west-2",
|
|
);
|
|
expect(bedrockPreset!.templateValues!.accessKeyId).toBeDefined();
|
|
expect(bedrockPreset!.templateValues!.secretAccessKey).toBeDefined();
|
|
});
|
|
|
|
it("Bedrock preset should include Claude models", () => {
|
|
const models = bedrockPreset!.settingsConfig.models;
|
|
expect(models).toBeDefined();
|
|
const modelIds = Object.keys(models!);
|
|
expect(
|
|
modelIds.some((id) => id.includes("anthropic.claude")),
|
|
).toBe(true);
|
|
});
|
|
});
|