Support Feishu credentials in system settings

This commit is contained in:
2026-07-08 12:03:37 +08:00
parent aed6d8ffbf
commit 7be5dde1db
2 changed files with 98 additions and 52 deletions

View File

@@ -163,7 +163,7 @@ const nullableModelFields = [
] as const;
type SystemSettingValue = string | number | boolean;
type SystemSettingType = "number" | "switch" | "text";
type SystemSettingType = "number" | "switch" | "text" | "password";
interface SystemSettingDefinition {
key: string;
@@ -289,6 +289,22 @@ const systemSettingSections: SystemSettingSection[] = [
placeholder: "例如 https://example.com/search",
description: "如使用独立飞书检索适配服务,在这里填写调用地址。",
},
{
key: "feishu_app_id",
label: "飞书应用 AppID",
type: "text",
defaultValue: "",
placeholder: "填写飞书开放平台应用 AppID",
description: "用于后端直读飞书知识库;系统设置优先于环境变量。",
},
{
key: "feishu_app_secret",
label: "飞书应用 AppSecret",
type: "password",
defaultValue: "",
placeholder: "填写飞书开放平台应用 AppSecret",
description: "用于后端获取飞书 tenant_access_token保存后立即生效。",
},
{
key: "feishu_timeout_seconds",
label: "飞书请求超时(秒)",
@@ -787,7 +803,7 @@ function normalizeSystemSettingValue(setting: (typeof systemSettingDefinitions)[
if (setting.type === "switch") {
return ["1", "true", "yes", "on", "启用"].includes(rawValue.toLowerCase());
}
if (setting.type === "text") {
if (setting.type === "text" || setting.type === "password") {
return rawValue;
}
const parsed = Number(rawValue);
@@ -1302,6 +1318,13 @@ function buildChatQuery() {
v-model="systemSettingValues[setting.key]"
:placeholder="setting.placeholder"
/>
<el-input
v-else-if="setting.type === 'password'"
v-model="systemSettingValues[setting.key]"
:placeholder="setting.placeholder"
type="password"
show-password
/>
<el-switch v-else v-model="systemSettingValues[setting.key]" />
<small>{{ setting.description }}</small>
</label>