diff --git a/web/src/components/keys/GroupFormModal.vue b/web/src/components/keys/GroupFormModal.vue index 53ff94a..3a4e87b 100644 --- a/web/src/components/keys/GroupFormModal.vue +++ b/web/src/components/keys/GroupFormModal.vue @@ -17,7 +17,7 @@ import { useMessage, type FormRules, } from "naive-ui"; -import { reactive, ref, watch } from "vue"; +import { computed, reactive, ref, watch } from "vue"; interface Props { show: boolean; @@ -51,7 +51,7 @@ interface GroupFormData { display_name: string; description: string; upstreams: UpstreamInfo[]; - channel_type: "openai" | "gemini"; + channel_type: "openai" | "gemini" | "anthropic"; sort: number; test_model: string; param_overrides: string; @@ -83,6 +83,33 @@ const configOptions = ref([]); const channelTypesFetched = ref(false); const configOptionsFetched = ref(false); +// 根据渠道类型动态生成占位符提示 +const testModelPlaceholder = computed(() => { + switch (formData.channel_type) { + case "openai": + return "如:gpt-4.1-nano"; + case "gemini": + return "如:gemini-2.0-flash-lite"; + case "anthropic": + return "如:claude-3-haiku-20240307"; + default: + return "请输入模型名称"; + } +}); + +const upstreamPlaceholder = computed(() => { + switch (formData.channel_type) { + case "openai": + return "https://api.openai.com"; + case "gemini": + return "https://generativelanguage.googleapis.com"; + case "anthropic": + return "https://api.anthropic.com"; + default: + return "请输入上游地址"; + } +}); + // 表单验证规则 const rules: FormRules = { name: [ @@ -330,10 +357,7 @@ async function handleSubmit() {

基础信息

- + @@ -349,7 +373,7 @@ async function handleSubmit() { - + @@ -390,7 +414,7 @@ async function handleSubmit() {
权重 diff --git a/web/src/components/keys/GroupList.vue b/web/src/components/keys/GroupList.vue index 3702516..101672c 100644 --- a/web/src/components/keys/GroupList.vue +++ b/web/src/components/keys/GroupList.vue @@ -50,6 +50,8 @@ function getChannelTagType(channelType: string) { return "success"; case "gemini": return "info"; + case "anthropic": + return "warning"; default: return "default"; } @@ -94,6 +96,7 @@ function handleGroupCreated() {
🤖 💎 + 🧠 🔧
diff --git a/web/src/types/models.ts b/web/src/types/models.ts index 67ccce8..c8d43d9 100644 --- a/web/src/types/models.ts +++ b/web/src/types/models.ts @@ -36,7 +36,7 @@ export interface Group { description: string; sort: number; test_model: string; - channel_type: "openai" | "gemini"; + channel_type: "openai" | "gemini" | "anthropic"; upstreams: UpstreamInfo[]; config: Record; api_keys?: APIKey[];