From d56370b30ffde78cd2298d604bb1870b647e939c Mon Sep 17 00:00:00 2001 From: wizardchen Date: Sun, 31 May 2026 15:28:00 +0800 Subject: [PATCH] refactor(settings): update event handling and UI interactions in various components Modified event handling for form submissions in CreateTenantDialog and CredentialResource components to use the `@enter` directive for improved clarity. Removed console log from i18n initialization and updated localization files to include new section labels for the redesigned drawer across multiple languages. Enhanced the UI in Login and McpSettings views by adjusting input types and integrating test connection functionality into the drawer components. Streamlined the layout and interactions in ModelSettings, ParserEngineSettings, StorageEngineSettings, and VectorStoreSettings to ensure consistency and better user experience. --- .../src/components/CreateTenantDialog.vue | 2 +- .../credentials/CredentialResource.vue | 2 +- frontend/src/i18n/index.ts | 1 - frontend/src/i18n/locales/en-US.ts | 34 +- frontend/src/i18n/locales/ko-KR.ts | 32 + frontend/src/i18n/locales/ru-RU.ts | 34 +- frontend/src/i18n/locales/zh-CN.ts | 32 + frontend/src/views/auth/Login.vue | 10 +- frontend/src/views/settings/McpSettings.vue | 78 +- frontend/src/views/settings/ModelSettings.vue | 338 ++++-- .../views/settings/ParserEngineSettings.vue | 624 ++++++---- .../views/settings/StorageEngineSettings.vue | 1056 ++++++++++------- frontend/src/views/settings/TenantInfo.vue | 3 +- .../views/settings/VectorStoreSettings.vue | 761 ++++++++---- .../src/views/settings/WebSearchSettings.vue | 555 ++++++--- .../settings/components/McpServiceDialog.vue | 565 ++++++++- 16 files changed, 2835 insertions(+), 1292 deletions(-) diff --git a/frontend/src/components/CreateTenantDialog.vue b/frontend/src/components/CreateTenantDialog.vue index 815581b9..a7a064f7 100644 --- a/frontend/src/components/CreateTenantDialog.vue +++ b/frontend/src/components/CreateTenantDialog.vue @@ -18,7 +18,7 @@ + @enter="handleSubmit" /> + class="credential-edit-input" @enter="onSave(field)">
diff --git a/frontend/src/i18n/index.ts b/frontend/src/i18n/index.ts index b7698d86..da405b61 100755 --- a/frontend/src/i18n/index.ts +++ b/frontend/src/i18n/index.ts @@ -13,7 +13,6 @@ const messages = { // Получаем сохраненный язык из localStorage или используем китайский по умолчанию const savedLocale = localStorage.getItem('locale') || 'zh-CN' -console.log('i18n инициализация с языком:', savedLocale) const i18n = createI18n({ legacy: false, diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index b0aaa877..f6dfebbf 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -895,6 +895,11 @@ export default { parser: { title: 'Parser Engine', description: 'Document parser engine status and configuration. Settings here take priority over server environment variables. Leave empty to use environment variable defaults.', + // Section / label keys for the redesigned drawer + supportedFileTypes: 'Supported Formats', + statusSection: 'Status', + configSection: 'Configuration', + featuresLabel: 'Features', loading: 'Loading...', retry: 'Retry', noEngineDetected: 'No parser engine detected. Please ensure the DocReader service is running properly.', @@ -932,6 +937,12 @@ export default { storage: { title: 'Storage Engine', description: 'Configure document and image storage. Set engine parameters here; knowledge bases only select which engine to use.', + // Section / label keys for the redesigned drawer + basicSection: 'Basic', + modeSection: 'Deployment Mode', + credentialsSection: 'Credentials', + bucketSection: 'Bucket', + useSslDesc: 'Connect to MinIO over HTTPS', loading: 'Loading...', retry: 'Retry', defaultEngine: 'Default Engine', @@ -1010,6 +1021,10 @@ export default { webSearchSettings: { title: 'Web Search Configuration', description: 'Configure web search so answers can include up-to-date information from the internet.', + // Section keys for the redesigned drawer + basicSection: 'Basic', + credentialsSection: 'Connection', + optionsSection: 'Options', // Provider entity management providersTitle: 'Search Engine Providers', addProvider: 'Add Provider', @@ -1077,6 +1092,8 @@ export default { vectorStoreSettings: { title: 'Vector Database Engine', description: 'Register and manage vector database instances for knowledge base search.', + // Section key for the redesigned drawer + basicSection: 'Basic', storesTitle: 'Vector Databases', addStore: 'Add Database', editStore: 'Edit Database', @@ -3498,6 +3515,9 @@ export default { mcpSettings: { title: 'MCP Services', description: 'Manage external MCP (Model Context Protocol) services for tools/resources in Agent mode', + // Drawer subtitle chip + enabled: 'Enabled', + disabled: 'Disabled', configuredServices: 'Configured Services', manageAndTest: 'Manage and test MCP service connections', addService: 'Add Service', @@ -3538,7 +3558,8 @@ export default { }, source: { remote: 'Remote', - openaiCompatible: 'OpenAI-compatible' + openaiCompatible: 'OpenAI-compatible', + custom: 'Custom', }, rawModelName: 'Model name', chat: { @@ -3645,6 +3666,13 @@ export default { mcpServiceDialog: { addTitle: 'Add MCP Service', editTitle: 'Edit MCP Service', + // Section + drawer-only keys + basicSection: 'Basic', + connectionSection: 'Connection', + enableServiceDesc: 'When off, this service will not be invoked', + testAfterSaveHint: 'Save first to test the connection', + unitSecond: 's', + unitTimes: '×', name: 'Service Name', namePlaceholder: 'Enter service name', description: 'Description', @@ -4176,6 +4204,10 @@ export default { name: 'WeKnora Cloud', desc: 'Document parsing via WeKnora Cloud', }, + markitdown: { + name: 'MarkItDown', + desc: "Microsoft MarkItDown converter (PDF/Office/HTML and more)", + }, }, }, supportedFormats: 'Supported formats', diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index 353d6628..b90bcc27 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -755,6 +755,11 @@ export default { parser: { title: '파서 엔진', description: '문서 파서 엔진 상태 및 구성. 이 설정은 서버 환경변수보다 우선 적용됩니다. 비워두면 환경변수 기본값을 사용합니다.', + // Section / label keys for the redesigned drawer + supportedFileTypes: '지원 형식', + statusSection: '상태', + configSection: '구성', + featuresLabel: '기능', loading: '로딩 중...', retry: '재시도', noEngineDetected: '파서 엔진이 감지되지 않았습니다. DocReader 서비스가 정상적으로 실행 중인지 확인하세요.', @@ -792,6 +797,12 @@ export default { storage: { title: '스토리지 엔진', description: '문서 및 이미지 저장 방식을 구성합니다. 엔진 파라미터를 설정하면 지식베이스에서 사용할 엔진만 선택합니다.', + // Section / label keys for the redesigned drawer + basicSection: '기본', + modeSection: '배포 모드', + credentialsSection: '자격 증명', + bucketSection: '버킷', + useSslDesc: 'HTTPS로 MinIO에 연결', loading: '로딩 중...', retry: '재시도', defaultEngine: '기본 엔진', @@ -871,6 +882,10 @@ export default { title: "웹 검색 설정", description: "웹 검색 기능을 구성하여 질문에 답변할 때 인터넷에서 실시간 정보를 가져와 지식베이스 내용을 보완합니다", + // Section keys for the redesigned drawer + basicSection: '기본', + credentialsSection: '연결', + optionsSection: '옵션', providersTitle: "검색 엔진 프로바이더 설정", addProvider: "프로바이더 추가", editProvider: "프로바이더 편집", @@ -937,6 +952,8 @@ export default { vectorStoreSettings: { title: "벡터 데이터베이스 엔진", description: "지식 베이스 검색을 위한 벡터 데이터베이스 인스턴스를 등록하고 관리합니다.", + // Section key for the redesigned drawer + basicSection: '기본', storesTitle: "벡터 데이터베이스", addStore: "데이터베이스 추가", editStore: "데이터베이스 수정", @@ -3539,6 +3556,9 @@ export default { title: "MCP 서비스 관리", description: "외부 MCP (Model Context Protocol) 서비스를 관리합니다. Agent 모드에서 외부 도구와 리소스를 호출합니다", + // Drawer subtitle chip + enabled: "활성화됨", + disabled: "비활성화됨", configuredServices: "설정된 서비스", manageAndTest: "MCP 서비스 연결 관리 및 테스트", addService: "서비스 추가", @@ -3580,6 +3600,7 @@ export default { source: { remote: "Remote", openaiCompatible: "OpenAI 호환", + custom: "사용자 지정", }, rawModelName: "모델 이름", chat: { @@ -3686,6 +3707,13 @@ export default { mcpServiceDialog: { addTitle: "MCP 서비스 추가", editTitle: "MCP 서비스 편집", + // Section + drawer-only keys + basicSection: "기본", + connectionSection: "연결", + enableServiceDesc: "비활성화 시 이 서비스가 호출되지 않습니다", + testAfterSaveHint: "저장 후 연결을 테스트할 수 있습니다", + unitSecond: "초", + unitTimes: "회", name: "서비스 이름", namePlaceholder: "서비스 이름을 입력해주세요", description: "설명", @@ -4238,6 +4266,10 @@ export default { name: 'WeKnora Cloud', desc: 'WeKnora Cloud를 통한 문서 파싱', }, + markitdown: { + name: 'MarkItDown', + desc: 'Microsoft MarkItDown 변환기 (PDF/Office/HTML 등)', + }, }, }, supportedFormats: '지원 형식', diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index 14e4bc3f..12f640b9 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -810,6 +810,11 @@ export default { parser: { title: 'Парсер', description: 'Состояние и конфигурация парсеров документов. Настройки здесь приоритетнее переменных окружения сервера. Оставьте пустым для значений по умолчанию.', + // Section / label keys for the redesigned drawer + supportedFileTypes: 'Поддерживаемые форматы', + statusSection: 'Статус', + configSection: 'Конфигурация', + featuresLabel: 'Опции', loading: 'Загрузка...', retry: 'Повторить', noEngineDetected: 'Парсеры не обнаружены. Убедитесь, что сервис DocReader работает.', @@ -844,6 +849,12 @@ export default { storage: { title: 'Хранилище', description: 'Настройте хранение документов и изображений. Здесь задаются параметры хранилищ; в базе знаний выбирается только тип хранилища.', + // Section / label keys for the redesigned drawer + basicSection: 'Основное', + modeSection: 'Режим развёртывания', + credentialsSection: 'Учётные данные', + bucketSection: 'Bucket', + useSslDesc: 'Подключаться к MinIO по HTTPS', loading: 'Загрузка...', retry: 'Повторить', defaultEngine: 'Хранилище по умолчанию', @@ -922,6 +933,10 @@ export default { webSearchSettings: { title: 'Настройки веб-поиска', description: 'Настройте веб-поиск, чтобы ответы могли включать актуальную информацию из интернета.', + // Section keys for the redesigned drawer + basicSection: 'Основное', + credentialsSection: 'Подключение', + optionsSection: 'Опции', providersTitle: 'Поисковые провайдеры', addProvider: 'Добавить провайдер', editProvider: 'Редактировать провайдер', @@ -989,6 +1004,8 @@ export default { vectorStoreSettings: { title: 'Движок векторной базы данных', description: 'Регистрация и управление экземплярами векторных баз данных для поиска по базе знаний.', + // Section key for the redesigned drawer + basicSection: 'Основное', storesTitle: 'Векторные базы данных', addStore: 'Добавить базу данных', editStore: 'Редактировать базу данных', @@ -3200,6 +3217,9 @@ export default { mcpSettings: { title: 'Сервисы MCP', description: 'Управление внешними сервисами MCP (Model Context Protocol) для использования инструментов и ресурсов в режиме Agent', + // Drawer subtitle chip + enabled: 'Включён', + disabled: 'Отключён', configuredServices: 'Настроенные сервисы', manageAndTest: 'Управляйте и тестируйте подключения MCP', addService: 'Добавить сервис', @@ -3244,7 +3264,8 @@ export default { }, source: { remote: 'Удалённая', - openaiCompatible: 'Совместимо с OpenAI' + openaiCompatible: 'Совместимо с OpenAI', + custom: 'Своё', }, rawModelName: 'Имя модели', embedding: { @@ -3344,6 +3365,13 @@ export default { mcpServiceDialog: { addTitle: 'Добавить сервис MCP', editTitle: 'Редактировать сервис MCP', + // Section + drawer-only keys + basicSection: 'Основное', + connectionSection: 'Подключение', + enableServiceDesc: 'При выключении сервис не будет вызываться', + testAfterSaveHint: 'Сохраните, чтобы протестировать подключение', + unitSecond: 'с', + unitTimes: '×', name: 'Название сервиса', namePlaceholder: 'Введите название сервиса', description: 'Описание', @@ -3738,6 +3766,10 @@ export default { name: 'WeKnora Cloud', desc: 'Парсинг документов через WeKnora Cloud', }, + markitdown: { + name: 'MarkItDown', + desc: 'Конвертер Microsoft MarkItDown (PDF/Office/HTML и др.)', + }, }, }, supportedFormats: 'Поддерживаемые форматы' diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 5b2784e2..6810dbca 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -751,6 +751,11 @@ export default { parser: { title: "解析引擎", description: "文档解析引擎状态及配置。此处设置优先于服务端环境变量,留空则使用环境变量默认值。", + // Section / label keys for the redesigned drawer + supportedFileTypes: "支持文件类型", + statusSection: "状态信息", + configSection: "配置", + featuresLabel: "识别选项", loading: "加载中...", retry: "重试", noEngineDetected: "未检测到解析引擎,请确认 DocReader 服务正常运行。", @@ -788,6 +793,12 @@ export default { storage: { title: "存储引擎", description: "配置文档与图片的存储方式。此处设置各引擎参数,知识库中仅选择使用哪个引擎。", + // Section / label keys for the redesigned drawer + basicSection: "基本配置", + modeSection: "部署模式", + credentialsSection: "凭证", + bucketSection: "Bucket", + useSslDesc: "通过 HTTPS 访问 MinIO", loading: "加载中...", retry: "重试", defaultEngine: "默认引擎", @@ -867,6 +878,10 @@ export default { title: "网络搜索配置", description: "配置网络搜索功能,在回答问题时可以从互联网获取实时信息补充知识库内容", + // Section keys for the redesigned drawer + basicSection: "基本信息", + credentialsSection: "连接配置", + optionsSection: "选项", // Provider entity management providersTitle: "搜索引擎配置", addProvider: "添加搜索引擎", @@ -935,6 +950,8 @@ export default { vectorStoreSettings: { title: "向量数据库引擎", description: "注册和管理用于知识库搜索的向量数据库实例。", + // Section key for the redesigned drawer + basicSection: "基本信息", storesTitle: "向量数据库", addStore: "添加数据库", editStore: "编辑数据库", @@ -3491,6 +3508,9 @@ export default { title: "MCP 服务管理", description: "管理外部 MCP (Model Context Protocol) 服务,在 Agent 模式下调用外部工具和资源", + // Drawer subtitle chip + enabled: "已启用", + disabled: "已禁用", configuredServices: "已配置的服务", manageAndTest: "管理和测试 MCP 服务连接", addService: "添加服务", @@ -3533,6 +3553,7 @@ export default { source: { remote: "Remote", openaiCompatible: "OpenAI兼容", + custom: "自定义", }, rawModelName: "模型名称", chat: { @@ -3639,6 +3660,13 @@ export default { mcpServiceDialog: { addTitle: "添加 MCP 服务", editTitle: "编辑 MCP 服务", + // Section + drawer-only keys + basicSection: "基本信息", + connectionSection: "连接配置", + enableServiceDesc: "关闭后该服务不会被调用", + testAfterSaveHint: "保存后可测试连接", + unitSecond: "秒", + unitTimes: "次", name: "服务名称", namePlaceholder: "请输入服务名称", description: "描述", @@ -4170,6 +4198,10 @@ export default { name: "WeKnora Cloud", desc: "使用 WeKnora Cloud 进行文档解析", }, + markitdown: { + name: "MarkItDown", + desc: "Microsoft MarkItDown 文档转换工具(支持 PDF/Office/HTML 等)", + }, }, }, supportedFormats: "支持格式", diff --git a/frontend/src/views/auth/Login.vue b/frontend/src/views/auth/Login.vue index 995a1482..96b79ca5 100755 --- a/frontend/src/views/auth/Login.vue +++ b/frontend/src/views/auth/Login.vue @@ -201,7 +201,8 @@ @@ -214,7 +215,7 @@ type="password" size="large" :disabled="loading" - @keydown.enter="handleLogin" + @enter="handleLogin" /> @@ -321,7 +322,8 @@ @@ -344,7 +346,7 @@ type="password" size="large" :disabled="loading" - @keydown.enter="handleRegister" + @enter="handleRegister" /> diff --git a/frontend/src/views/settings/McpSettings.vue b/frontend/src/views/settings/McpSettings.vue index bcad7c3a..d328d386 100644 --- a/frontend/src/views/settings/McpSettings.vue +++ b/frontend/src/views/settings/McpSettings.vue @@ -99,6 +99,7 @@ :service="currentService" :mode="dialogMode" @success="handleDialogSuccess" + @test="handleDrawerTest" /> @@ -119,7 +120,6 @@ import { listMCPServices, updateMCPService, deleteMCPService, - testMCPService, type MCPService, type MCPTestResult } from '@/api/mcp-service' @@ -141,7 +141,6 @@ const testDialogVisible = ref(false) const testResult = ref(null) const testingServiceName = ref('') const testingServiceId = ref('') -const testing = ref(false) // Load MCP services const loadServices = async () => { @@ -191,52 +190,6 @@ const handleToggleEnabled = async (service: MCPService) => { } } -// Handle test button click -const handleTest = async (service: MCPService) => { - if (!service || !service.id) return - - testingServiceName.value = service.name - testingServiceId.value = service.id - testing.value = true - - MessagePlugin.info({ - content: t('mcpSettings.toasts.testing', { name: service.name }), - duration: 0, - closeBtn: false - }) - - try { - const result = await testMCPService(service.id) - - MessagePlugin.closeAll() - - if (!result) { - testResult.value = { - success: false, - message: t('mcpSettings.toasts.noResponse') - } - testDialogVisible.value = true - return - } - - testResult.value = result - testDialogVisible.value = true - } catch (error: any) { - MessagePlugin.closeAll() - - const errorMessage = error?.response?.data?.error?.message || error?.message || t('mcpSettings.toasts.testFailed') - console.error('Failed to test MCP service:', error) - - testResult.value = { - success: false, - message: errorMessage - } - testDialogVisible.value = true - } finally { - testing.value = false - } -} - // Handle delete button click const handleDelete = (service: MCPService) => { if (!service || !service.id) return @@ -256,9 +209,10 @@ const handleDelete = (service: MCPService) => { }) } -// Get service options for dropdown menu. MCP service mutations and the -// /test endpoint (which probes external infra with stored creds) are all +// Get service options for dropdown menu. MCP service mutations are all // Admin+ in the backend matrix, so non-Admins see an empty action menu. +// 测试连接已挪到编辑抽屉的 footer,不再放在外层菜单里 — 单一入口减少 +// 用户疑惑("为什么有两个测试入口,结果一样吗?")。 const getServiceOptions = (service: MCPService) => { if (!authStore.hasRole('admin')) { return [] @@ -268,26 +222,35 @@ const getServiceOptions = (service: MCPService) => { content: service.enabled ? t('common.off') : t('common.on'), value: 'toggle', }, - { content: t('mcpSettings.actions.test'), value: 'test' }, { content: t('common.edit'), value: 'edit' }, { content: t('common.delete'), value: 'delete', theme: 'error' as const } ] } -// Builtin: 仅测试 (Admin+ only as well — testing a builtin still hits -// the same /test endpoint that requires Admin+ role). +// Builtin: 仅编辑(同样 Admin+ only)。内置服务测试也通过抽屉的 footer 触发, +// 不再在外层菜单露出"测试连接"项。 const getBuiltinServiceOptions = () => { if (!authStore.hasRole('admin')) { return [] } return [ - { content: t('mcpSettings.actions.test'), value: 'test' } + { content: t('common.edit'), value: 'edit' } ] } -// Handle menu action +// Drawer 内点击"测试连接"后,复用现有的 testResult dialog 展示结果。 +// 抽屉只负责调 API + 拿结果,弹窗位置/状态由父组件统一管。 +const handleDrawerTest = ({ service, result }: { service: MCPService; result: MCPTestResult }) => { + testingServiceName.value = service.name + testingServiceId.value = service.id + testResult.value = result + testDialogVisible.value = true +} + +// Handle menu action. 'test' has been removed from the menu — testing now +// lives only in the editor drawer. We keep the switch's case list narrow +// so a stray 'test' from somewhere else falls through harmlessly. const handleMenuAction = (data: { value: string }, service: MCPService) => { - if (testing.value) return switch (data.value) { case 'toggle': // Flip the local model and reuse the toggle path so the API call, @@ -295,9 +258,6 @@ const handleMenuAction = (data: { value: string }, service: MCPService) => { service.enabled = !service.enabled handleToggleEnabled(service) break - case 'test': - handleTest(service) - break case 'edit': handleEdit(service) break diff --git a/frontend/src/views/settings/ModelSettings.vue b/frontend/src/views/settings/ModelSettings.vue index 8a51b2f5..299c048c 100644 --- a/frontend/src/views/settings/ModelSettings.vue +++ b/frontend/src/views/settings/ModelSettings.vue @@ -42,9 +42,9 @@
+
-

{{ modelDisplayName(model) }}

- - {{ $t('modelSettings.builtinTag') }} +

{{ modelDisplayName(model) }}

+ +
-
- {{ typeLabel(model._modelType) }} - · - - {{ model.source === 'local' ? 'Ollama' : sourceLabel(model._modelType) }} + + +
+ + {{ identityText(model) }} +
+ + +
+ + {{ typeLabel(model._modelType) }} + + + {{ vendorLabel(model) }} + + + {{ model.dimension }} dim + + + - -
-
- {{ $t('modelSettings.rawModelName') }}: {{ model.name }} -
-
- {{ model.baseUrl }} -
-
- Ollama local
@@ -130,7 +172,7 @@ import { useConfirmDelete } from '@/components/settings/useConfirmDelete' import { listModels, createModel, updateModel as updateModelAPI, deleteModel as deleteModelAPI, type ModelConfig } from '@/api/model' import { useAuthStore } from '@/stores/auth' -const { t } = useI18n() +const { t, te } = useI18n() const authStore = useAuthStore() const confirmDelete = useConfirmDelete() @@ -232,6 +274,88 @@ const sourceLabel = (type: ModelType) => { return t('modelSettings.source.remote') } +// Maps a backend `provider` id (e.g. "openai", "aliyun", "weknoracloud") +// to its localized short label. Reuses the same i18n keys the editor's +// provider dropdown uses, so the model card and the editor stay in sync +// when a provider is renamed. Falls back to '' when the backend didn't +// store a provider — caller falls back to sourceLabel(). +const providerLabel = (model: any): string => { + const id = model.provider + if (!id) return '' + const key = `model.editor.providers.${id}.label` + return te(key) ? t(key) : id +} + +// What the vendor chip on a card shows. Keeps the chip text uniformly +// short so cards line up: +// local → "Ollama" +// remote → provider's localized short name (e.g. "腾讯云 LKEAP", +// "阿里云 DashScope"). For the catch-all "generic" provider +// we render a single short word ("自定义" / "Custom") — the +// editor dropdown's longer "自定义 (OpenAI兼容接口)" label +// blows out the card chip row, and the "OpenAI 兼容" framing +// isn't meaningful to most end users (they didn't pick "I +// want OpenAI compatibility", they just pasted a base URL). +const vendorLabel = (model: any): string => { + if (model.source === 'local') return 'Ollama' + if (model.provider === 'generic') { + return t('modelSettings.source.custom') + } + return providerLabel(model) || sourceLabel(model._modelType) +} + +// Hover tooltip for the whole card — shows the long-form details we +// removed from the visible card body so they're still one mouseover +// away. baseUrl is the most useful for debugging "why is this model +// failing" scenarios. +const cardTooltip = (model: any): string => { + const lines: string[] = [] + if (model.displayName && model.displayName !== model.name) { + lines.push(`${t('modelSettings.rawModelName')}: ${model.name}`) + } + if (model.baseUrl) { + lines.push(model.baseUrl) + } else if (model.source === 'local') { + lines.push('Ollama (localhost)') + } + return lines.join('\n') +} + +// Whether the raw model identifier is worth showing on the card. We hide +// it when the user did NOT set a display name, because then the title is +// already the raw name and printing it again is just noise. +const rawNameVisible = (model: any): boolean => { + const displayName = typeof model.displayName === 'string' ? model.displayName.trim() : '' + return Boolean(displayName) && displayName !== model.name +} + +// What goes in the URL slot of the identity row. Local models intentionally +// return '' here — "ollama://localhost" is just noise on Ollama-only built-in +// cards. Only remote models with an explicit base URL get this row. +const urlText = (model: any): string => { + return model.baseUrl || '' +} + +// Single-line text shown in the identity row. Picks the more useful of +// the two (URL > raw name) — never crams both into one ellipsizing line +// because that produces double-end truncation that nobody can read. +const identityText = (model: any): string => { + return urlText(model) || (rawNameVisible(model) ? model.name : '') +} + +// Whether the identity row should render at all. +const identityVisible = (model: any): boolean => identityText(model).length > 0 + +// Identity-row tooltip — exposes BOTH name and URL when the user hovers, +// so the diagnostic info we hid from the visible row is still one mouse +// move away. +const identityTooltip = (model: any): string => { + const parts: string[] = [] + if (rawNameVisible(model)) parts.push(model.name) + if (urlText(model)) parts.push(urlText(model)) + return parts.join('\n') +} + const modelDisplayName = (model: any) => { const displayName = typeof model.displayName === 'string' ? model.displayName.trim() : '' return displayName || model.name @@ -612,12 +736,13 @@ onMounted(() => { gap: 12px; } -// 模型卡片 —— 左侧类型徽章 + 标题 / 副标题 / baseUrl 三段式 +// 模型卡片 —— 左侧类型徽章 + 标题 / identity / 元 chip 行(固定三行) .model-card { + position: relative; display: flex; align-items: flex-start; gap: 12px; - padding: 14px 14px 14px 12px; + padding: 12px 14px; border: 1px solid var(--td-component-stroke); border-radius: 10px; background: var(--td-bg-color-container); @@ -632,10 +757,6 @@ onMounted(() => { &--builtin { background: var(--td-bg-color-secondarycontainer); - .model-card__title { - color: var(--td-text-color-secondary); - } - &:hover { box-shadow: none; border-color: var(--td-component-stroke); @@ -688,6 +809,7 @@ onMounted(() => { min-width: 0; display: flex; flex-direction: column; + justify-content: center; gap: 4px; } @@ -711,15 +833,105 @@ onMounted(() => { white-space: nowrap; } -.model-card__pill { +/* + Generic chip used for: built-in tag, type chip, source chip, dimension, + vision flag. Same shape across all so the row reads as one consistent + rhythm of pills. Variants tweak color only. +*/ +.model-card__chip { flex-shrink: 0; - padding: 1px 6px; + display: inline-flex; + align-items: center; + gap: 3px; + padding: 1px 7px 1px 6px; + height: 20px; font-size: 11px; font-weight: 500; - line-height: 16px; - color: var(--td-warning-color-7, #B85C00); - background: var(--td-warning-color-1, #FEF3E6); - border-radius: 3px; + line-height: 18px; + color: var(--td-text-color-secondary); + background: var(--td-bg-color-component); + border-radius: 4px; + white-space: nowrap; + + .t-icon { + font-size: 12px; + flex-shrink: 0; + } +} + +/* + Built-in lock indicator. Most cards in a typical install ARE built-in, + so loud styling everywhere becomes noise — instead the lock is muted + and small by default, and lights up on hover. The signal that matters + to users is "which models did I add" → user-added cards stand out by + the absence of the lock. +*/ +.model-card__lock { + flex-shrink: 0; + display: inline-flex; + align-items: center; + justify-content: center; + width: 18px; + height: 18px; + color: var(--td-text-color-placeholder); + opacity: 0.6; + transition: color 0.15s ease, opacity 0.15s ease; + + .t-icon { + font-size: 13px; + } +} + +.model-card:hover .model-card__lock { + opacity: 1; + color: var(--td-text-color-secondary); +} + +/* + Icon-only chip variant. Drops horizontal padding to a tight square so the + chip reads as a status badge (vision flag) rather than a text pill that + happens to start with an icon. +*/ +.model-card__chip--icon-only { + padding: 0; + width: 20px; + justify-content: center; + + .t-icon { + font-size: 12px; + } +} + +/* Type chip in the meta row — slightly emphasized, picks up the type's + accent color so it links to the left badge. */ +.model-card__chip--type { + color: var(--td-text-color-primary); + font-weight: 500; +} + +.model-card--chat .model-card__chip--type { + color: #0052D9; + background: rgba(0, 82, 217, 0.08); +} + +.model-card--embedding .model-card__chip--type { + color: #6235BB; + background: rgba(98, 53, 187, 0.08); +} + +.model-card--rerank .model-card__chip--type { + color: #B85C00; + background: rgba(184, 92, 0, 0.08); +} + +.model-card--vllm .model-card__chip--type { + color: #C93E3E; + background: rgba(201, 62, 62, 0.08); +} + +.model-card--asr .model-card__chip--type { + color: #118053; + background: rgba(17, 128, 83, 0.08); } .model-card__more { @@ -742,50 +954,40 @@ onMounted(() => { opacity: 1; } -.model-card__subtitle { +.model-card__meta { display: flex; align-items: center; - flex-wrap: wrap; + flex-wrap: nowrap; gap: 4px; - font-size: 12px; - line-height: 1.4; - color: var(--td-text-color-secondary); min-width: 0; -} - -.model-card__raw-name { - font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; - font-size: 12px; - line-height: 1.4; - color: var(--td-text-color-placeholder); + // Truncate at the row level rather than within each chip — chips clip + // off-screen if the card narrows below the chip set's natural width + // (rare at 320px+ minmax but possible if grid recomputes). overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; } -.model-card__type { - font-weight: 500; - color: var(--td-text-color-secondary); -} - -.model-card__sep { - color: var(--td-text-color-placeholder); -} - -.model-card__url { +/* + Compact identity row: monospace one-liner showing whichever of + baseUrl / raw name is more useful (URL preferred). Conditionally + rendered — empty cards (most built-in ones) skip this row entirely + and grid auto-sizing handles the height. +*/ +.model-card__identity { + display: flex; + align-items: center; + min-width: 0; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 11px; line-height: 1.4; color: var(--td-text-color-placeholder); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - min-width: 0; } -.model-card__url--muted { - font-family: inherit; - font-style: italic; +.model-card__identity-text { + flex: 1; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } .empty-state { diff --git a/frontend/src/views/settings/ParserEngineSettings.vue b/frontend/src/views/settings/ParserEngineSettings.vue index 74dc33c6..d799e261 100644 --- a/frontend/src/views/settings/ParserEngineSettings.vue +++ b/frontend/src/views/settings/ParserEngineSettings.vue @@ -92,81 +92,140 @@
- - + -
-
-

{{ getEngineDisplayDesc(currentEngine.Name, currentEngine.Description) }} - - {{ engineDocLabel(currentEngine.Name) }} - - -

-
+ + + + + + - -
-
- {{ $t('settings.parser.connected') }} - {{ $t('settings.parser.disconnected') }} - {{ docreaderTransport === 'http' ? 'HTTP' : 'gRPC' }} - {{ $t('settings.parser.currentAddr') }}: {{ docreaderAddrEnv }} +
+ +
+

{{ $t('settings.parser.supportedFileTypes', '支持文件类型') }}

+
+ + {{ ft }} +
-

- {{ $t('settings.parser.envVarHint') }} -

-
+ - - -
- {{ ft }} -
+ + + + + +
+

{{ $t('settings.parser.configSection', '配置') }}

- -
-

{{ $t('settings.parser.vlmServerUrlHint') }}

+

{{ $t('settings.parser.vlmServerUrlHint') }}

-
- {{ $t('settings.parser.formulaRecognition') }} - {{ $t('settings.parser.tableRecognition') }} - OCR +
+ +
+ {{ $t('settings.parser.formulaRecognition') }} + {{ $t('settings.parser.tableRecognition') }} + OCR +
-
+
-
+
+ + +
+

{{ $t('settings.parser.configSection', '配置') }}

- -
- + + > + +
@@ -228,12 +294,15 @@
-
- {{ $t('settings.parser.formulaRecognition') }} - {{ $t('settings.parser.tableRecognition') }} - OCR +
+ +
+ {{ $t('settings.parser.formulaRecognition') }} + {{ $t('settings.parser.tableRecognition') }} + OCR +
-
+
-
-
- -
- - {{ $t('settings.parser.testConnection', '测试连接') }} - - - {{ checkMessage || saveMessage }} - -
-
+
- - - +
@@ -270,6 +321,7 @@ import { ref, computed, onMounted, nextTick } from 'vue' import { useI18n } from 'vue-i18n' import { useUIStore } from '@/stores/ui' import { useAuthStore } from '@/stores/auth' +import SettingDrawer from '@/components/settings/SettingDrawer.vue' import { getParserEngines, getParserEngineConfig, @@ -335,6 +387,18 @@ const drawerTitle = computed(() => { return currentEngine.value ? getEngineDisplayName(currentEngine.value.Name) : '' }) +// SettingDrawer 头部图标走 #headerIcon 槽(首字母 monogram + per-engine +// 配色,与列表卡片完全一致),不再需要 t-icon name 兜底。 + +// Whether the footer test-connection button should appear. Engines without +// configurable fields and that aren't the builtin DocReader (whose connection +// status is the whole point of the drawer) skip the test affordance — for +// e.g. simple/markitdown there's nothing to validate beyond presence. +const needsTestButton = computed(() => { + if (!currentEngine.value) return false + return hasConfigFields(currentEngine.value.Name) || currentEngine.value.Name === 'builtin' +}) + /** 固定展示顺序,未列出的引擎排在末尾按名称排序 */ const ENGINE_ORDER: Record = { builtin: 0, @@ -755,69 +819,71 @@ onMounted(loadAll) overflow: hidden; } -// ---- 抽屉内容 ---- -.drawer-content { - display: flex; - flex-direction: column; - gap: 20px; +// ---- 抽屉内容 — 与 ModelEditorDialog 同款约定 ---- +// .form-item / .form-label / .form-desc / .weknoracloud-hint / .api-test +// 参照 frontend/src/components/ModelEditorDialog.vue 的命名与字号/间距 +.form-item { + margin-bottom: 0; } -.engine-info-block { - .engine-desc { - font-size: 13px; - color: var(--td-text-color-secondary); - margin: 0 0 8px 0; - line-height: 1.5; +.form-label { + display: block; + margin-bottom: 6px; + font-size: 13px; + font-weight: 500; + color: var(--td-text-color-primary); + line-height: 1.4; + + // 与 ModelEditorDialog 一致:必填星号前置 + &.required::before { + content: '*'; + color: var(--td-error-color); + margin-right: 4px; + font-weight: 500; + line-height: 1; } } -// 输入框样式 +.form-desc { + margin: 4px 0 0 0; + font-size: 12px; + line-height: 1.5; + color: var(--td-text-color-placeholder); +} + +// 输入框统一字号 :deep(.t-input), -:deep(.t-select) { +:deep(.t-select), +:deep(.t-textarea), +:deep(.t-input-number) { width: 100%; font-size: 13px; +} - .t-input__inner, - .t-input__wrap, - input { +:deep(.t-checkbox) { + font-size: 13px; + + .t-checkbox__label { font-size: 13px; - border-radius: 6px; - border-color: var(--td-component-stroke); - transition: all 0.15s ease; - } - - &:hover .t-input__inner, - &:hover .t-input__wrap, - &:hover input { - border-color: var(--td-component-stroke); - } - - &.t-is-focused .t-input__inner, - &.t-is-focused .t-input__wrap, - &.t-is-focused input { - border-color: var(--td-brand-color); - box-shadow: 0 0 0 2px rgba(7, 192, 95, 0.1); + color: var(--td-text-color-primary); } } -// ---- DocReader 连接信息 ---- -.docreader-inline { - padding: 12px 16px; - background: var(--td-bg-color-secondarycontainer); +// ---- DocReader 连接信息(builtin 引擎) ---- +.docreader-block { + display: flex; + flex-direction: column; + gap: 8px; + padding: 12px 14px; + background: var(--td-bg-color-container-hover); + border: 1px solid var(--td-component-stroke); border-radius: 8px; - .status-line { - margin-bottom: 8px; + .form-desc { + margin-top: 0; } } -.docreader-desc { - margin: 0; - font-size: 12px; - color: var(--td-text-color-placeholder); - line-height: 1.6; -} - .status-line { display: flex; align-items: center; @@ -828,152 +894,200 @@ onMounted(loadAll) .env-hint { font-size: 12px; color: var(--td-text-color-placeholder); + font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; } -// ---- 文件类型标签 ---- +// ---- 文件类型 chip ---- .file-types { display: flex; flex-wrap: wrap; gap: 6px; } -// ---- 配置表单 ---- -.engine-form { - display: flex; - flex-direction: column; - gap: 0; -} - -.form-item { - margin-bottom: 20px; - - &:last-child { - margin-bottom: 0; - } -} - -.form-label { - display: block; - margin-bottom: 8px; - font-size: 14px; +.file-type-chip { + display: inline-flex; + align-items: center; + height: 22px; + padding: 0 8px; + font-size: 11px; font-weight: 500; + color: var(--td-text-color-secondary); + background: var(--td-bg-color-component); + border-radius: 4px; + font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; + letter-spacing: 0.02em; +} + +// ---- Inline alert(替代之前的 .weknoracloud-hint 卡片) ---- +// 一行内表达 "状态信号 + 一句话 + 跳转 link",无外框/无 3px 左边, +// 视觉重量与一行文字相当,section 内不会再被一个独立卡片打断。 +.inline-alert { + display: flex; + align-items: center; + gap: 8px; + font-size: 13px; + line-height: 1.5; + color: var(--td-text-color-secondary); + flex-wrap: wrap; +} + +.inline-alert__icon { + font-size: 15px; + flex-shrink: 0; + color: var(--td-text-color-placeholder); +} + +.inline-alert--ok .inline-alert__icon { + color: var(--td-success-color); +} + +.inline-alert--warn { color: var(--td-text-color-primary); - &.required::after { - content: '*'; - color: var(--td-error-color); - margin-left: 4px; - font-weight: 600; + .inline-alert__icon { + color: var(--td-warning-color, #f97316); } } -.form-hint { - margin: 4px 0 0 0; - font-size: 12px; - color: var(--td-text-color-placeholder); - line-height: 1.5; +.inline-alert__text { + flex: 1 1 auto; + min-width: 0; } +// 行尾 link:跟普通 doc-link 一致的主题色,但更紧凑,行内排版 +.inline-alert__action { + display: inline-flex; + align-items: center; + gap: 2px; + font-size: 13px; + font-weight: 500; + color: var(--td-brand-color); + cursor: pointer; + white-space: nowrap; + transition: color 0.15s ease; + + &:hover { + color: var(--td-brand-color-active); + } + + .t-icon { + font-size: 14px; + } +} + +@keyframes spin { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } +} + +.spinning { + animation: spin 1s linear infinite; +} + +// ---- 表单切换组(公式/表格/OCR) ---- .form-toggles { display: flex; flex-wrap: wrap; gap: 16px; - margin-bottom: 20px; + padding: 8px 0 0; } -// ---- WeKnoraCloud 凭证状态 ---- -.wkc-status { - display: flex; - align-items: flex-start; - gap: 8px; - padding: 12px 16px; - border-radius: 6px; - font-size: 13px; - color: var(--td-text-color-secondary); - background: var(--td-bg-color-secondarycontainer); +// ---- footer-left 测试连接消息(与 ModelEditorDialog 同款) ---- +.footer-test-message { + font-size: 12px; + line-height: 1.4; + flex: 1; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; - &--ok { - background: var(--td-success-color-light); - border: 1px solid var(--td-success-color-focus); - color: var(--td-success-color); + &.success { + color: var(--td-brand-color-active); } - &--warn { - background: #fff7ed; - border: 1px solid #fed7aa; - border-left: 3px solid #f97316; + &.error { + color: var(--td-error-color); } } -.api-test-section { - display: flex; +.status-icon { + font-size: 16px; + flex-shrink: 0; + + &.available { + color: var(--td-brand-color); + } + + &.unavailable { + color: var(--td-error-color); + } +} + +// ---- 文档外链 ---- +.doc-link { + display: inline-flex; align-items: center; - gap: 12px; + gap: 4px; + font-size: 13px; + font-weight: 500; + color: var(--td-brand-color); + text-decoration: none; + transition: color 0.15s ease; - .test-message { - font-size: 13px; - line-height: 1.5; - flex: 1; - - &.success { - color: var(--td-brand-color-active); - } - - &.error { - color: var(--td-error-color); - } - - &.hint { - color: var(--td-text-color-secondary); - } + &:hover { + color: var(--td-brand-color-active); } - :deep(.t-button) { - min-width: 88px; - height: 32px; - font-size: 13px; - border-radius: 6px; - flex-shrink: 0; + .link-icon { + font-size: 14px; } - .status-icon { - font-size: 16px; - flex-shrink: 0; + // 副标题里的 inline 文档链接:与描述文字平铺一行,体量等同小字 + &--inline { + margin-left: 6px; + font-size: 12px; + font-weight: 500; + vertical-align: baseline; - &.available { - color: var(--td-brand-color); - } - - &.unavailable { - color: var(--td-error-color); + .link-icon { + font-size: 12px; } } } -.drawer-footer-actions { - display: flex; - justify-content: flex-end; - gap: 12px; - width: 100%; - - :deep(.t-button) { - min-width: 80px; - height: 36px; - font-weight: 500; - font-size: 14px; - border-radius: 6px; - transition: all 0.15s ease; - - &.t-button--variant-outline { - color: var(--td-text-color-secondary); - border-color: var(--td-component-stroke); - - &:hover { - border-color: var(--td-brand-color); - color: var(--td-brand-color); - background: rgba(7, 192, 95, 0.04); - } - } - } +// ---- Header 图标的首字母 monogram(per-engine 配色见非 scoped 块)---- +.header-icon__text { + font-size: 15px; + font-weight: 600; + letter-spacing: 0.02em; +} + + + + diff --git a/frontend/src/views/settings/StorageEngineSettings.vue b/frontend/src/views/settings/StorageEngineSettings.vue index 7f608dc0..1a0a63c5 100644 --- a/frontend/src/views/settings/StorageEngineSettings.vue +++ b/frontend/src/views/settings/StorageEngineSettings.vue @@ -98,19 +98,89 @@
- + -
+ + + + + + + + + +
+ + + + + + + + - -
- -
- - {{ $t('settings.storage.testConnection') }} - - - {{ currentCheckState.result.message }} - -
-
- - - +
@@ -505,6 +533,7 @@ import { } from '@/api/system' import { useAuthStore } from '@/stores/auth' import { providerLogo } from './providerLogos' +import SettingDrawer from '@/components/settings/SettingDrawer.vue' const { t } = useI18n() const authStore = useAuthStore() @@ -622,6 +651,72 @@ const drawerTitle = computed(() => { return titles[currentEngine.value] || currentEngine.value }) +// SettingDrawer 头部图标 — 走列表卡片同款 logo(color / mono / fallback)。 +// providerLogo 已经处理了 storage 域内每个 id 的 logo URL + 模式。 +const currentLogo = computed(() => { + if (!currentEngine.value) return null + return providerLogo('storage', currentEngine.value as StorageProviderId) +}) + +// Inline style for the mono mask span. We expose it as a computed instead +// of inlining the literal in the template because Vue's template parser +// chokes on the nested-quote pattern (template-literal inside an object +// literal inside a v-bind expression). +const monoLogoStyle = computed((): Record => { + const logo = currentLogo.value + if (!logo || logo.mode !== 'mono') return {} + return { '--logo-url': `url("${logo.url}")` } +}) + +// 引擎描述(副标题主体文本)。 +const engineDescText = computed((): string => { + if (!currentEngine.value) return '' + const key = `settings.storage.${currentEngine.value}Desc` + const translated = t(key) + return translated !== key ? translated : '' +}) + +// 控制台 / 文档外链 — 副标题尾部 inline 显示,与 ParserEngineSettings +// 同款。各 provider 的 console / docs 链接来自原模板里的硬编码地址。 +const ENGINE_LINK_TABLE: Record = { + cos: { + console: 'https://console.cloud.tencent.com/cos', + docs: 'https://cloud.tencent.com/document/product/436', + }, + tos: { + console: 'https://console.volcengine.com/tos', + docs: 'https://www.volcengine.com/docs/6349', + }, + s3: { + console: 'https://aws.amazon.com/s3/', + docs: 'https://docs.aws.amazon.com/s3/', + }, + oss: { + console: 'https://oss.console.aliyun.com/', + docs: 'https://help.aliyun.com/zh/oss/', + }, + obs: { + console: 'https://obs.huaweicloud.com/', + docs: 'https://support.huaweicloud.com/obs/', + }, +} + +const engineLinks = computed((): Array<{ label: string; url: string }> => { + if (!currentEngine.value) return [] + const links = ENGINE_LINK_TABLE[currentEngine.value] + if (!links) return [] + const result: Array<{ label: string; url: string }> = [] + if (links.console) result.push({ label: t('settings.storage.console'), url: links.console }) + if (links.docs) result.push({ label: t('settings.storage.docs'), url: links.docs }) + return result +}) + +// 是否在 footer 显示"测试连接"按钮 — 本地直接读写文件系统,无连接概念, +// 跳过;其余 provider 都需要远程 endpoint,必须能测。 +const needsTestButton = computed(() => { + return !!currentEngine.value && currentEngine.value !== 'local' +}) + const minioAvailable = computed(() => { if (config.value.minio?.mode === 'remote') { return !!(config.value.minio.endpoint && config.value.minio.access_key_id && config.value.minio.secret_access_key) @@ -1288,214 +1383,235 @@ onMounted(loadAll) overflow: hidden; } -.drawer-content { - display: flex; - flex-direction: column; - gap: 20px; +// ---- 抽屉内容 — 与 ModelEditorDialog 同款约定 ---- + +// color logo 容器内部的图片 +.header-icon__img { + width: 24px; + height: 24px; + object-fit: contain; + display: block; } -.engine-info-block { - .engine-desc { - font-size: 13px; - color: var(--td-text-color-secondary); - margin: 0 0 8px 0; - line-height: 1.5; - } +// mono logo(用 mask-image 渲染,颜色由 currentColor 决定) +.header-icon__mono { + display: inline-block; + width: 22px; + height: 22px; + background-color: currentColor; + -webkit-mask-image: var(--logo-url); + -webkit-mask-position: center; + -webkit-mask-repeat: no-repeat; + -webkit-mask-size: contain; + mask-image: var(--logo-url); + mask-position: center; + mask-repeat: no-repeat; + mask-size: contain; } -:deep(.t-input), -:deep(.t-select) { - width: 100%; - font-size: 13px; - - .t-input__inner, - .t-input__wrap, - input { - font-size: 13px; - border-radius: 6px; - border-color: var(--td-component-stroke); - transition: all 0.15s ease; - } - - &:hover .t-input__inner, - &:hover .t-input__wrap, - &:hover input { - border-color: var(--td-component-stroke); - } - - &.t-is-focused .t-input__inner, - &.t-is-focused .t-input__wrap, - &.t-is-focused input { - border-color: var(--td-brand-color); - box-shadow: 0 0 0 2px rgba(7, 192, 95, 0.1); - } -} - -.engine-info-block .doc-link { - margin-left: 4px; - font-size: 13px; -} - -.engine-form { - display: flex; - flex-direction: column; - gap: 0; +// fallback:首字母 monogram +.header-icon__text { + font-size: 15px; + font-weight: 600; + letter-spacing: 0.02em; } .form-item { - margin-bottom: 20px; - - &:last-child { - margin-bottom: 0; - } + margin-bottom: 0; } .form-label { display: block; - margin-bottom: 8px; - font-size: 14px; + margin-bottom: 6px; + font-size: 13px; font-weight: 500; color: var(--td-text-color-primary); + line-height: 1.4; - &.required::after { + // 必填星号前置(与 ModelEditorDialog 一致) + &.required::before { content: '*'; color: var(--td-error-color); - margin-left: 4px; - font-weight: 600; + margin-right: 4px; + font-weight: 500; + line-height: 1; } } -.form-item--inline { - display: flex; +.form-desc { + margin: 4px 0 0 0; + font-size: 12px; + line-height: 1.5; + color: var(--td-text-color-placeholder); + + &--inline { + margin: 0; + } +} + +:deep(.t-input), +:deep(.t-select), +:deep(.t-textarea), +:deep(.t-input-number) { + width: 100%; + font-size: 13px; +} + +// ---- MinIO 部署模式:紧凑 pill segmented(与 ModelEditorDialog 来源切换同款)---- +.source-options { + display: inline-flex; align-items: center; - gap: 12px; - margin-bottom: 20px; - - .form-label { - margin-bottom: 0; - flex-shrink: 0; - } + gap: 4px; + padding: 3px; + background: var(--td-bg-color-component); + border: 1px solid var(--td-component-stroke); + border-radius: 8px; } -.mode-selector { - display: flex; - gap: 8px; - margin-bottom: 20px; -} - -.mode-option { - display: flex; +.source-option { + display: inline-flex; align-items: center; gap: 6px; - padding: 8px 16px; - border: 1px solid var(--td-component-stroke); + padding: 5px 12px; + height: 28px; + background: transparent; + border: 1px solid transparent; border-radius: 6px; cursor: pointer; - transition: all 0.2s; - background: var(--td-bg-color-secondarycontainer); - - &:hover { - border-color: var(--td-text-color-disabled); - } - - &.active { - border-color: var(--td-brand-color); - background: rgba(7, 192, 95, 0.06); - } - - .mode-label { - font-size: 13px; - font-weight: 500; - color: var(--td-text-color-primary); - } -} - -.engine-hint { + font-family: inherit; font-size: 13px; color: var(--td-text-color-secondary); - line-height: 1.6; - padding: 10px 14px; - margin-bottom: 16px; - border-radius: 6px; - background: var(--td-bg-color-secondarycontainer); - border: 1px solid var(--td-component-stroke); + line-height: 1; + transition: all 0.15s ease; + + &:hover:not(.is-active) { + color: var(--td-text-color-primary); + background: var(--td-bg-color-container-hover); + } + + &.is-active { + background: var(--td-bg-color-container); + border-color: var(--td-brand-color); + color: var(--td-brand-color); + font-weight: 500; + box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); + } +} + +.source-option__icon { + font-size: 14px; + flex-shrink: 0; +} + +.source-option__label { + white-space: nowrap; +} + +// ---- inline-alert(与 ParserEngineSettings 同款,瘦身的状态行) ---- +.inline-alert { + display: flex; + align-items: center; + gap: 8px; + margin-top: 10px; + font-size: 13px; + line-height: 1.5; + color: var(--td-text-color-secondary); + flex-wrap: wrap; +} + +.inline-alert__icon { + font-size: 15px; + flex-shrink: 0; + color: var(--td-text-color-placeholder); +} + +.inline-alert--ok .inline-alert__icon { + color: var(--td-success-color); +} + +.inline-alert--warn { + color: var(--td-text-color-primary); + + .inline-alert__icon { + color: var(--td-warning-color, #f97316); + } +} + +.inline-alert__text { + flex: 1 1 auto; + min-width: 0; +} + +// ---- vision-toggle(switch + 行内描述)---- +.vision-toggle { + display: flex; + align-items: center; + gap: 8px; +} + +// ---- footer-left 测试连接消息(与 ModelEditorDialog 同款) ---- +.footer-test-message { + font-size: 12px; + line-height: 1.4; + flex: 1; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; &.success { - color: var(--td-text-color-primary); - background: var(--td-success-color-light); - border-color: var(--td-success-color-focus); + color: var(--td-brand-color-active); } - &.warning { - color: var(--td-text-color-primary); - background: var(--td-warning-color-light); - border-color: var(--td-warning-color-focus); + &.error { + color: var(--td-error-color); + } + + &.created { + color: var(--td-warning-color, #f97316); } } -.drawer-actions { - display: flex; +.status-icon { + font-size: 16px; + flex-shrink: 0; + + &.available { + color: var(--td-brand-color); + } + + &.unavailable { + color: var(--td-error-color); + } +} + +// ---- 文档外链 ---- +.doc-link { + display: inline-flex; align-items: center; - margin-top: 16px; - padding-top: 16px; - border-top: 1px dashed var(--td-component-stroke); -} + gap: 4px; + font-size: 13px; + font-weight: 500; + color: var(--td-brand-color); + text-decoration: none; + transition: color 0.15s ease; -.api-test-section { - display: flex; - align-items: center; - gap: 12px; - - .test-message { - font-size: 13px; - line-height: 1.5; - flex: 1; - - &.success { - color: var(--td-brand-color-active); - } - - &.error { - color: var(--td-error-color); - } - - &.created { - color: var(--td-warning-color); - } + &:hover { + color: var(--td-brand-color-active); } - :deep(.t-button) { - min-width: 88px; - height: 32px; - font-size: 13px; - border-radius: 6px; - flex-shrink: 0; - } -} - -.drawer-footer-actions { - display: flex; - justify-content: flex-end; - gap: 12px; - width: 100%; - - :deep(.t-button) { - min-width: 80px; - height: 36px; - font-weight: 500; + .link-icon { font-size: 14px; - border-radius: 6px; - transition: all 0.15s ease; + } - &.t-button--variant-outline { - color: var(--td-text-color-secondary); - border-color: var(--td-component-stroke); + &--inline { + margin-left: 6px; + font-size: 12px; + font-weight: 500; + vertical-align: baseline; - &:hover { - border-color: var(--td-brand-color); - color: var(--td-brand-color); - background: rgba(7, 192, 95, 0.04); - } + .link-icon { + font-size: 12px; } } } @@ -1512,3 +1628,59 @@ onMounted(loadAll) } } + + + diff --git a/frontend/src/views/settings/TenantInfo.vue b/frontend/src/views/settings/TenantInfo.vue index 20bb0e16..579d7d12 100644 --- a/frontend/src/views/settings/TenantInfo.vue +++ b/frontend/src/views/settings/TenantInfo.vue @@ -176,8 +176,9 @@
{{ getUsagePercentage() }}% + + :status="getUsagePercentage() > 80 ? 'warning' : 'success'" style="flex: 1;" />
diff --git a/frontend/src/views/settings/VectorStoreSettings.vue b/frontend/src/views/settings/VectorStoreSettings.vue index 88774ecd..64e27096 100644 --- a/frontend/src/views/settings/VectorStoreSettings.vue +++ b/frontend/src/views/settings/VectorStoreSettings.vue @@ -54,15 +54,12 @@ {{ t('vectorStoreSettings.envTag') }} - - + - - + -
- - @@ -131,14 +195,16 @@
-
- + - -
- - + + +