mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
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:
@@ -94,7 +94,7 @@ export function OpenCodeFormFields({
|
||||
<div className="space-y-2">
|
||||
<FormLabel htmlFor="opencode-npm">
|
||||
{t("opencode.npmPackage", {
|
||||
defaultValue: "AI SDK Package",
|
||||
defaultValue: "接口格式",
|
||||
})}
|
||||
</FormLabel>
|
||||
<Select value={npm} onValueChange={onNpmChange}>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "react";
|
||||
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";
|
||||
|
||||
const Select = SelectPrimitive.Root;
|
||||
@@ -87,12 +87,6 @@ const SelectItem = React.forwardRef<
|
||||
)}
|
||||
{...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.Item>
|
||||
));
|
||||
|
||||
@@ -32,15 +32,9 @@ export interface OpenCodeProviderPreset {
|
||||
*/
|
||||
export const opencodeNpmPackages = [
|
||||
{ value: "@ai-sdk/openai", label: "OpenAI" },
|
||||
{ value: "@ai-sdk/anthropic", label: "Anthropic" },
|
||||
{ value: "@ai-sdk/openai-compatible", label: "OpenAI Compatible" },
|
||||
{ value: "@ai-sdk/anthropic", label: "Anthropic" },
|
||||
{ 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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -461,9 +461,9 @@
|
||||
"configReplaceFailed": "Config replace failed: {{error}}"
|
||||
},
|
||||
"opencode": {
|
||||
"npmPackage": "AI SDK Package",
|
||||
"selectPackage": "Select a package",
|
||||
"npmPackageHint": "Select the npm package for communicating with the AI service",
|
||||
"npmPackage": "API Format",
|
||||
"selectPackage": "Select API format",
|
||||
"npmPackageHint": "Select the API format for the AI service",
|
||||
"baseUrl": "Base URL",
|
||||
"baseUrlHint": "Custom API endpoint URL",
|
||||
"models": "Models",
|
||||
|
||||
@@ -461,9 +461,9 @@
|
||||
"configReplaceFailed": "設定の置換に失敗しました: {{error}}"
|
||||
},
|
||||
"opencode": {
|
||||
"npmPackage": "AI SDK パッケージ",
|
||||
"selectPackage": "パッケージを選択",
|
||||
"npmPackageHint": "AI サービスとの通信に使用する npm パッケージを選択",
|
||||
"npmPackage": "API フォーマット",
|
||||
"selectPackage": "API フォーマットを選択",
|
||||
"npmPackageHint": "AI サービスの API フォーマットを選択",
|
||||
"baseUrl": "Base URL",
|
||||
"baseUrlHint": "カスタム API エンドポイント URL",
|
||||
"models": "モデル設定",
|
||||
|
||||
@@ -461,9 +461,9 @@
|
||||
"configReplaceFailed": "配置替换失败: {{error}}"
|
||||
},
|
||||
"opencode": {
|
||||
"npmPackage": "AI SDK 包",
|
||||
"selectPackage": "选择一个包",
|
||||
"npmPackageHint": "选择用于与 AI 服务通信的 npm 包",
|
||||
"npmPackage": "接口格式",
|
||||
"selectPackage": "选择接口格式",
|
||||
"npmPackageHint": "选择 AI 服务的 API 接口格式",
|
||||
"baseUrl": "Base URL",
|
||||
"baseUrlHint": "自定义 API 端点地址",
|
||||
"models": "模型配置",
|
||||
|
||||
Reference in New Issue
Block a user