feat(config): redesign settings navigation and preserve v7 config migration
- reorganize advanced settings with horizontal navigation, search, and contextual help - remove LAN discovery and trusted proxy settings - add robust v7-to-v8 migration for custom, plugin, routing, TLS, and credential fields - preserve unsaved drafts during external configuration refresh - add migration and settings UI coverage
This commit is contained in:
1 parent
c89e2fb020
commit
fdf56ee7eb
22 files changed
+1497
-632
No files matched your search
@@ -25,27 +25,6 @@ export const generalTemplateGroups: readonly TemplateConfigGroup[] = [
|
||||
},
|
||||
];
|
||||
|
||||
export const networkTemplateGroups: readonly TemplateConfigGroup[] = [
|
||||
{
|
||||
id: 'trusted-proxies', title: text('可信代理', 'Trusted proxies', '信頼するプロキシ'),
|
||||
fields: [field('server.trusted-proxies', 'string-list', '可信代理 IP / CIDR', 'Trusted proxy IPs / CIDRs', '信頼するプロキシの IP / CIDR', [], text('仅信任这些代理提供的客户端 IP 转发头。空列表表示不信任转发头;修改后需重启内核。', 'Only trust forwarded client IP headers from these proxies. An empty list trusts none. Restart the core after changing this setting.', '指定したプロキシからのクライアント IP 転送ヘッダーのみを信頼します。空のリストでは信頼しません。変更後はコアを再起動してください。'), { restart: true })],
|
||||
},
|
||||
{
|
||||
id: 'discovery', title: text('局域网服务发现', 'Local network discovery', 'ローカルネットワークでのサービス検出'),
|
||||
description: text('通过 mDNS / DNS-SD 广播服务,运行中的内核会自动应用修改。', 'Advertise this service through mDNS / DNS-SD. The running core applies changes automatically.', 'mDNS / DNS-SD でサービスを通知します。実行中のコアが変更を自動で適用します。'),
|
||||
fields: [
|
||||
field('server.discovery.enabled', 'boolean', '启用服务发现', 'Enable service discovery', 'サービス検出を有効化', false),
|
||||
field('server.discovery.service-name', 'string', '服务名称前缀', 'Service name prefix', 'サービス名の接頭辞', '', text('留空使用 CPA;内核会自动追加短 ID。', 'Leave blank to use CPA. The core appends a short ID.', '空欄では CPA を使用します。コアが短い ID を追加します。')),
|
||||
field('server.discovery.service-type', 'string', '服务类型', 'Service type', 'サービス種別', '_ai-gateway._tcp'),
|
||||
field('server.discovery.subtypes', 'string-list', '广播的协议子类型', 'Advertised protocol subtypes', '通知するプロトコルのサブタイプ', undefined, text('未单独配置时由内核决定。示例:_chat-completions、_responses、_messages。', 'When unset, the core chooses subtypes. Examples: _chat-completions, _responses, _messages.', '未設定ではコアがサブタイプを選択します。例:_chat-completions、_responses、_messages。')),
|
||||
field('server.discovery.interfaces.include', 'string-list', '允许的网卡', 'Included interfaces', '使用するネットワークインターフェース', [], text('空列表表示自动检测物理网卡。', 'An empty list automatically detects physical interfaces.', '空のリストでは物理ネットワークインターフェースを自動検出します。')),
|
||||
field('server.discovery.interfaces.exclude', 'string-list', '排除的网卡模式', 'Excluded interface patterns', '除外するインターフェースのパターン', []),
|
||||
field('server.discovery.auth-required', 'boolean', '广播需要身份验证', 'Advertise authentication requirement', '認証が必要なことを通知', true),
|
||||
field('server.discovery.advertise-management', 'boolean', '广播管理接口可用性', 'Advertise management availability', '管理 API の利用可否を通知', false),
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export const routingTemplateGroups: readonly TemplateConfigGroup[] = [
|
||||
{
|
||||
id: 'routing-advanced', title: text('会话与冷却策略', 'Session & cooldown behavior', 'セッションとクールダウンの動作'),
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import type { TemplateText } from './templateConfig';
|
||||
import { generalTemplateGroups, requestTemplateGroups, routingTemplateGroups } from './generalTemplateFields';
|
||||
import { oauthTemplateGroups } from './oauthTemplateFields';
|
||||
import { extensionTemplateGroups } from './extensionTemplateFields';
|
||||
import { payloadTemplateGroups } from './payloadTemplateFields';
|
||||
|
||||
const text = (zh: string, en: string, ja: string): TemplateText => ({ zh, en, ja });
|
||||
export const settingsCategories = [
|
||||
{ id: 'general', title: text('服务与访问', 'Service & access', 'サービスとアクセス') },
|
||||
{ id: 'routing', title: text('路由与稳定性', 'Routing & reliability', 'ルーティングと安定性') },
|
||||
{ id: 'requests', title: text('模型与请求', 'Models & requests', 'モデルとリクエスト') },
|
||||
{ id: 'oauth', title: text('上游与凭据', 'Upstreams & credentials', '上流と認証情報') },
|
||||
{ id: 'diagnostics', title: text('日志与诊断', 'Logs & diagnostics', 'ログと診断') },
|
||||
{ id: 'extensions', title: text('扩展与集成', 'Extensions & integrations', '拡張と連携') },
|
||||
{ id: 'software', title: text('应用偏好', 'App preferences', 'アプリの設定') },
|
||||
] as const;
|
||||
export type SettingsCategory = typeof settingsCategories[number]['id'];
|
||||
export type SettingsView = 'access' | 'connection' | 'behavior' | 'aliases' | 'sensitive-words';
|
||||
export const settingsViews = {
|
||||
general: [
|
||||
{ id: 'access', title: text('访问与管理', 'Access & management', 'アクセスと管理') },
|
||||
{ id: 'connection', title: text('连接与 TLS', 'Connections & TLS', '接続と TLS') },
|
||||
],
|
||||
requests: [
|
||||
{ id: 'behavior', title: text('请求行为', 'Request behavior', 'リクエストの動作') },
|
||||
{ id: 'aliases', title: text('思考别名', 'Thinking aliases', '思考の別名') },
|
||||
{ id: 'sensitive-words', title: text('内容过滤', 'Content filters', 'コンテンツフィルター') },
|
||||
],
|
||||
} as const;
|
||||
export const settingsTemplateGroups = {
|
||||
general: generalTemplateGroups.filter(group => group.id === 'management'),
|
||||
routing: [...routingTemplateGroups, ...extensionTemplateGroups.filter(group => group.id === 'extensions-concurrency')],
|
||||
requests: [...requestTemplateGroups, ...payloadTemplateGroups],
|
||||
oauth: oauthTemplateGroups,
|
||||
diagnostics: [...generalTemplateGroups.filter(group => group.id === 'diagnostics'), ...extensionTemplateGroups.filter(group => group.id === 'extensions-inflight')],
|
||||
extensions: extensionTemplateGroups.filter(group => group.id === 'extensions-plugins'),
|
||||
software: [],
|
||||
};
|
||||
export const allSettingsTemplateGroups = Object.values(settingsTemplateGroups).flat();
|
||||
export const settingsMessages = {
|
||||
title: text('高级设置', 'Advanced settings', '詳細設定'),
|
||||
search: text('搜索设置', 'Search settings', '設定を検索'),
|
||||
searchHint: text('搜索设置…', 'Search settings…', '設定を検索…'),
|
||||
clearSearch: text('清空搜索', 'Clear search', '検索をクリア'),
|
||||
results: text('搜索结果', 'Search results', '検索結果'),
|
||||
noResults: text('没有找到匹配的设置,试试其他关键词。', 'No matching settings. Try another keyword.', '一致する設定がありません。別のキーワードをお試しください。'),
|
||||
restart: text('保存后重启内核', 'Core restarts after saving', '保存後にコアを再起動'),
|
||||
automatic: text('自动保存', 'Auto-save', '自動保存'),
|
||||
dirty: text('有未保存修改', 'Unsaved changes', '未保存の変更'),
|
||||
nativeNetwork: text('监听与上游代理', 'Listening & upstream proxy', '待ち受けと上流プロキシ'),
|
||||
nativeRouting: text('凭据选择与会话', 'Credential selection & sessions', '認証情報の選択とセッション'),
|
||||
nativeRetry: text('重试与冷却', 'Retries & cooldowns', '再試行とクールダウン'),
|
||||
} satisfies Record<string, TemplateText>;
|
||||
Reference in new issue
Block a user