refactor(opencode): simplify API format selector

- Reduce npm package options from 10 to 4 core API formats (OpenAI, OpenAI Compatible, Anthropic, Google)
- Rename "AI SDK Package" to "API Format" in i18n (zh/en/ja)
- Remove check icon from Select dropdown items for cleaner UI
This commit is contained in:
Jason
2026-01-16 20:29:12 +08:00
parent f349d85e85
commit 9b4485e111
6 changed files with 12 additions and 24 deletions
@@ -94,7 +94,7 @@ export function OpenCodeFormFields({
<div className="space-y-2"> <div className="space-y-2">
<FormLabel htmlFor="opencode-npm"> <FormLabel htmlFor="opencode-npm">
{t("opencode.npmPackage", { {t("opencode.npmPackage", {
defaultValue: "AI SDK Package", defaultValue: "接口格式",
})} })}
</FormLabel> </FormLabel>
<Select value={npm} onValueChange={onNpmChange}> <Select value={npm} onValueChange={onNpmChange}>
+1 -7
View File
@@ -1,6 +1,6 @@
import * as React from "react"; import * as React from "react";
import * as SelectPrimitive from "@radix-ui/react-select"; import * as SelectPrimitive from "@radix-ui/react-select";
import { Check, ChevronDown, ChevronUp } from "lucide-react"; import { ChevronDown, ChevronUp } from "lucide-react";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
const Select = SelectPrimitive.Root; const Select = SelectPrimitive.Root;
@@ -87,12 +87,6 @@ const SelectItem = React.forwardRef<
)} )}
{...props} {...props}
> >
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
<Check className="h-4 w-4" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText> <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item> </SelectPrimitive.Item>
)); ));
+1 -7
View File
@@ -32,15 +32,9 @@ export interface OpenCodeProviderPreset {
*/ */
export const opencodeNpmPackages = [ export const opencodeNpmPackages = [
{ value: "@ai-sdk/openai", label: "OpenAI" }, { value: "@ai-sdk/openai", label: "OpenAI" },
{ value: "@ai-sdk/anthropic", label: "Anthropic" },
{ value: "@ai-sdk/openai-compatible", label: "OpenAI Compatible" }, { value: "@ai-sdk/openai-compatible", label: "OpenAI Compatible" },
{ value: "@ai-sdk/anthropic", label: "Anthropic" },
{ value: "@ai-sdk/google", label: "Google (Gemini)" }, { value: "@ai-sdk/google", label: "Google (Gemini)" },
{ value: "@ai-sdk/azure", label: "Azure OpenAI" },
{ value: "@ai-sdk/amazon-bedrock", label: "Amazon Bedrock" },
{ value: "@ai-sdk/cohere", label: "Cohere" },
{ value: "@ai-sdk/mistral", label: "Mistral" },
{ value: "@ai-sdk/groq", label: "Groq" },
{ value: "@ai-sdk/deepseek", label: "DeepSeek" },
] as const; ] as const;
/** /**
+3 -3
View File
@@ -461,9 +461,9 @@
"configReplaceFailed": "Config replace failed: {{error}}" "configReplaceFailed": "Config replace failed: {{error}}"
}, },
"opencode": { "opencode": {
"npmPackage": "AI SDK Package", "npmPackage": "API Format",
"selectPackage": "Select a package", "selectPackage": "Select API format",
"npmPackageHint": "Select the npm package for communicating with the AI service", "npmPackageHint": "Select the API format for the AI service",
"baseUrl": "Base URL", "baseUrl": "Base URL",
"baseUrlHint": "Custom API endpoint URL", "baseUrlHint": "Custom API endpoint URL",
"models": "Models", "models": "Models",
+3 -3
View File
@@ -461,9 +461,9 @@
"configReplaceFailed": "設定の置換に失敗しました: {{error}}" "configReplaceFailed": "設定の置換に失敗しました: {{error}}"
}, },
"opencode": { "opencode": {
"npmPackage": "AI SDK パッケージ", "npmPackage": "API フォーマット",
"selectPackage": "パッケージを選択", "selectPackage": "API フォーマットを選択",
"npmPackageHint": "AI サービスとの通信に使用する npm パッケージを選択", "npmPackageHint": "AI サービスの API フォーマットを選択",
"baseUrl": "Base URL", "baseUrl": "Base URL",
"baseUrlHint": "カスタム API エンドポイント URL", "baseUrlHint": "カスタム API エンドポイント URL",
"models": "モデル設定", "models": "モデル設定",
+3 -3
View File
@@ -461,9 +461,9 @@
"configReplaceFailed": "配置替换失败: {{error}}" "configReplaceFailed": "配置替换失败: {{error}}"
}, },
"opencode": { "opencode": {
"npmPackage": "AI SDK 包", "npmPackage": "接口格式",
"selectPackage": "选择一个包", "selectPackage": "选择接口格式",
"npmPackageHint": "选择用于与 AI 服务通信的 npm 包", "npmPackageHint": "选择 AI 服务的 API 接口格式",
"baseUrl": "Base URL", "baseUrl": "Base URL",
"baseUrlHint": "自定义 API 端点地址", "baseUrlHint": "自定义 API 端点地址",
"models": "模型配置", "models": "模型配置",