feat: 接口管理代理密钥

This commit is contained in:
tbphp
2025-07-24 16:34:51 +08:00
parent cdfc0b07aa
commit 746c9f3108
5 changed files with 40 additions and 3 deletions

View File

@@ -59,6 +59,7 @@ interface GroupFormData {
param_overrides: string;
config: Record<string, number>;
configItems: ConfigItem[];
proxy_keys: string;
}
// 表单数据
@@ -79,6 +80,7 @@ const formData = reactive<GroupFormData>({
param_overrides: "",
config: {},
configItems: [] as ConfigItem[],
proxy_keys: "",
});
const channelTypeOptions = ref<{ label: string; value: string }[]>([]);
@@ -269,6 +271,7 @@ function resetForm() {
param_overrides: "",
config: {},
configItems: [],
proxy_keys: "",
});
// 重置用户修改状态追踪
@@ -304,6 +307,7 @@ function loadGroupData() {
param_overrides: JSON.stringify(props.group.param_overrides || {}, null, 2),
config: {},
configItems,
proxy_keys: props.group.proxy_keys || "",
});
}
@@ -408,6 +412,7 @@ async function handleSubmit() {
validation_endpoint: formData.validation_endpoint,
param_overrides: paramOverrides,
config,
proxy_keys: formData.proxy_keys,
};
let res: Group;
@@ -592,6 +597,25 @@ async function handleSubmit() {
<div v-else class="form-item-half" />
</div>
<!-- 代理密钥 -->
<n-form-item label="代理密钥" path="proxy_keys">
<template #label>
<div class="form-label-with-tooltip">
代理密钥
<n-tooltip trigger="hover" placement="top">
<template #trigger>
<n-icon :component="HelpCircleOutline" class="help-icon" />
</template>
分组专用代理密钥用于访问此分组的代理端点多个密钥请用逗号分隔
</n-tooltip>
</div>
</template>
<n-input
v-model:value="formData.proxy_keys"
placeholder="多个密钥请用英文逗号 , 分隔"
/>
</n-form-item>
<!-- 描述独占一行 -->
<n-form-item label="描述" path="description">
<template #label>

View File

@@ -43,6 +43,7 @@ export interface Group {
api_keys?: APIKey[];
endpoint?: string;
param_overrides: Record<string, unknown>;
proxy_keys: string;
created_at?: string;
updated_at?: string;
}

View File

@@ -72,8 +72,12 @@ async function handleSubmit() {
hoverable
bordered
>
<n-grid :x-gap="24" :y-gap="24" responsive="screen" cols="1 s:2 m:2 l:3 xl:4">
<n-grid-item v-for="item in category.settings" :key="item.key">
<n-grid :x-gap="24" :y-gap="0" responsive="screen" cols="1 s:2 m:2 l:3 xl:4">
<n-grid-item
v-for="item in category.settings"
:key="item.key"
:span="item.key === 'proxy_keys' ? 4 : 1"
>
<n-form-item
:path="item.key"
:rule="{ required: true, message: `请输入 ${item.name}` }"