WeKnora/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue

2322 lines
86 KiB
Vue
Raw Normal View History

<template>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<SettingsModalShell :visible="visible"
:title="editorMode === 'create' ? $t('knowledgeEditor.titleCreate') : $t('knowledgeEditor.titleEdit')"
v-model="currentSection" :nav-groups="navGroups" :loading="loading" :z-index="1000"
nav-guide="kb-editor-sidebar" nav-item-guide-prefix="kb-editor-nav" @close="modalShell.requestClose">
<div class="content-wrapper">
<!-- 基本信息 -->
<div v-show="currentSection === 'basic'" class="section">
<div v-if="formData" class="section-content">
<div class="section-header">
<h3 class="section-title">{{ $t('knowledgeEditor.basic.title') }}</h3>
<p class="section-desc">{{ $t('knowledgeEditor.basic.description') }}</p>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<div class="section-body">
<div v-if="editorMode === 'edit' && activeKbId" class="form-item">
<label class="form-label">{{ $t('knowledgeEditor.basic.kbId') }}</label>
<p class="form-tip">{{ isPostCreateSession ? $t('knowledgeEditor.postCreateHint.followUpDesc') : $t('knowledgeEditor.basic.kbIdDesc') }}</p>
<div class="kb-id-field">
<code class="kb-id-value" :title="activeKbId">{{ activeKbId }}</code>
<t-tooltip :content="$t('common.copy')" placement="top">
<t-button theme="default" size="small" variant="text" class="kb-id-copy"
@click="copyKbId">
<t-icon name="file-copy" />
</t-button>
</t-tooltip>
</div>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<div class="form-item">
<label class="form-label required">{{ $t('knowledgeEditor.basic.typeLabel') }}</label>
<t-radio-group
v-model="formData.type"
:disabled="editorMode === 'edit'"
data-guide="kb-create-type"
>
<t-radio-button value="document">{{ $t('knowledgeEditor.basic.typeDocument') }}</t-radio-button>
<t-radio-button value="faq">{{ $t('knowledgeEditor.basic.typeFAQ') }}</t-radio-button>
</t-radio-group>
<p class="form-tip">{{ $t('knowledgeEditor.basic.typeDescription') }}</p>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- 索引策略 (紧跟类型选择) -->
<div v-if="!isFAQ" class="form-item">
<label class="form-label required">{{ $t('knowledgeEditor.indexing.title') }}</label>
<p class="form-tip">{{ $t('knowledgeEditor.indexing.description') }}</p>
<div class="indexing-checks" :class="{ 'is-locked': isIndexingLocked }"
data-guide="kb-create-indexing">
<div
class="indexing-check-item"
:class="{ 'is-checked': formData.indexingStrategy.vectorEnabled, 'is-disabled': isIndexingLocked }"
@click="toggleVectorIndexing"
>
<t-checkbox
:checked="formData.indexingStrategy.vectorEnabled"
:disabled="isIndexingLocked"
class="indexing-check-box"
>{{ $t('knowledgeEditor.indexing.searchTitle') }}</t-checkbox>
<p class="indexing-check-desc">{{ $t('knowledgeEditor.indexing.searchDesc') }}</p>
</div>
<div
class="indexing-check-item"
:class="{ 'is-checked': formData.indexingStrategy.wikiEnabled, 'is-disabled': isIndexingLocked }"
@click="toggleWikiIndexing"
>
<t-checkbox
:checked="formData.indexingStrategy.wikiEnabled"
:disabled="isIndexingLocked"
class="indexing-check-box"
>
<span class="indexing-check-title">
{{ $t('knowledgeEditor.indexing.wikiTitle') }}
<span class="indexing-new-badge">NEW</span>
</span>
</t-checkbox>
<p class="indexing-check-desc">{{ $t('knowledgeEditor.indexing.wikiDesc') }}</p>
</div>
</div>
<p v-if="isIndexingLocked" class="form-tip locked-tip">
{{ $t('knowledgeEditor.indexing.lockedTip') }}
</p>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- Wiki 提取粒度 (仅当 Wiki 启用时显示) -->
<div v-if="!isFAQ && formData.indexingStrategy.wikiEnabled" class="form-item">
<label class="form-label">{{ $t('knowledgeEditor.wiki.extractionGranularityLabel') }}</label>
<p class="form-tip">{{ $t('knowledgeEditor.wiki.extractionGranularityTip') }}</p>
<t-radio-group
:value="resolvedGranularity"
class="granularity-radio-group"
@change="handleGranularityChange"
>
<t-radio-button value="focused">
{{ $t('knowledgeEditor.wiki.granularityFocused') }}
</t-radio-button>
<t-radio-button value="standard">
{{ $t('knowledgeEditor.wiki.granularityStandard') }}
</t-radio-button>
<t-radio-button value="exhaustive">
{{ $t('knowledgeEditor.wiki.granularityExhaustive') }}
</t-radio-button>
</t-radio-group>
<p class="form-tip granularity-hint">{{ granularityHint }}</p>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<div v-if="!isFAQ && formData.indexingStrategy.wikiEnabled" class="form-item">
<label class="form-label">{{ $t('knowledgeEditor.wiki.contentInstructionsLabel') }}</label>
<p class="form-tip">{{ $t('knowledgeEditor.wiki.contentInstructionsTip') }}</p>
<t-textarea
v-model="formData.wikiConfig.contentInstructions"
:placeholder="$t('knowledgeEditor.wiki.contentInstructionsPlaceholder')"
:maxlength="4000"
:autosize="{ minRows: 3, maxRows: 8 }"
/>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<div v-if="!isFAQ && formData.indexingStrategy.wikiEnabled" class="form-item">
<label class="form-label">{{ $t('knowledgeEditor.wiki.extractionInstructionsLabel') }}</label>
<p class="form-tip">{{ $t('knowledgeEditor.wiki.extractionInstructionsTip') }}</p>
<t-textarea
v-model="formData.wikiConfig.extractionInstructions"
:placeholder="$t('knowledgeEditor.wiki.extractionInstructionsPlaceholder')"
:maxlength="4000"
:autosize="{ minRows: 3, maxRows: 8 }"
/>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<div class="form-item" data-guide="kb-create-name">
<label class="form-label required">{{ $t('knowledgeEditor.basic.nameLabel') }}</label>
<t-input
v-model="formData.name"
:placeholder="$t('knowledgeEditor.basic.namePlaceholder')"
:maxlength="50"
/>
</div>
<div class="form-item">
<label class="form-label">{{ $t('knowledgeEditor.basic.descriptionLabel') }}</label>
<t-textarea
v-model="formData.description"
:placeholder="$t('knowledgeEditor.basic.descriptionPlaceholder')"
:maxlength="200"
:autosize="{ minRows: 3, maxRows: 6 }"
/>
</div>
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
<!-- AI 生成的知识库描述(仅编辑模式、文档型知识库) -->
<div v-if="editorMode === 'edit' && !isFAQ" class="form-item">
<label class="form-label">{{ $t('knowledgeEditor.basic.profile.title') }}</label>
<p class="form-tip">{{ $t('knowledgeEditor.basic.profile.hint') }}</p>
<div class="kb-profile-card">
<template v-if="generatedProfileHasText">
<p v-if="generatedProfile?.gist" class="kb-profile-gist">{{ generatedProfile.gist }}</p>
<div v-if="generatedProfile?.topics?.length" class="kb-profile-topics">
<t-tag
v-for="topic in generatedProfile.topics"
:key="topic"
size="small"
variant="light"
>{{ topic }}</t-tag>
</div>
<div v-if="generatedProfile?.typical_questions?.length" class="kb-profile-questions">
<p class="kb-profile-subtitle">{{ $t('knowledgeEditor.basic.profile.questions') }}</p>
<ul>
<li v-for="q in generatedProfile.typical_questions" :key="q">{{ q }}</li>
</ul>
</div>
</template>
<p v-else class="kb-profile-empty">
{{ generatedProfile?.status === 'empty'
? $t('knowledgeEditor.basic.profile.noDocuments')
: $t('knowledgeEditor.basic.profile.empty') }}
</p>
<p v-if="generatedProfile?.status === 'failed'" class="kb-profile-error">
{{ $t('knowledgeEditor.basic.profile.failed', { error: generatedProfile.error || '' }) }}
</p>
<p v-if="generatedProfileMeta" class="kb-profile-meta">{{ generatedProfileMeta }}</p>
<div class="kb-profile-actions">
<t-button
size="small"
theme="primary"
variant="outline"
:loading="generatingProfile"
@click="handleGenerateProfile"
>
{{ generatedProfileHasText
? $t('knowledgeEditor.basic.profile.regenerate')
: $t('knowledgeEditor.basic.profile.generate') }}
</t-button>
<t-button
v-if="generatedProfile?.gist"
size="small"
variant="text"
@click="handleAdoptProfileGist"
>
{{ $t('knowledgeEditor.basic.profile.adopt') }}
</t-button>
</div>
</div>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- Wiki 合成模型移至模型配置页 -->
</div>
</div>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- 模型配置 -->
<div v-show="currentSection === 'models'" class="section">
<KBModelConfig
ref="modelConfigRef"
v-if="formData"
:config="formData.modelConfig"
:has-files="hasFiles"
:wiki-enabled="formData.indexingStrategy?.wikiEnabled"
:rag-enabled="formData.indexingStrategy?.vectorEnabled || formData.indexingStrategy?.keywordEnabled"
:all-models="allModels"
@update:config="handleModelConfigUpdate"
/>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- VectorStore 绑定 -->
<div v-show="currentSection === 'vectorStore'" class="section">
<KBVectorStoreSettings
v-if="formData"
:mode="editorMode"
:vector-store-id="formData.vectorStoreId"
:bound-source="formData.vectorStoreInfo?.source"
:bound-name="formData.vectorStoreInfo?.name"
:bound-engine-type="formData.vectorStoreInfo?.engineType"
:bound-status="formData.vectorStoreInfo?.status"
@update:vector-store-id="handleVectorStoreIdUpdate"
/>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- FAQ 配置 -->
<div v-if="isFAQ && formData" v-show="currentSection === 'faq'" class="section">
<div class="section-content">
<div class="section-header">
<h3 class="section-title">{{ $t('knowledgeEditor.faq.title') }}</h3>
<p class="section-desc">{{ $t('knowledgeEditor.faq.description') }}</p>
</div>
<div class="section-body">
<div class="form-item">
<label class="form-label required">{{ $t('knowledgeEditor.faq.indexModeLabel') }}</label>
<t-radio-group
v-model="formData.faqConfig.indexMode"
>
<t-radio-button value="question_only">{{ $t('knowledgeEditor.faq.modes.questionOnly') }}</t-radio-button>
<t-radio-button value="question_answer">{{ $t('knowledgeEditor.faq.modes.questionAnswer') }}</t-radio-button>
</t-radio-group>
<p class="form-tip">{{ $t('knowledgeEditor.faq.indexModeDescription') }}</p>
</div>
<div class="form-item">
<label class="form-label required">{{ $t('knowledgeEditor.faq.questionIndexModeLabel') }}</label>
<t-radio-group
v-model="formData.faqConfig.questionIndexMode"
>
<t-radio-button value="combined">{{ $t('knowledgeEditor.faq.modes.combined') }}</t-radio-button>
<t-radio-button value="separate">{{ $t('knowledgeEditor.faq.modes.separate') }}</t-radio-button>
</t-radio-group>
<p class="form-tip">{{ $t('knowledgeEditor.faq.questionIndexModeDescription') }}</p>
</div>
<div class="faq-guide">
<p>{{ $t('knowledgeEditor.faq.entryGuide') }}</p>
</div>
</div>
</div>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- 解析引擎 -->
<div v-if="!isFAQ && formData && currentSection === 'parser'" class="section">
<KBParserSettings
:parser-engine-rules="formData.chunkingConfig.parserEngineRules"
@update:parser-engine-rules="handleParserEngineRulesUpdate"
/>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- 存储引擎 -->
<div v-if="!isFAQ && formData && currentSection === 'storage'" class="section">
<KBStorageSettings
:storage-backend-id="formData.storageBackendId"
:storage-provider="formData.storageProvider"
:has-files="editorMode === 'edit' && hasFiles"
@update:storage-backend-id="handleStorageBackendUpdate"
@update:storage-provider="handleStorageProviderUpdate"
/>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- 分块设置 -->
<div v-if="!isFAQ" v-show="currentSection === 'chunking'" class="section">
<KBChunkingSettings
v-if="formData"
:config="formData.chunkingConfig"
@update:config="handleChunkingConfigUpdate"
/>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- 多模态配置 -->
<div v-if="!isFAQ" v-show="currentSection === 'multimodal'" class="section">
<div v-if="formData" class="kb-multimodal-settings">
<div class="section-header">
<h2>{{ $t('knowledgeEditor.multimodal.title') }}</h2>
<p class="section-description">{{ $t('knowledgeEditor.multimodal.description') }}</p>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<div class="settings-group">
<!-- 多模态开关 -->
<div class="setting-row" data-guide="kb-create-multimodal-toggle">
<div class="setting-info">
<label>{{ $t('knowledgeEditor.advanced.multimodal.label') }}</label>
<p class="desc">{{ $t('knowledgeEditor.advanced.multimodal.description') }}</p>
</div>
<div class="setting-control">
<t-switch
v-model="formData.multimodalConfig.enabled"
@change="handleMultimodalToggle"
size="medium"
/>
</div>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- VLLM 模型选择(多模态启用时) -->
<div v-if="formData.multimodalConfig.enabled" class="setting-row"
data-guide="kb-create-multimodal-vllm">
<div class="setting-info">
<label>{{ $t('knowledgeEditor.advanced.multimodal.vllmLabel') }} <span class="required">*</span></label>
<p class="desc">{{ $t('knowledgeEditor.advanced.multimodal.vllmDescription') }}</p>
</div>
<div class="setting-control">
<ModelSelector
model-type="VLLM"
:selected-model-id="formData.multimodalConfig.vllmModelId"
:all-models="allModels"
@update:selected-model-id="handleMultimodalVLLMChange"
@add-model="handleAddVLLMModel"
:placeholder="$t('knowledgeEditor.advanced.multimodal.vllmPlaceholder')"
/>
</div>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<div v-if="formData.multimodalConfig.enabled" class="setting-row">
<div class="setting-info">
<label>{{ $t('knowledgeEditor.advanced.multimodal.descriptionLanguageLabel') }}</label>
<p class="desc">{{ $t('knowledgeEditor.advanced.multimodal.descriptionLanguageDescription') }}</p>
</div>
<div class="setting-control">
<t-select v-model="formData.multimodalConfig.descriptionLanguage" clearable
:placeholder="$t('knowledgeEditor.advanced.multimodal.descriptionLanguageAuto')">
<t-option value="Chinese" :label="$t('language.zhCN')" />
<t-option value="English" :label="$t('language.enUS')" />
<t-option value="Korean" :label="$t('language.koKR')" />
<t-option value="Russian" :label="$t('language.ruRU')" />
</t-select>
</div>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<div v-if="formData.multimodalConfig.enabled" class="setting-row setting-row-vertical">
<div class="setting-info">
<label>{{ $t('knowledgeEditor.advanced.multimodal.customInstructionsLabel') }}</label>
<p class="desc">{{ $t('knowledgeEditor.advanced.multimodal.customInstructionsDescription') }}</p>
</div>
<div class="setting-control setting-control-full">
<t-textarea v-model="formData.multimodalConfig.customInstructions"
:placeholder="$t('knowledgeEditor.advanced.multimodal.customInstructionsPlaceholder')"
:maxlength="4000" :autosize="{ minRows: 3, maxRows: 8 }" />
</div>
</div>
feat(gallery): add an image gallery tab with schema-driven filters (#3694) * feat(image): observe image attributes and let the policy decide OCR Describe each image with the VLM as before, but ask it to also observe two attributes about the image in the same round — how much body text it carries (contain.text) and whether it presents data visually (contain.data_visual) — then let a small pure function decide whether that image is worth a second, separate OCR round. Per-class OCR was the first shape of this idea; a class (chart / photo / logo) is only an indirect proxy for 'is there text worth reading here', and the class table has to grow whenever a new kind of image shows up. The decision actually needs the observed attributes, so it reads them directly, and the attribute set is a backend registry row rather than a new class. The observation and the caption share one VLM call; OCR stays a separate call (prompt isolation, see #3291). An attribute the model does not answer for is left absent rather than filled with a conservative default, so the trace never claims an observation that did not happen, and an incomplete observation falls back to the on_unobserved policy (OCR still runs). The registry also carries the panel's display text, so a new attribute needs no frontend change. Off by default: image_attrs_enabled=false keeps today's behaviour (one caption and one OCR per image). KB config: image_processing_config.image_attrs_enabled / image_actions; per-upload override via process_config. Registry: GET /api/v1/image-attrs/schema. * feat(gallery): add image gallery tab with schema-driven filters Adds a 4th knowledge-base tab parallel to Documents/Wiki/Graph that browses every image asset in a KB. Backend: - GET /api/v1/knowledge-bases/:id/images lists image assets projected from chunks.image_info, with keyword (caption/OCR), multi-value attribute (attr_<name>=<value>), is_enabled and sort filters applied in memory, plus pagination. - Resolves the source knowledge item title (SourceName) via a batched GetKnowledgeBatch so the viewer can show a human-readable source. Frontend: - ImageGallery.vue: thumbnail grid + search/sort + schema-driven filter panel (from GET /image-attrs/schema) + single-image viewer with prev/next, attributes/caption/OCR/source. - Wired as the gallery tab in KnowledgeBase.vue; i18n keys in all 5 locales. * feat(gallery): drive filters/search/sort from a configurable attribute contract The gallery UI is no longer hardcoded: it renders from a self-describing contract served by GET /knowledge-bases/:id/gallery-config (live attribute sources, every attribute's definition with usage flags merged across the config tiers, and the caller's search activation state). - Attribute sources form an open registry (types.RegisterGalleryAttrSource); a builtin source models caption/ocr_text/timestamps/enabled so the gallery has zero special cases. - Usage resolution: user > KB > system > source, field by field; the system tier lives in system_settings (gallery.policy, JSON, no rebuild), the KB tier slot is wired in the engine but not stored yet. - Search activation is the user's own record: mode (all|custom) plus per-field on/off in users.preferences.gallery; source declarations never set defaults (unrecorded = off in custom mode). - image_info is read through a gallery-local struct, removing the compile dependency on the attribute-pipeline types; the gallery builds and runs with or without that feature deployed. - ListImages validates search_in / sort_by / attr_filters against the contract; ineligible fields are dropped, not served. * fix(frontend): inline the shared graph-drawer stylesheet (@import instead of <style src>) plugin-vue 6.0.6 keys unscoped src-style descriptors by the imported file path, so AgentStreamDisplay.vue and WikiBrowser.vue — both importing components/css/wiki-graph-drawer.less — overwrite each other during the build and the second one crashes with "reading 'scoped'". Adding the gallery changed the module order enough to make the collision hit every time. Inlining the same stylesheet keeps the emitted CSS identical and removes the shared descriptor key. * feat(gallery): render attributes from short labels with descriptions in tooltips A source could only say one thing about a value, so the filter panel had to put a full sentence inside a checkbox. Attributes and their values now carry two pieces of text: a short label for the space-constrained controls (checkbox, search field, sort option) and a description for wherever there is room (tooltip, detail panel). The contract's value list becomes an array of {value, label, description}, and the display helpers resolve each field separately: the gallery stamps the short name on a control and moves the sentence into a tooltip. Translation overlays are looked up per field, so a source that ships no gallery-specific text still picks up the attribute pipeline's own wording. * fix(gallery): let locale text win over the contract's wording The filter panel read the backend's own label before asking the locale, so a translated value never got a chance: the contract ships its own default-language wording, and it shadowed the overlay for every locale. Built keys were also off by a segment — imageAttr.<name> has to be imageAttr.<name>.label, and the gallery's own keys live under knowledgeEditor.wikiBrowser.gallery.attr — so builtin and system attributes fell through to English on a Chinese UI. * feat(gallery): top bar layout, pinned panels and per-value verdicts The toolbar moves onto its own row above the grid, so the controls no longer eat into the space the images are there for: search box, the two scope switches, sort field and direction, and the result count all sit in one flex row. The settings behind them are no longer inline either — each opens as a popover under its control and can be pinned to a right-hand rail, where the two panels take turns as tabs instead of both claiming width at once. Filtering gains a third state per attribute value. Where a value could only be picked or not picked, it can now be "off" (hide those images), "on" (show them whatever else says) or neutral (leave them alone), which is what lets one attribute's rules talk about an image another attribute tried to hide without the pair of them cancelling each other out: a forced display outranks a forced hide, and anything no rule speaks about stays visible. The switch that used to only exist inside the panel now has a toolbar home as well. "筛选:全显示" genuinely drops the attribute constraint instead of imposing it against a panel the user cannot see. Filtering used to empty the list the moment it was switched on. Any image whose attribute was never observed — every image ingested before the attribute pipeline existed — read as a mismatch for every filter, which is not narrowing a list but losing it. Absence now stays silence: an attribute no image carries places no constraint on it, until the pipeline catches up and fills the value in. Co-authored-by: WorkBuddy * feat(gallery): expose the image attribute pipeline as a gallery source The gallery's contract resolved to a single source, so the filter panel could only offer "Enabled" while the attributes the observe-and-describe pipeline fills in — contain.text, contain.data_visual — never reached the UI. The registry is a gallery attribute source like any other: every attribute it declares is offered to the gallery, filterable by default, with the config tiers able to override the usage flags at runtime. The registration lives in the attribute pipeline's own commit; this branch carried an earlier, squapshot of that work which predated the split of an attribute value into a short label and a description, so the registry's value shape and this file have been brought in line with it. Both PRs now hold byte-identical copies of the source hook, which is what lets either one land first and the other merge cleanly afterwards. Co-authored-by: WorkBuddy * fix(gallery): viewer race, pin icon, panel anchoring and scope wording Opening the viewer rendered the img element with the previous or empty source while the proxy fetch was still producing a blob, and the error that empty source fired locked the viewer in its failure state even after the real image arrived. The resolved source now lands before the flag is consulted, and a token keeps a slow fetch of one image from overwriting a faster one that navigated past it. The pin button drew nothing: TDesign has no "pushpin" glyph, so the button rendered as an empty shell. It now uses pin / pin-filled, keeps its place beside the tab bar, and a pinned rail assigns its columns explicitly — the panel precedes the main section in the DOM, so leaving the grid to source order handed the wide column to the panel and squeezed the images into the rail. The floating panel no longer appears at a hardcoded offset: it anchors just below the arrow that summoned it, the arrow flips up while its panel is out, a second press retracts, and any click elsewhere in the toolbar closes it. When a rail is pinned the arrows turn to the requested tab instead of spawning a second surface. The scope words (全部 / 全显示 / 自定义) become plain status text rather than a second dropdown — they name the current mode, and only the arrow beside them opens the panel that changes it. Co-authored-by: WorkBuddy * fix(web): align the OCR-on-unobserved switch with the other setting rows The switch sat bare inside its setting-row while every other switch on the page is wrapped in setting-control, which is what reserves the right column and centers the control vertically. With the row laid out from the top, the bare switch hugged the row's upper edge and crowded the description text — visibly out of place next to its neighbors. Wrapping it in setting-control gives it the same right-aligned, centered slot as the rest. Co-authored-by: WorkBuddy * fix(web): move the OCR-on-unobserved row out of the vertical schema row The row lived inside setting-row-vertical, whose descendant rule stretches every setting-info and setting-control beneath it to 100% width. Two full-width flex children side by side cannot fit, so the control overflowed the container and the switch landed past the right edge — visibly further out than the switch on the row above. The row and its note now sit beside the vertical block instead of inside it, under their own condition, so the switch shares the ordinary row layout and its right edge lines up with the "image attribute observation" switch above. Co-authored-by: WorkBuddy * fix(gallery): applying a verdict now activates the filter scope Setting an off/on verdict while the panel's master switch was off silently ignored it: buildParams only attaches attr_rules in custom scope, and setVerdict never flipped the scope. A verdict the user just expressed now switches the scope to custom; clearing the last meaningful verdict returns to all, since custom with no rules constrains nothing. * fix(gallery): search checkboxes stay visible and idle panels read as dimmed The search panel hid its field checkboxes while the master switch was on, so the only way to reach them was to flip the switch first. They now sit next to the switch like the filter panel's verdicts do: dimmed in all-field mode (where they carry no weight) yet clickable, and touching one drops the mode to custom. The filter panel's verdict rows dim the same way while the filter switch is off. * fix(gallery): bulk verdict row, neutral default mark, panel polish The clear-filters button never matched what the panel is for, so it is now a bulk verdict row: one set of -/off/on buttons that applies the chosen position to every value of every value-typed attribute, with the default mark turned into a language-neutral dash. The panel head drops its second divider (the tab bar already draws one) and the tabs follow the toolbar's order: search left, filter right. * fix(gallery): drop the all-fields caption and center the order arrow The caption above the search checkboxes showed and hid with the master switch, shoving the checkboxes down on every flip; it said nothing the dimmed state doesn't, so it is gone. The order button's arrow is an inline svg, which sits on the text baseline and reads as riding high; it now centers against the label. * fix(gallery): center the order arrow for real vertical-align never applied: the icon is a flex item inside the button's inline-flex text wrapper, and the wrapper's default stretch pins the explicitly-sized 16px icon to the top of the 22px line box. align-items: center on the wrapper is what actually centers it. * fix(gallery): shorten panel tab labels in en and ru The two-word labels overflowed the 300px panel and forced the tab bar into scroll arrows; single-word labels fit in every locale that was affected. * docs: drop the image pipeline rewrite from this branch The rewritten 'Go 侧接手后' paragraph belongs to the image attribute observation work (#3635), which this branch carries as a prerequisite and which already documents the caption_ocr / observation_driven split. Keeping a competing rewrite of the same paragraph on the gallery branch makes it collide with upstream, which extended that paragraph with the custom_instructions and inline HTML table notes. Restoring the shared wording keeps the gallery branch free of this file so upstream's edits merge cleanly. * style: gofmt the gallery attribute types Struct field tags in the resolved gallery config were one column narrow, so gofmt rebroke the alignment block. Whitespace only. * style(gallery): use design tokens in the gallery styles The style guard ratchet fails on any new violation. ImageGallery.vue shipped with 47 TDesign token fallbacks, 21 literal font sizes, 4 literal radii and a 0.15s transition; all of them now read the --app-* / --td-* tokens, which is what the guard asks for and what dark mode depends on. * lint(gallery): fix the golangci-lint findings in the gallery code lll: the three over-long swagger @Param lines and one registry row were shortened. ineffassign: ctx was assigned before the access check and then reassigned, so the first value was dead; it is now declared once, after the check. errcheck: the three unchecked c.Error calls in ListImages. revive: the AttrSpec / AttrValue doc comment block was attached to the wrong type and split into one block each. staticcheck S1016: the gallery registration converts the registry value instead of restating its fields. * lint(gallery): wrap the image query select and check the last c.Error * style: reformat the wrapped image select in chunk.go * fix(gallery): address review findings on ordering, KB switch and blob lifetime - sortImageAssets: swap operands for desc instead of negating, keeping a strict weak ordering so ties page stably - ImageGallery: reload on knowledgeBaseId change, drop stale list responses, fetch thumbnails in parallel with one cached blob per URL, revoke blobs on unmount, default sort to builtin:created_at - KnowledgeBase: non-wiki KBs with a stale wiki/graph tab fall back to documents again - handler: move ListImages godoc out of ListKnowledgeFolders' block and document attr_filters / attr_rules - DecideOCR: a payload with no OCR conditions uses the built-in policy instead of silently skipping OCR * docs(parsing): describe the caption_ocr and observation_driven image pipelines Carried over from #3635, which this PR supersedes. * fix(gallery): load local:// and other storage handles through the KB file proxy The gallery's own scheme check only caught resource://, provider:// and storage://, so local:// (the default storage), minio://, cos:// and s3:// images went straight into <img src> and never rendered. Resolve through isProviderFileURL, the scheme list chat and wiki already use, and lock the routing with a test. * fix(kb-editor): keep API-customised OCR conditions on save and upload The KB editor always wrote the registry default into image_actions.ocr.on, so any unrelated edit replaced a knowledge base's custom OCR conditions with the default table; the upload dialog did the same for the per-document override. Keep a stored custom list and fall back to the registry default only when there is none, and show the conditions actually in effect instead of the default table in both panels. * perf(gallery): de-duplicate, filter, sort and page images in SQL Every gallery request used to read every image-bearing chunk of the KB, OCR text included, decode it in Go and page in memory. A single query now expands the image_info arrays, keeps one row per image URL, applies the keyword / attribute / verdict / enabled filters and the sort, and returns only the page with the filtered total. The expansion carries narrow scalars only; filters and JSON sort keys are evaluated on the winning entry of each image, and the page's JSON is read back for its rows alone. Postgres runs the query with JIT off, since the fixed 100-rows-per-call estimate of jsonb_array_elements otherwise prices it ~100x high and compilation dominates. On 20k images with 2 KB of OCR text each (40k chunks), a page drops from ~750 ms to ~100-200 ms on postgres and ~200 ms on sqlite; keyword search over OCR text stays a full scan (~400-600 ms) until the text is indexed. The filter semantics are pinned against both databases. * perf(gallery): serve the gallery from a trigger-maintained chunk_images table Reading images out of chunks.image_info meant parsing every image chunk of the knowledge base on each request, so a page still cost time in proportion to the KB. chunk_images (versioned/000113, sqlite/000032) keeps one row per image_info entry with caption, OCR text and attributes as columns; triggers on chunks keep it in step with every write path, and the migration backfills existing chunks. Copies of one image stay separate rows and the query lists the copy on the most recently updated chunk through an indexed anti-join, so writes decide nothing and concurrent writers need no locking. On postgres, caption and OCR text get pg_trgm indexes when the extension is available. On 20k images with 2 KB of OCR text each (40k chunks): postgres first page 10 ms, page 500 41 ms, keyword 2 ms, filters 23 ms sqlite first page 3 ms, page 500 39 ms, keyword 147 ms, filters 51 ms down from ~100-600 ms. Writing those 40k image chunks costs 7.0 s instead of 1.3 s on postgres (1.9 s instead of 1.0 s on sqlite), mostly the trigram indexes; status and enable-flag updates patch rows in place. --------- Co-authored-by: tayadwx <tayadwx@users.noreply.github.com> Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 04:33:59 +00:00
<div v-if="formData.multimodalConfig.enabled" class="setting-row">
<div class="setting-info">
<label>{{ $t('knowledgeEditor.advanced.multimodal.imageAttrsLabel') }}</label>
<p class="desc">{{ $t('knowledgeEditor.advanced.multimodal.imageAttrsDescription') }}</p>
</div>
<t-switch v-model="formData.imageAttrsEnabled" size="medium" />
</div>
<div v-if="formData.multimodalConfig.enabled && formData.imageAttrsEnabled"
class="setting-row setting-row-vertical">
<div class="setting-info">
<label>{{ $t('knowledgeEditor.advanced.multimodal.imageAttrsSchemaLabel') }}</label>
<!-- 实现说明(不放 UI):面板完全由后端属性注册表驱动 —— 属性名、说明、每个取值的
含义都随 schema 端点下发,前端只按属性名覆盖翻译。所以新增属性仍是
「后端加一行 / 前端自动跟随」,属性集合随版本演进不需要改这里。 -->
<p class="desc">{{ $t('knowledgeEditor.advanced.multimodal.imageAttrsSchemaDescription') }}</p>
</div>
<div class="image-attr-panel">
<ul v-if="imageAttrDisplays.length" class="image-attr-list">
<li v-for="attr in imageAttrDisplays" :key="attr.name" class="image-attr-row">
<div class="image-attr-head">
<span class="image-attr-label">{{ attr.label }}</span>
<code class="image-attr-name">{{ attr.name }}</code>
</div>
<p v-if="attr.description" class="image-attr-desc">{{ attr.description }}</p>
<ul class="image-attr-value-list">
<li v-for="v in attr.values" :key="v.value" class="image-attr-value">
<code>{{ v.value }}</code>
<span class="image-attr-value-label">{{ v.label }}</span>
</li>
</ul>
</li>
</ul>
<div class="image-attr-section">
<div class="setting-info">
<label>{{ $t('knowledgeEditor.advanced.multimodal.imageAttrsOcrConditions') }}</label>
<p class="desc">{{ $t('knowledgeEditor.advanced.multimodal.imageAttrsOcrConditionsDesc') }}</p>
</div>
<ul class="image-attr-condition-list">
<li v-for="(cond, i) in imageAttrConditionDisplays" :key="i" class="image-attr-condition">
<span class="image-attr-condition-label">{{ cond.label }}</span>
<code class="image-attr-condition-raw">{{ cond.raw }}</code>
</li>
</ul>
</div>
</div>
<!-- 观察失败兜底:与上方整块开关同级(不再嵌在属性面板里)。
开关仍包在 setting-control 里,与其它开关行共用同一套
右对齐 / 垂直居中 / 预留右列的排版,避免顶到行首 -->
<div class="setting-row">
<div class="setting-info">
<label>{{ $t('knowledgeEditor.advanced.multimodal.imageAttrsOcrOnUnobserved') }}</label>
<p class="desc">{{ $t('knowledgeEditor.advanced.multimodal.imageAttrsOcrOnUnobservedDesc') }}</p>
</div>
<div class="setting-control">
<t-switch v-model="formData.imageActions.ocr.on_unobserved" size="medium" />
</div>
</div>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
</div>
</div>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- 音频处理(ASR)设置 -->
<div v-if="!isFAQ" v-show="currentSection === 'asr'" class="section">
<div v-if="formData" class="kb-multimodal-settings">
<div class="section-header">
<h2>{{ $t('knowledgeEditor.asr.title') }}</h2>
<p class="section-description">{{ $t('knowledgeEditor.asr.description') }}</p>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<div class="settings-group">
<!-- ASR 开关 -->
<div class="setting-row">
<div class="setting-info">
<label>{{ $t('knowledgeEditor.asr.label') }}</label>
<p class="desc">{{ $t('knowledgeEditor.asr.desc') }}</p>
</div>
<div class="setting-control">
<t-switch
v-model="formData.asrConfig.enabled"
size="medium"
/>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- ASR 模型选择 -->
<div v-if="formData.asrConfig.enabled" class="setting-row">
<div class="setting-info">
<label>{{ $t('knowledgeEditor.asr.modelLabel') }} <span class="required">*</span></label>
<p class="desc">{{ $t('knowledgeEditor.asr.modelDescription') }}</p>
</div>
<div class="setting-control">
<ModelSelector
model-type="ASR"
:selected-model-id="formData.asrConfig.modelId"
:all-models="allModels"
@update:selected-model-id="(val: string) => { if (formData) formData.asrConfig.modelId = val }"
@add-model="handleAddASRModel"
:placeholder="$t('knowledgeEditor.asr.modelPlaceholder')"
/>
</div>
</div>
</div>
</div>
</div>
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
<!-- 知识图谱 -->
<div v-if="!isFAQ && currentSection === 'graph'" class="section">
<GraphSettings
v-if="formData"
:graph-extract="formData.nodeExtractConfig"
:model-id="formData.modelConfig.llmModelId"
:all-models="allModels"
@update:graphExtract="handleNodeExtractUpdate"
/>
</div>
<!-- 高级设置 -->
<div v-if="!isFAQ" v-show="currentSection === 'advanced'" class="section">
<KBAdvancedSettings
ref="advancedSettingsRef"
v-if="formData"
:question-generation="formData.questionGenerationConfig"
:auto-tag="formData.autoTagConfig"
:profile-config="formData.profileConfig"
:rag-enabled="formData.indexingStrategy?.vectorEnabled || formData.indexingStrategy?.keywordEnabled"
:all-models="allModels"
:table-metadata-instructions="formData.chunkingConfig.tableMetadataInstructions"
@update:question-generation="handleQuestionGenerationUpdate"
@update:auto-tag="(value) => { if (formData) formData.autoTagConfig = value }"
@update:profile-config="(value) => { if (formData) formData.profileConfig = value }"
@update:table-metadata-instructions="(value: string) => { if (formData) formData.chunkingConfig.tableMetadataInstructions = value }"
/>
</div>
<!-- 数据源管理(仅编辑模式) -->
<div v-if="editorMode === 'edit' && activeKbId && currentSection === 'datasource'" class="section">
<DataSourceSettings :kb-id="activeKbId" @count="dsCount = $event" />
</div>
<!-- 共享设置(仅编辑模式) -->
<div v-if="editorMode === 'edit' && activeKbId && currentSection === 'share'" class="section">
<KBShareSettings :kb-id="activeKbId" :can-share="canShareKB" />
</div>
<!-- 活动记录(仅编辑模式,KB 所属租户内 Owner/Admin) -->
<div v-if="editorMode === 'edit' && activeKbId && canViewActivity && currentSection === 'activity'" class="section">
<KnowledgeBaseActivitySettings :kb-id="activeKbId" :active="currentSection === 'activity'" />
</div>
</div>
<template #footer-note>
<p v-if="isPostCreateSession" class="settings-footer-note">
<t-icon name="check-circle-filled" class="settings-footer-note__icon" />
<span>
<strong>{{ $t('knowledgeEditor.postCreateHint.title') }}</strong>
{{ $t('knowledgeEditor.postCreateHint.footer') }}
</span>
</p>
<p v-if="isInstantSection" class="settings-footer-note">
<t-icon name="info-circle-filled" class="settings-footer-note__icon" />
<span>{{ $t('knowledgeEditor.footer.instantEffect') }}</span>
</p>
</template>
<template #footer>
<t-button v-if="isInstantSection" theme="default" variant="outline" @click="modalShell.requestClose">
{{ $t('common.close') }}
</t-button>
<template v-else>
<t-button theme="default" variant="outline" @click="modalShell.requestClose">
{{ $t('common.cancel') }}
</t-button>
<t-button theme="primary" data-guide="kb-create-submit" @click="handleSubmit" :loading="saving"
:disabled="loading">
{{ saveButtonLabel }}
</t-button>
</template>
</template>
</SettingsModalShell>
<KbCreateContextualGuide :when="visible && editorMode === 'create'" :is-faq="isFAQ"
:needs-embedding="kbCreateNeedsEmbedding" />
</template>
<script setup lang="ts">
import { ref, computed, watch, onMounted, onBeforeUnmount } from 'vue'
import KbCreateContextualGuide from '@/components/KbCreateContextualGuide.vue'
import { KB_EDITOR_FOCUS_SECTION_EVENT, markContextualGuideDone } from '@/config/contextualGuides'
import { MessagePlugin, DialogPlugin } from 'tdesign-vue-next'
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
import { useModalShell } from '@/composables/useModalShell'
import SettingsModalShell from '@/components/SettingsModalShell.vue'
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
import {
createKnowledgeBase,
getKnowledgeBaseById,
listKnowledgeFiles,
updateKnowledgeBase,
rebuildKBIndex,
generateKnowledgeBaseProfile,
feat(gallery): add an image gallery tab with schema-driven filters (#3694) * feat(image): observe image attributes and let the policy decide OCR Describe each image with the VLM as before, but ask it to also observe two attributes about the image in the same round — how much body text it carries (contain.text) and whether it presents data visually (contain.data_visual) — then let a small pure function decide whether that image is worth a second, separate OCR round. Per-class OCR was the first shape of this idea; a class (chart / photo / logo) is only an indirect proxy for 'is there text worth reading here', and the class table has to grow whenever a new kind of image shows up. The decision actually needs the observed attributes, so it reads them directly, and the attribute set is a backend registry row rather than a new class. The observation and the caption share one VLM call; OCR stays a separate call (prompt isolation, see #3291). An attribute the model does not answer for is left absent rather than filled with a conservative default, so the trace never claims an observation that did not happen, and an incomplete observation falls back to the on_unobserved policy (OCR still runs). The registry also carries the panel's display text, so a new attribute needs no frontend change. Off by default: image_attrs_enabled=false keeps today's behaviour (one caption and one OCR per image). KB config: image_processing_config.image_attrs_enabled / image_actions; per-upload override via process_config. Registry: GET /api/v1/image-attrs/schema. * feat(gallery): add image gallery tab with schema-driven filters Adds a 4th knowledge-base tab parallel to Documents/Wiki/Graph that browses every image asset in a KB. Backend: - GET /api/v1/knowledge-bases/:id/images lists image assets projected from chunks.image_info, with keyword (caption/OCR), multi-value attribute (attr_<name>=<value>), is_enabled and sort filters applied in memory, plus pagination. - Resolves the source knowledge item title (SourceName) via a batched GetKnowledgeBatch so the viewer can show a human-readable source. Frontend: - ImageGallery.vue: thumbnail grid + search/sort + schema-driven filter panel (from GET /image-attrs/schema) + single-image viewer with prev/next, attributes/caption/OCR/source. - Wired as the gallery tab in KnowledgeBase.vue; i18n keys in all 5 locales. * feat(gallery): drive filters/search/sort from a configurable attribute contract The gallery UI is no longer hardcoded: it renders from a self-describing contract served by GET /knowledge-bases/:id/gallery-config (live attribute sources, every attribute's definition with usage flags merged across the config tiers, and the caller's search activation state). - Attribute sources form an open registry (types.RegisterGalleryAttrSource); a builtin source models caption/ocr_text/timestamps/enabled so the gallery has zero special cases. - Usage resolution: user > KB > system > source, field by field; the system tier lives in system_settings (gallery.policy, JSON, no rebuild), the KB tier slot is wired in the engine but not stored yet. - Search activation is the user's own record: mode (all|custom) plus per-field on/off in users.preferences.gallery; source declarations never set defaults (unrecorded = off in custom mode). - image_info is read through a gallery-local struct, removing the compile dependency on the attribute-pipeline types; the gallery builds and runs with or without that feature deployed. - ListImages validates search_in / sort_by / attr_filters against the contract; ineligible fields are dropped, not served. * fix(frontend): inline the shared graph-drawer stylesheet (@import instead of <style src>) plugin-vue 6.0.6 keys unscoped src-style descriptors by the imported file path, so AgentStreamDisplay.vue and WikiBrowser.vue — both importing components/css/wiki-graph-drawer.less — overwrite each other during the build and the second one crashes with "reading 'scoped'". Adding the gallery changed the module order enough to make the collision hit every time. Inlining the same stylesheet keeps the emitted CSS identical and removes the shared descriptor key. * feat(gallery): render attributes from short labels with descriptions in tooltips A source could only say one thing about a value, so the filter panel had to put a full sentence inside a checkbox. Attributes and their values now carry two pieces of text: a short label for the space-constrained controls (checkbox, search field, sort option) and a description for wherever there is room (tooltip, detail panel). The contract's value list becomes an array of {value, label, description}, and the display helpers resolve each field separately: the gallery stamps the short name on a control and moves the sentence into a tooltip. Translation overlays are looked up per field, so a source that ships no gallery-specific text still picks up the attribute pipeline's own wording. * fix(gallery): let locale text win over the contract's wording The filter panel read the backend's own label before asking the locale, so a translated value never got a chance: the contract ships its own default-language wording, and it shadowed the overlay for every locale. Built keys were also off by a segment — imageAttr.<name> has to be imageAttr.<name>.label, and the gallery's own keys live under knowledgeEditor.wikiBrowser.gallery.attr — so builtin and system attributes fell through to English on a Chinese UI. * feat(gallery): top bar layout, pinned panels and per-value verdicts The toolbar moves onto its own row above the grid, so the controls no longer eat into the space the images are there for: search box, the two scope switches, sort field and direction, and the result count all sit in one flex row. The settings behind them are no longer inline either — each opens as a popover under its control and can be pinned to a right-hand rail, where the two panels take turns as tabs instead of both claiming width at once. Filtering gains a third state per attribute value. Where a value could only be picked or not picked, it can now be "off" (hide those images), "on" (show them whatever else says) or neutral (leave them alone), which is what lets one attribute's rules talk about an image another attribute tried to hide without the pair of them cancelling each other out: a forced display outranks a forced hide, and anything no rule speaks about stays visible. The switch that used to only exist inside the panel now has a toolbar home as well. "筛选:全显示" genuinely drops the attribute constraint instead of imposing it against a panel the user cannot see. Filtering used to empty the list the moment it was switched on. Any image whose attribute was never observed — every image ingested before the attribute pipeline existed — read as a mismatch for every filter, which is not narrowing a list but losing it. Absence now stays silence: an attribute no image carries places no constraint on it, until the pipeline catches up and fills the value in. Co-authored-by: WorkBuddy * feat(gallery): expose the image attribute pipeline as a gallery source The gallery's contract resolved to a single source, so the filter panel could only offer "Enabled" while the attributes the observe-and-describe pipeline fills in — contain.text, contain.data_visual — never reached the UI. The registry is a gallery attribute source like any other: every attribute it declares is offered to the gallery, filterable by default, with the config tiers able to override the usage flags at runtime. The registration lives in the attribute pipeline's own commit; this branch carried an earlier, squapshot of that work which predated the split of an attribute value into a short label and a description, so the registry's value shape and this file have been brought in line with it. Both PRs now hold byte-identical copies of the source hook, which is what lets either one land first and the other merge cleanly afterwards. Co-authored-by: WorkBuddy * fix(gallery): viewer race, pin icon, panel anchoring and scope wording Opening the viewer rendered the img element with the previous or empty source while the proxy fetch was still producing a blob, and the error that empty source fired locked the viewer in its failure state even after the real image arrived. The resolved source now lands before the flag is consulted, and a token keeps a slow fetch of one image from overwriting a faster one that navigated past it. The pin button drew nothing: TDesign has no "pushpin" glyph, so the button rendered as an empty shell. It now uses pin / pin-filled, keeps its place beside the tab bar, and a pinned rail assigns its columns explicitly — the panel precedes the main section in the DOM, so leaving the grid to source order handed the wide column to the panel and squeezed the images into the rail. The floating panel no longer appears at a hardcoded offset: it anchors just below the arrow that summoned it, the arrow flips up while its panel is out, a second press retracts, and any click elsewhere in the toolbar closes it. When a rail is pinned the arrows turn to the requested tab instead of spawning a second surface. The scope words (全部 / 全显示 / 自定义) become plain status text rather than a second dropdown — they name the current mode, and only the arrow beside them opens the panel that changes it. Co-authored-by: WorkBuddy * fix(web): align the OCR-on-unobserved switch with the other setting rows The switch sat bare inside its setting-row while every other switch on the page is wrapped in setting-control, which is what reserves the right column and centers the control vertically. With the row laid out from the top, the bare switch hugged the row's upper edge and crowded the description text — visibly out of place next to its neighbors. Wrapping it in setting-control gives it the same right-aligned, centered slot as the rest. Co-authored-by: WorkBuddy * fix(web): move the OCR-on-unobserved row out of the vertical schema row The row lived inside setting-row-vertical, whose descendant rule stretches every setting-info and setting-control beneath it to 100% width. Two full-width flex children side by side cannot fit, so the control overflowed the container and the switch landed past the right edge — visibly further out than the switch on the row above. The row and its note now sit beside the vertical block instead of inside it, under their own condition, so the switch shares the ordinary row layout and its right edge lines up with the "image attribute observation" switch above. Co-authored-by: WorkBuddy * fix(gallery): applying a verdict now activates the filter scope Setting an off/on verdict while the panel's master switch was off silently ignored it: buildParams only attaches attr_rules in custom scope, and setVerdict never flipped the scope. A verdict the user just expressed now switches the scope to custom; clearing the last meaningful verdict returns to all, since custom with no rules constrains nothing. * fix(gallery): search checkboxes stay visible and idle panels read as dimmed The search panel hid its field checkboxes while the master switch was on, so the only way to reach them was to flip the switch first. They now sit next to the switch like the filter panel's verdicts do: dimmed in all-field mode (where they carry no weight) yet clickable, and touching one drops the mode to custom. The filter panel's verdict rows dim the same way while the filter switch is off. * fix(gallery): bulk verdict row, neutral default mark, panel polish The clear-filters button never matched what the panel is for, so it is now a bulk verdict row: one set of -/off/on buttons that applies the chosen position to every value of every value-typed attribute, with the default mark turned into a language-neutral dash. The panel head drops its second divider (the tab bar already draws one) and the tabs follow the toolbar's order: search left, filter right. * fix(gallery): drop the all-fields caption and center the order arrow The caption above the search checkboxes showed and hid with the master switch, shoving the checkboxes down on every flip; it said nothing the dimmed state doesn't, so it is gone. The order button's arrow is an inline svg, which sits on the text baseline and reads as riding high; it now centers against the label. * fix(gallery): center the order arrow for real vertical-align never applied: the icon is a flex item inside the button's inline-flex text wrapper, and the wrapper's default stretch pins the explicitly-sized 16px icon to the top of the 22px line box. align-items: center on the wrapper is what actually centers it. * fix(gallery): shorten panel tab labels in en and ru The two-word labels overflowed the 300px panel and forced the tab bar into scroll arrows; single-word labels fit in every locale that was affected. * docs: drop the image pipeline rewrite from this branch The rewritten 'Go 侧接手后' paragraph belongs to the image attribute observation work (#3635), which this branch carries as a prerequisite and which already documents the caption_ocr / observation_driven split. Keeping a competing rewrite of the same paragraph on the gallery branch makes it collide with upstream, which extended that paragraph with the custom_instructions and inline HTML table notes. Restoring the shared wording keeps the gallery branch free of this file so upstream's edits merge cleanly. * style: gofmt the gallery attribute types Struct field tags in the resolved gallery config were one column narrow, so gofmt rebroke the alignment block. Whitespace only. * style(gallery): use design tokens in the gallery styles The style guard ratchet fails on any new violation. ImageGallery.vue shipped with 47 TDesign token fallbacks, 21 literal font sizes, 4 literal radii and a 0.15s transition; all of them now read the --app-* / --td-* tokens, which is what the guard asks for and what dark mode depends on. * lint(gallery): fix the golangci-lint findings in the gallery code lll: the three over-long swagger @Param lines and one registry row were shortened. ineffassign: ctx was assigned before the access check and then reassigned, so the first value was dead; it is now declared once, after the check. errcheck: the three unchecked c.Error calls in ListImages. revive: the AttrSpec / AttrValue doc comment block was attached to the wrong type and split into one block each. staticcheck S1016: the gallery registration converts the registry value instead of restating its fields. * lint(gallery): wrap the image query select and check the last c.Error * style: reformat the wrapped image select in chunk.go * fix(gallery): address review findings on ordering, KB switch and blob lifetime - sortImageAssets: swap operands for desc instead of negating, keeping a strict weak ordering so ties page stably - ImageGallery: reload on knowledgeBaseId change, drop stale list responses, fetch thumbnails in parallel with one cached blob per URL, revoke blobs on unmount, default sort to builtin:created_at - KnowledgeBase: non-wiki KBs with a stale wiki/graph tab fall back to documents again - handler: move ListImages godoc out of ListKnowledgeFolders' block and document attr_filters / attr_rules - DecideOCR: a payload with no OCR conditions uses the built-in policy instead of silently skipping OCR * docs(parsing): describe the caption_ocr and observation_driven image pipelines Carried over from #3635, which this PR supersedes. * fix(gallery): load local:// and other storage handles through the KB file proxy The gallery's own scheme check only caught resource://, provider:// and storage://, so local:// (the default storage), minio://, cos:// and s3:// images went straight into <img src> and never rendered. Resolve through isProviderFileURL, the scheme list chat and wiki already use, and lock the routing with a test. * fix(kb-editor): keep API-customised OCR conditions on save and upload The KB editor always wrote the registry default into image_actions.ocr.on, so any unrelated edit replaced a knowledge base's custom OCR conditions with the default table; the upload dialog did the same for the per-document override. Keep a stored custom list and fall back to the registry default only when there is none, and show the conditions actually in effect instead of the default table in both panels. * perf(gallery): de-duplicate, filter, sort and page images in SQL Every gallery request used to read every image-bearing chunk of the KB, OCR text included, decode it in Go and page in memory. A single query now expands the image_info arrays, keeps one row per image URL, applies the keyword / attribute / verdict / enabled filters and the sort, and returns only the page with the filtered total. The expansion carries narrow scalars only; filters and JSON sort keys are evaluated on the winning entry of each image, and the page's JSON is read back for its rows alone. Postgres runs the query with JIT off, since the fixed 100-rows-per-call estimate of jsonb_array_elements otherwise prices it ~100x high and compilation dominates. On 20k images with 2 KB of OCR text each (40k chunks), a page drops from ~750 ms to ~100-200 ms on postgres and ~200 ms on sqlite; keyword search over OCR text stays a full scan (~400-600 ms) until the text is indexed. The filter semantics are pinned against both databases. * perf(gallery): serve the gallery from a trigger-maintained chunk_images table Reading images out of chunks.image_info meant parsing every image chunk of the knowledge base on each request, so a page still cost time in proportion to the KB. chunk_images (versioned/000113, sqlite/000032) keeps one row per image_info entry with caption, OCR text and attributes as columns; triggers on chunks keep it in step with every write path, and the migration backfills existing chunks. Copies of one image stay separate rows and the query lists the copy on the most recently updated chunk through an indexed anti-join, so writes decide nothing and concurrent writers need no locking. On postgres, caption and OCR text get pg_trgm indexes when the extension is available. On 20k images with 2 KB of OCR text each (40k chunks): postgres first page 10 ms, page 500 41 ms, keyword 2 ms, filters 23 ms sqlite first page 3 ms, page 500 39 ms, keyword 147 ms, filters 51 ms down from ~100-600 ms. Writing those 40k image chunks costs 7.0 s instead of 1.3 s on postgres (1.9 s instead of 1.0 s on sqlite), mostly the trigram indexes; status and enable-flag updates patch rows in place. --------- Co-authored-by: tayadwx <tayadwx@users.noreply.github.com> Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 04:33:59 +00:00
mergeImageActions,
fetchImageAttrSchema,
FALLBACK_IMAGE_ATTR_SCHEMA,
type ImageActionsConfig,
type ImageAttrSchema,
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
type KnowledgeBaseProfile,
} from '@/api/knowledge-base'
feat(gallery): add an image gallery tab with schema-driven filters (#3694) * feat(image): observe image attributes and let the policy decide OCR Describe each image with the VLM as before, but ask it to also observe two attributes about the image in the same round — how much body text it carries (contain.text) and whether it presents data visually (contain.data_visual) — then let a small pure function decide whether that image is worth a second, separate OCR round. Per-class OCR was the first shape of this idea; a class (chart / photo / logo) is only an indirect proxy for 'is there text worth reading here', and the class table has to grow whenever a new kind of image shows up. The decision actually needs the observed attributes, so it reads them directly, and the attribute set is a backend registry row rather than a new class. The observation and the caption share one VLM call; OCR stays a separate call (prompt isolation, see #3291). An attribute the model does not answer for is left absent rather than filled with a conservative default, so the trace never claims an observation that did not happen, and an incomplete observation falls back to the on_unobserved policy (OCR still runs). The registry also carries the panel's display text, so a new attribute needs no frontend change. Off by default: image_attrs_enabled=false keeps today's behaviour (one caption and one OCR per image). KB config: image_processing_config.image_attrs_enabled / image_actions; per-upload override via process_config. Registry: GET /api/v1/image-attrs/schema. * feat(gallery): add image gallery tab with schema-driven filters Adds a 4th knowledge-base tab parallel to Documents/Wiki/Graph that browses every image asset in a KB. Backend: - GET /api/v1/knowledge-bases/:id/images lists image assets projected from chunks.image_info, with keyword (caption/OCR), multi-value attribute (attr_<name>=<value>), is_enabled and sort filters applied in memory, plus pagination. - Resolves the source knowledge item title (SourceName) via a batched GetKnowledgeBatch so the viewer can show a human-readable source. Frontend: - ImageGallery.vue: thumbnail grid + search/sort + schema-driven filter panel (from GET /image-attrs/schema) + single-image viewer with prev/next, attributes/caption/OCR/source. - Wired as the gallery tab in KnowledgeBase.vue; i18n keys in all 5 locales. * feat(gallery): drive filters/search/sort from a configurable attribute contract The gallery UI is no longer hardcoded: it renders from a self-describing contract served by GET /knowledge-bases/:id/gallery-config (live attribute sources, every attribute's definition with usage flags merged across the config tiers, and the caller's search activation state). - Attribute sources form an open registry (types.RegisterGalleryAttrSource); a builtin source models caption/ocr_text/timestamps/enabled so the gallery has zero special cases. - Usage resolution: user > KB > system > source, field by field; the system tier lives in system_settings (gallery.policy, JSON, no rebuild), the KB tier slot is wired in the engine but not stored yet. - Search activation is the user's own record: mode (all|custom) plus per-field on/off in users.preferences.gallery; source declarations never set defaults (unrecorded = off in custom mode). - image_info is read through a gallery-local struct, removing the compile dependency on the attribute-pipeline types; the gallery builds and runs with or without that feature deployed. - ListImages validates search_in / sort_by / attr_filters against the contract; ineligible fields are dropped, not served. * fix(frontend): inline the shared graph-drawer stylesheet (@import instead of <style src>) plugin-vue 6.0.6 keys unscoped src-style descriptors by the imported file path, so AgentStreamDisplay.vue and WikiBrowser.vue — both importing components/css/wiki-graph-drawer.less — overwrite each other during the build and the second one crashes with "reading 'scoped'". Adding the gallery changed the module order enough to make the collision hit every time. Inlining the same stylesheet keeps the emitted CSS identical and removes the shared descriptor key. * feat(gallery): render attributes from short labels with descriptions in tooltips A source could only say one thing about a value, so the filter panel had to put a full sentence inside a checkbox. Attributes and their values now carry two pieces of text: a short label for the space-constrained controls (checkbox, search field, sort option) and a description for wherever there is room (tooltip, detail panel). The contract's value list becomes an array of {value, label, description}, and the display helpers resolve each field separately: the gallery stamps the short name on a control and moves the sentence into a tooltip. Translation overlays are looked up per field, so a source that ships no gallery-specific text still picks up the attribute pipeline's own wording. * fix(gallery): let locale text win over the contract's wording The filter panel read the backend's own label before asking the locale, so a translated value never got a chance: the contract ships its own default-language wording, and it shadowed the overlay for every locale. Built keys were also off by a segment — imageAttr.<name> has to be imageAttr.<name>.label, and the gallery's own keys live under knowledgeEditor.wikiBrowser.gallery.attr — so builtin and system attributes fell through to English on a Chinese UI. * feat(gallery): top bar layout, pinned panels and per-value verdicts The toolbar moves onto its own row above the grid, so the controls no longer eat into the space the images are there for: search box, the two scope switches, sort field and direction, and the result count all sit in one flex row. The settings behind them are no longer inline either — each opens as a popover under its control and can be pinned to a right-hand rail, where the two panels take turns as tabs instead of both claiming width at once. Filtering gains a third state per attribute value. Where a value could only be picked or not picked, it can now be "off" (hide those images), "on" (show them whatever else says) or neutral (leave them alone), which is what lets one attribute's rules talk about an image another attribute tried to hide without the pair of them cancelling each other out: a forced display outranks a forced hide, and anything no rule speaks about stays visible. The switch that used to only exist inside the panel now has a toolbar home as well. "筛选:全显示" genuinely drops the attribute constraint instead of imposing it against a panel the user cannot see. Filtering used to empty the list the moment it was switched on. Any image whose attribute was never observed — every image ingested before the attribute pipeline existed — read as a mismatch for every filter, which is not narrowing a list but losing it. Absence now stays silence: an attribute no image carries places no constraint on it, until the pipeline catches up and fills the value in. Co-authored-by: WorkBuddy * feat(gallery): expose the image attribute pipeline as a gallery source The gallery's contract resolved to a single source, so the filter panel could only offer "Enabled" while the attributes the observe-and-describe pipeline fills in — contain.text, contain.data_visual — never reached the UI. The registry is a gallery attribute source like any other: every attribute it declares is offered to the gallery, filterable by default, with the config tiers able to override the usage flags at runtime. The registration lives in the attribute pipeline's own commit; this branch carried an earlier, squapshot of that work which predated the split of an attribute value into a short label and a description, so the registry's value shape and this file have been brought in line with it. Both PRs now hold byte-identical copies of the source hook, which is what lets either one land first and the other merge cleanly afterwards. Co-authored-by: WorkBuddy * fix(gallery): viewer race, pin icon, panel anchoring and scope wording Opening the viewer rendered the img element with the previous or empty source while the proxy fetch was still producing a blob, and the error that empty source fired locked the viewer in its failure state even after the real image arrived. The resolved source now lands before the flag is consulted, and a token keeps a slow fetch of one image from overwriting a faster one that navigated past it. The pin button drew nothing: TDesign has no "pushpin" glyph, so the button rendered as an empty shell. It now uses pin / pin-filled, keeps its place beside the tab bar, and a pinned rail assigns its columns explicitly — the panel precedes the main section in the DOM, so leaving the grid to source order handed the wide column to the panel and squeezed the images into the rail. The floating panel no longer appears at a hardcoded offset: it anchors just below the arrow that summoned it, the arrow flips up while its panel is out, a second press retracts, and any click elsewhere in the toolbar closes it. When a rail is pinned the arrows turn to the requested tab instead of spawning a second surface. The scope words (全部 / 全显示 / 自定义) become plain status text rather than a second dropdown — they name the current mode, and only the arrow beside them opens the panel that changes it. Co-authored-by: WorkBuddy * fix(web): align the OCR-on-unobserved switch with the other setting rows The switch sat bare inside its setting-row while every other switch on the page is wrapped in setting-control, which is what reserves the right column and centers the control vertically. With the row laid out from the top, the bare switch hugged the row's upper edge and crowded the description text — visibly out of place next to its neighbors. Wrapping it in setting-control gives it the same right-aligned, centered slot as the rest. Co-authored-by: WorkBuddy * fix(web): move the OCR-on-unobserved row out of the vertical schema row The row lived inside setting-row-vertical, whose descendant rule stretches every setting-info and setting-control beneath it to 100% width. Two full-width flex children side by side cannot fit, so the control overflowed the container and the switch landed past the right edge — visibly further out than the switch on the row above. The row and its note now sit beside the vertical block instead of inside it, under their own condition, so the switch shares the ordinary row layout and its right edge lines up with the "image attribute observation" switch above. Co-authored-by: WorkBuddy * fix(gallery): applying a verdict now activates the filter scope Setting an off/on verdict while the panel's master switch was off silently ignored it: buildParams only attaches attr_rules in custom scope, and setVerdict never flipped the scope. A verdict the user just expressed now switches the scope to custom; clearing the last meaningful verdict returns to all, since custom with no rules constrains nothing. * fix(gallery): search checkboxes stay visible and idle panels read as dimmed The search panel hid its field checkboxes while the master switch was on, so the only way to reach them was to flip the switch first. They now sit next to the switch like the filter panel's verdicts do: dimmed in all-field mode (where they carry no weight) yet clickable, and touching one drops the mode to custom. The filter panel's verdict rows dim the same way while the filter switch is off. * fix(gallery): bulk verdict row, neutral default mark, panel polish The clear-filters button never matched what the panel is for, so it is now a bulk verdict row: one set of -/off/on buttons that applies the chosen position to every value of every value-typed attribute, with the default mark turned into a language-neutral dash. The panel head drops its second divider (the tab bar already draws one) and the tabs follow the toolbar's order: search left, filter right. * fix(gallery): drop the all-fields caption and center the order arrow The caption above the search checkboxes showed and hid with the master switch, shoving the checkboxes down on every flip; it said nothing the dimmed state doesn't, so it is gone. The order button's arrow is an inline svg, which sits on the text baseline and reads as riding high; it now centers against the label. * fix(gallery): center the order arrow for real vertical-align never applied: the icon is a flex item inside the button's inline-flex text wrapper, and the wrapper's default stretch pins the explicitly-sized 16px icon to the top of the 22px line box. align-items: center on the wrapper is what actually centers it. * fix(gallery): shorten panel tab labels in en and ru The two-word labels overflowed the 300px panel and forced the tab bar into scroll arrows; single-word labels fit in every locale that was affected. * docs: drop the image pipeline rewrite from this branch The rewritten 'Go 侧接手后' paragraph belongs to the image attribute observation work (#3635), which this branch carries as a prerequisite and which already documents the caption_ocr / observation_driven split. Keeping a competing rewrite of the same paragraph on the gallery branch makes it collide with upstream, which extended that paragraph with the custom_instructions and inline HTML table notes. Restoring the shared wording keeps the gallery branch free of this file so upstream's edits merge cleanly. * style: gofmt the gallery attribute types Struct field tags in the resolved gallery config were one column narrow, so gofmt rebroke the alignment block. Whitespace only. * style(gallery): use design tokens in the gallery styles The style guard ratchet fails on any new violation. ImageGallery.vue shipped with 47 TDesign token fallbacks, 21 literal font sizes, 4 literal radii and a 0.15s transition; all of them now read the --app-* / --td-* tokens, which is what the guard asks for and what dark mode depends on. * lint(gallery): fix the golangci-lint findings in the gallery code lll: the three over-long swagger @Param lines and one registry row were shortened. ineffassign: ctx was assigned before the access check and then reassigned, so the first value was dead; it is now declared once, after the check. errcheck: the three unchecked c.Error calls in ListImages. revive: the AttrSpec / AttrValue doc comment block was attached to the wrong type and split into one block each. staticcheck S1016: the gallery registration converts the registry value instead of restating its fields. * lint(gallery): wrap the image query select and check the last c.Error * style: reformat the wrapped image select in chunk.go * fix(gallery): address review findings on ordering, KB switch and blob lifetime - sortImageAssets: swap operands for desc instead of negating, keeping a strict weak ordering so ties page stably - ImageGallery: reload on knowledgeBaseId change, drop stale list responses, fetch thumbnails in parallel with one cached blob per URL, revoke blobs on unmount, default sort to builtin:created_at - KnowledgeBase: non-wiki KBs with a stale wiki/graph tab fall back to documents again - handler: move ListImages godoc out of ListKnowledgeFolders' block and document attr_filters / attr_rules - DecideOCR: a payload with no OCR conditions uses the built-in policy instead of silently skipping OCR * docs(parsing): describe the caption_ocr and observation_driven image pipelines Carried over from #3635, which this PR supersedes. * fix(gallery): load local:// and other storage handles through the KB file proxy The gallery's own scheme check only caught resource://, provider:// and storage://, so local:// (the default storage), minio://, cos:// and s3:// images went straight into <img src> and never rendered. Resolve through isProviderFileURL, the scheme list chat and wiki already use, and lock the routing with a test. * fix(kb-editor): keep API-customised OCR conditions on save and upload The KB editor always wrote the registry default into image_actions.ocr.on, so any unrelated edit replaced a knowledge base's custom OCR conditions with the default table; the upload dialog did the same for the per-document override. Keep a stored custom list and fall back to the registry default only when there is none, and show the conditions actually in effect instead of the default table in both panels. * perf(gallery): de-duplicate, filter, sort and page images in SQL Every gallery request used to read every image-bearing chunk of the KB, OCR text included, decode it in Go and page in memory. A single query now expands the image_info arrays, keeps one row per image URL, applies the keyword / attribute / verdict / enabled filters and the sort, and returns only the page with the filtered total. The expansion carries narrow scalars only; filters and JSON sort keys are evaluated on the winning entry of each image, and the page's JSON is read back for its rows alone. Postgres runs the query with JIT off, since the fixed 100-rows-per-call estimate of jsonb_array_elements otherwise prices it ~100x high and compilation dominates. On 20k images with 2 KB of OCR text each (40k chunks), a page drops from ~750 ms to ~100-200 ms on postgres and ~200 ms on sqlite; keyword search over OCR text stays a full scan (~400-600 ms) until the text is indexed. The filter semantics are pinned against both databases. * perf(gallery): serve the gallery from a trigger-maintained chunk_images table Reading images out of chunks.image_info meant parsing every image chunk of the knowledge base on each request, so a page still cost time in proportion to the KB. chunk_images (versioned/000113, sqlite/000032) keeps one row per image_info entry with caption, OCR text and attributes as columns; triggers on chunks keep it in step with every write path, and the migration backfills existing chunks. Copies of one image stay separate rows and the query lists the copy on the most recently updated chunk through an indexed anti-join, so writes decide nothing and concurrent writers need no locking. On postgres, caption and OCR text get pg_trgm indexes when the extension is available. On 20k images with 2 KB of OCR text each (40k chunks): postgres first page 10 ms, page 500 41 ms, keyword 2 ms, filters 23 ms sqlite first page 3 ms, page 500 39 ms, keyword 147 ms, filters 51 ms down from ~100-600 ms. Writing those 40k image chunks costs 7.0 s instead of 1.3 s on postgres (1.9 s instead of 1.0 s on sqlite), mostly the trigram indexes; status and enable-flag updates patch rows in place. --------- Co-authored-by: tayadwx <tayadwx@users.noreply.github.com> Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 04:33:59 +00:00
import { buildImageProcessingConfig } from '@/utils/imageProcessingConfig'
import { imageAttrDisplay, imageAttrConditionDisplay } from '@/utils/imageAttrDisplay'
// The image-attribute registry, fetched from the backend (single source of
// truth). Falls back to the static registry until the endpoint answers.
const imageAttrSchema = ref<ImageAttrSchema | null>(null)
const displaySchema = computed<ImageAttrSchema>(
() => imageAttrSchema.value ?? FALLBACK_IMAGE_ATTR_SCHEMA,
)
async function loadImageAttrSchema(kbId: string) {
try {
imageAttrSchema.value = await fetchImageAttrSchema(kbId)
} catch {
imageAttrSchema.value = null
}
}
import { updateKBConfig, type KBModelConfigRequest } from '@/api/initialization'
import { useChatResourcesStore } from '@/stores/chatResources'
import { selectInitialModelId } from '@/utils/modelDefaults'
import { copyWithToast } from '@/utils/clipboard'
import { useEditorResourcesStore } from '@/stores/editorResources'
import { useUIStore } from '@/stores/ui'
import { useAuthStore } from '@/stores/auth'
import KBModelConfig from './settings/KBModelConfig.vue'
import KBParserSettings from './settings/KBParserSettings.vue'
import KBStorageSettings from './settings/KBStorageSettings.vue'
import KBChunkingSettings from './settings/KBChunkingSettings.vue'
feat: expose KB ↔ vector store binding in list, editor, and detail UI Backend ------- ListKnowledgeBases now enriches each row with the resolved vector_store metadata (name / source / engine_type / status) via a new buildKBListResponse helper. Store views are batch-resolved once per request through BatchResolveStoreView so an N-KB list costs one vector-store service call rather than N — closing the N+1 limitation flagged in #1372's known-limitations section. Cross-tenant shared KBs continue to render via SharedStoreDisplay so the owning tenant's store inventory cannot be correlated across rows; the underlying vector_store_id UUID is stripped from those responses. Resolver failures degrade gracefully: bound KBs render as unavailable instead of breaking the list. Test coverage pins the env / bound / shared distinction, the batch-call-count invariant, and the graceful-failure path. Frontend -------- KB editor modal gains a new "Vector Store" section. Create mode shows a dropdown that combines the system default (env store) and the tenant's configured user stores, fetched once at mount via the existing listVectorStores API. Edit mode shows the bound store read-only via a new VectorStoreBadge component with an explicit immutability hint — matching the backend's `<-:create` GORM tag and the service-layer UpdateKnowledgeBaseRequest DTO that already omit the field. KB list cards surface a small engine-type badge for own-tenant bound KBs, and a warning badge when the bound store is unavailable. Env-bound and shared KBs render no badge (visual noise control). KB detail header shows the bound store via the same VectorStoreBadge component; shared KBs fall through to the badge's internal "shared" branch with no name / engine / id rendered. The KB editor's create-time error handler translates the typed ErrVectorStoreBindingInvalid (2200) and ErrVectorStoreUnavailable (2201) into localized messages and jumps the user back to the VectorStore section so they can pick a different store or fall back to the system default. The KB row type gains five optional fields (vector_store_id / name / engine_type / source / status). i18n: 18 new keys added to en-US, ko-KR, zh-CN; ru-RU receives English placeholders pending translation (consistent with prior PRs in this locale). Part of #993 (Phase 2: Per-KB VectorStore Binding). Phase 2 roadmap item: PR 5 (KB binding UI + list-response enrichment). Depends on #994, #1310, #1372, #1386 (all backend in the Phase 2 series).
2026-05-18 14:50:09 +00:00
import KBVectorStoreSettings from './settings/KBVectorStoreSettings.vue'
import KBAdvancedSettings from './settings/KBAdvancedSettings.vue'
import ModelSelector from '@/components/ModelSelector.vue'
import GraphSettings from './settings/GraphSettings.vue'
import KBShareSettings from './settings/KBShareSettings.vue'
import DataSourceSettings from './settings/DataSourceSettings.vue'
import KnowledgeBaseActivitySettings from './settings/KnowledgeBaseActivitySettings.vue'
import { useI18n } from 'vue-i18n'
const uiStore = useUIStore()
const authStore = useAuthStore()
const chatResources = useChatResourcesStore()
const editorResources = useEditorResourcesStore()
feat(gallery): add an image gallery tab with schema-driven filters (#3694) * feat(image): observe image attributes and let the policy decide OCR Describe each image with the VLM as before, but ask it to also observe two attributes about the image in the same round — how much body text it carries (contain.text) and whether it presents data visually (contain.data_visual) — then let a small pure function decide whether that image is worth a second, separate OCR round. Per-class OCR was the first shape of this idea; a class (chart / photo / logo) is only an indirect proxy for 'is there text worth reading here', and the class table has to grow whenever a new kind of image shows up. The decision actually needs the observed attributes, so it reads them directly, and the attribute set is a backend registry row rather than a new class. The observation and the caption share one VLM call; OCR stays a separate call (prompt isolation, see #3291). An attribute the model does not answer for is left absent rather than filled with a conservative default, so the trace never claims an observation that did not happen, and an incomplete observation falls back to the on_unobserved policy (OCR still runs). The registry also carries the panel's display text, so a new attribute needs no frontend change. Off by default: image_attrs_enabled=false keeps today's behaviour (one caption and one OCR per image). KB config: image_processing_config.image_attrs_enabled / image_actions; per-upload override via process_config. Registry: GET /api/v1/image-attrs/schema. * feat(gallery): add image gallery tab with schema-driven filters Adds a 4th knowledge-base tab parallel to Documents/Wiki/Graph that browses every image asset in a KB. Backend: - GET /api/v1/knowledge-bases/:id/images lists image assets projected from chunks.image_info, with keyword (caption/OCR), multi-value attribute (attr_<name>=<value>), is_enabled and sort filters applied in memory, plus pagination. - Resolves the source knowledge item title (SourceName) via a batched GetKnowledgeBatch so the viewer can show a human-readable source. Frontend: - ImageGallery.vue: thumbnail grid + search/sort + schema-driven filter panel (from GET /image-attrs/schema) + single-image viewer with prev/next, attributes/caption/OCR/source. - Wired as the gallery tab in KnowledgeBase.vue; i18n keys in all 5 locales. * feat(gallery): drive filters/search/sort from a configurable attribute contract The gallery UI is no longer hardcoded: it renders from a self-describing contract served by GET /knowledge-bases/:id/gallery-config (live attribute sources, every attribute's definition with usage flags merged across the config tiers, and the caller's search activation state). - Attribute sources form an open registry (types.RegisterGalleryAttrSource); a builtin source models caption/ocr_text/timestamps/enabled so the gallery has zero special cases. - Usage resolution: user > KB > system > source, field by field; the system tier lives in system_settings (gallery.policy, JSON, no rebuild), the KB tier slot is wired in the engine but not stored yet. - Search activation is the user's own record: mode (all|custom) plus per-field on/off in users.preferences.gallery; source declarations never set defaults (unrecorded = off in custom mode). - image_info is read through a gallery-local struct, removing the compile dependency on the attribute-pipeline types; the gallery builds and runs with or without that feature deployed. - ListImages validates search_in / sort_by / attr_filters against the contract; ineligible fields are dropped, not served. * fix(frontend): inline the shared graph-drawer stylesheet (@import instead of <style src>) plugin-vue 6.0.6 keys unscoped src-style descriptors by the imported file path, so AgentStreamDisplay.vue and WikiBrowser.vue — both importing components/css/wiki-graph-drawer.less — overwrite each other during the build and the second one crashes with "reading 'scoped'". Adding the gallery changed the module order enough to make the collision hit every time. Inlining the same stylesheet keeps the emitted CSS identical and removes the shared descriptor key. * feat(gallery): render attributes from short labels with descriptions in tooltips A source could only say one thing about a value, so the filter panel had to put a full sentence inside a checkbox. Attributes and their values now carry two pieces of text: a short label for the space-constrained controls (checkbox, search field, sort option) and a description for wherever there is room (tooltip, detail panel). The contract's value list becomes an array of {value, label, description}, and the display helpers resolve each field separately: the gallery stamps the short name on a control and moves the sentence into a tooltip. Translation overlays are looked up per field, so a source that ships no gallery-specific text still picks up the attribute pipeline's own wording. * fix(gallery): let locale text win over the contract's wording The filter panel read the backend's own label before asking the locale, so a translated value never got a chance: the contract ships its own default-language wording, and it shadowed the overlay for every locale. Built keys were also off by a segment — imageAttr.<name> has to be imageAttr.<name>.label, and the gallery's own keys live under knowledgeEditor.wikiBrowser.gallery.attr — so builtin and system attributes fell through to English on a Chinese UI. * feat(gallery): top bar layout, pinned panels and per-value verdicts The toolbar moves onto its own row above the grid, so the controls no longer eat into the space the images are there for: search box, the two scope switches, sort field and direction, and the result count all sit in one flex row. The settings behind them are no longer inline either — each opens as a popover under its control and can be pinned to a right-hand rail, where the two panels take turns as tabs instead of both claiming width at once. Filtering gains a third state per attribute value. Where a value could only be picked or not picked, it can now be "off" (hide those images), "on" (show them whatever else says) or neutral (leave them alone), which is what lets one attribute's rules talk about an image another attribute tried to hide without the pair of them cancelling each other out: a forced display outranks a forced hide, and anything no rule speaks about stays visible. The switch that used to only exist inside the panel now has a toolbar home as well. "筛选:全显示" genuinely drops the attribute constraint instead of imposing it against a panel the user cannot see. Filtering used to empty the list the moment it was switched on. Any image whose attribute was never observed — every image ingested before the attribute pipeline existed — read as a mismatch for every filter, which is not narrowing a list but losing it. Absence now stays silence: an attribute no image carries places no constraint on it, until the pipeline catches up and fills the value in. Co-authored-by: WorkBuddy * feat(gallery): expose the image attribute pipeline as a gallery source The gallery's contract resolved to a single source, so the filter panel could only offer "Enabled" while the attributes the observe-and-describe pipeline fills in — contain.text, contain.data_visual — never reached the UI. The registry is a gallery attribute source like any other: every attribute it declares is offered to the gallery, filterable by default, with the config tiers able to override the usage flags at runtime. The registration lives in the attribute pipeline's own commit; this branch carried an earlier, squapshot of that work which predated the split of an attribute value into a short label and a description, so the registry's value shape and this file have been brought in line with it. Both PRs now hold byte-identical copies of the source hook, which is what lets either one land first and the other merge cleanly afterwards. Co-authored-by: WorkBuddy * fix(gallery): viewer race, pin icon, panel anchoring and scope wording Opening the viewer rendered the img element with the previous or empty source while the proxy fetch was still producing a blob, and the error that empty source fired locked the viewer in its failure state even after the real image arrived. The resolved source now lands before the flag is consulted, and a token keeps a slow fetch of one image from overwriting a faster one that navigated past it. The pin button drew nothing: TDesign has no "pushpin" glyph, so the button rendered as an empty shell. It now uses pin / pin-filled, keeps its place beside the tab bar, and a pinned rail assigns its columns explicitly — the panel precedes the main section in the DOM, so leaving the grid to source order handed the wide column to the panel and squeezed the images into the rail. The floating panel no longer appears at a hardcoded offset: it anchors just below the arrow that summoned it, the arrow flips up while its panel is out, a second press retracts, and any click elsewhere in the toolbar closes it. When a rail is pinned the arrows turn to the requested tab instead of spawning a second surface. The scope words (全部 / 全显示 / 自定义) become plain status text rather than a second dropdown — they name the current mode, and only the arrow beside them opens the panel that changes it. Co-authored-by: WorkBuddy * fix(web): align the OCR-on-unobserved switch with the other setting rows The switch sat bare inside its setting-row while every other switch on the page is wrapped in setting-control, which is what reserves the right column and centers the control vertically. With the row laid out from the top, the bare switch hugged the row's upper edge and crowded the description text — visibly out of place next to its neighbors. Wrapping it in setting-control gives it the same right-aligned, centered slot as the rest. Co-authored-by: WorkBuddy * fix(web): move the OCR-on-unobserved row out of the vertical schema row The row lived inside setting-row-vertical, whose descendant rule stretches every setting-info and setting-control beneath it to 100% width. Two full-width flex children side by side cannot fit, so the control overflowed the container and the switch landed past the right edge — visibly further out than the switch on the row above. The row and its note now sit beside the vertical block instead of inside it, under their own condition, so the switch shares the ordinary row layout and its right edge lines up with the "image attribute observation" switch above. Co-authored-by: WorkBuddy * fix(gallery): applying a verdict now activates the filter scope Setting an off/on verdict while the panel's master switch was off silently ignored it: buildParams only attaches attr_rules in custom scope, and setVerdict never flipped the scope. A verdict the user just expressed now switches the scope to custom; clearing the last meaningful verdict returns to all, since custom with no rules constrains nothing. * fix(gallery): search checkboxes stay visible and idle panels read as dimmed The search panel hid its field checkboxes while the master switch was on, so the only way to reach them was to flip the switch first. They now sit next to the switch like the filter panel's verdicts do: dimmed in all-field mode (where they carry no weight) yet clickable, and touching one drops the mode to custom. The filter panel's verdict rows dim the same way while the filter switch is off. * fix(gallery): bulk verdict row, neutral default mark, panel polish The clear-filters button never matched what the panel is for, so it is now a bulk verdict row: one set of -/off/on buttons that applies the chosen position to every value of every value-typed attribute, with the default mark turned into a language-neutral dash. The panel head drops its second divider (the tab bar already draws one) and the tabs follow the toolbar's order: search left, filter right. * fix(gallery): drop the all-fields caption and center the order arrow The caption above the search checkboxes showed and hid with the master switch, shoving the checkboxes down on every flip; it said nothing the dimmed state doesn't, so it is gone. The order button's arrow is an inline svg, which sits on the text baseline and reads as riding high; it now centers against the label. * fix(gallery): center the order arrow for real vertical-align never applied: the icon is a flex item inside the button's inline-flex text wrapper, and the wrapper's default stretch pins the explicitly-sized 16px icon to the top of the 22px line box. align-items: center on the wrapper is what actually centers it. * fix(gallery): shorten panel tab labels in en and ru The two-word labels overflowed the 300px panel and forced the tab bar into scroll arrows; single-word labels fit in every locale that was affected. * docs: drop the image pipeline rewrite from this branch The rewritten 'Go 侧接手后' paragraph belongs to the image attribute observation work (#3635), which this branch carries as a prerequisite and which already documents the caption_ocr / observation_driven split. Keeping a competing rewrite of the same paragraph on the gallery branch makes it collide with upstream, which extended that paragraph with the custom_instructions and inline HTML table notes. Restoring the shared wording keeps the gallery branch free of this file so upstream's edits merge cleanly. * style: gofmt the gallery attribute types Struct field tags in the resolved gallery config were one column narrow, so gofmt rebroke the alignment block. Whitespace only. * style(gallery): use design tokens in the gallery styles The style guard ratchet fails on any new violation. ImageGallery.vue shipped with 47 TDesign token fallbacks, 21 literal font sizes, 4 literal radii and a 0.15s transition; all of them now read the --app-* / --td-* tokens, which is what the guard asks for and what dark mode depends on. * lint(gallery): fix the golangci-lint findings in the gallery code lll: the three over-long swagger @Param lines and one registry row were shortened. ineffassign: ctx was assigned before the access check and then reassigned, so the first value was dead; it is now declared once, after the check. errcheck: the three unchecked c.Error calls in ListImages. revive: the AttrSpec / AttrValue doc comment block was attached to the wrong type and split into one block each. staticcheck S1016: the gallery registration converts the registry value instead of restating its fields. * lint(gallery): wrap the image query select and check the last c.Error * style: reformat the wrapped image select in chunk.go * fix(gallery): address review findings on ordering, KB switch and blob lifetime - sortImageAssets: swap operands for desc instead of negating, keeping a strict weak ordering so ties page stably - ImageGallery: reload on knowledgeBaseId change, drop stale list responses, fetch thumbnails in parallel with one cached blob per URL, revoke blobs on unmount, default sort to builtin:created_at - KnowledgeBase: non-wiki KBs with a stale wiki/graph tab fall back to documents again - handler: move ListImages godoc out of ListKnowledgeFolders' block and document attr_filters / attr_rules - DecideOCR: a payload with no OCR conditions uses the built-in policy instead of silently skipping OCR * docs(parsing): describe the caption_ocr and observation_driven image pipelines Carried over from #3635, which this PR supersedes. * fix(gallery): load local:// and other storage handles through the KB file proxy The gallery's own scheme check only caught resource://, provider:// and storage://, so local:// (the default storage), minio://, cos:// and s3:// images went straight into <img src> and never rendered. Resolve through isProviderFileURL, the scheme list chat and wiki already use, and lock the routing with a test. * fix(kb-editor): keep API-customised OCR conditions on save and upload The KB editor always wrote the registry default into image_actions.ocr.on, so any unrelated edit replaced a knowledge base's custom OCR conditions with the default table; the upload dialog did the same for the per-document override. Keep a stored custom list and fall back to the registry default only when there is none, and show the conditions actually in effect instead of the default table in both panels. * perf(gallery): de-duplicate, filter, sort and page images in SQL Every gallery request used to read every image-bearing chunk of the KB, OCR text included, decode it in Go and page in memory. A single query now expands the image_info arrays, keeps one row per image URL, applies the keyword / attribute / verdict / enabled filters and the sort, and returns only the page with the filtered total. The expansion carries narrow scalars only; filters and JSON sort keys are evaluated on the winning entry of each image, and the page's JSON is read back for its rows alone. Postgres runs the query with JIT off, since the fixed 100-rows-per-call estimate of jsonb_array_elements otherwise prices it ~100x high and compilation dominates. On 20k images with 2 KB of OCR text each (40k chunks), a page drops from ~750 ms to ~100-200 ms on postgres and ~200 ms on sqlite; keyword search over OCR text stays a full scan (~400-600 ms) until the text is indexed. The filter semantics are pinned against both databases. * perf(gallery): serve the gallery from a trigger-maintained chunk_images table Reading images out of chunks.image_info meant parsing every image chunk of the knowledge base on each request, so a page still cost time in proportion to the KB. chunk_images (versioned/000113, sqlite/000032) keeps one row per image_info entry with caption, OCR text and attributes as columns; triggers on chunks keep it in step with every write path, and the migration backfills existing chunks. Copies of one image stay separate rows and the query lists the copy on the most recently updated chunk through an indexed anti-join, so writes decide nothing and concurrent writers need no locking. On postgres, caption and OCR text get pg_trgm indexes when the extension is available. On 20k images with 2 KB of OCR text each (40k chunks): postgres first page 10 ms, page 500 41 ms, keyword 2 ms, filters 23 ms sqlite first page 3 ms, page 500 39 ms, keyword 147 ms, filters 51 ms down from ~100-600 ms. Writing those 40k image chunks costs 7.0 s instead of 1.3 s on postgres (1.9 s instead of 1.0 s on sqlite), mostly the trigram indexes; status and enable-flag updates patch rows in place. --------- Co-authored-by: tayadwx <tayadwx@users.noreply.github.com> Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 04:33:59 +00:00
const { t, te } = useI18n()
// The attribute panel and the OCR conditions are both rendered from the
// registry, in the operator's language: the registry supplies the wording and
// the i18n overlay translates it, so a new backend attribute shows up here
// without a frontend change.
const imageAttrDisplays = computed(() =>
displaySchema.value.attributes.map((attr) => imageAttrDisplay(attr, t, te)),
)
// The conditions the knowledge base actually runs with: a list customised through the
// API is shown as is, otherwise mergeImageActions filled in the default.
const imageAttrConditionDisplays = computed(() =>
(formData.value.imageActions as ImageActionsConfig).ocr.on.map((cond) =>
imageAttrConditionDisplay(cond, displaySchema.value, t, te),
),
)
// Props
const props = defineProps<{
visible: boolean
mode: 'create' | 'edit'
kbId?: string
initialType?: 'document' | 'faq'
}>()
// Emits
const emit = defineEmits<{
(e: 'update:visible', value: boolean): void
(e: 'success', kbId: string): void
}>()
/** 首次保存创建成功后留在弹窗内,继续配置共享等设置 */
const savedKbId = ref<string | null>(null)
const editorMode = computed(() => (savedKbId.value ? 'edit' : props.mode))
const activeKbId = computed(() => savedKbId.value ?? props.kbId)
const isPostCreateSession = computed(() => !!savedKbId.value)
const saveButtonLabel = computed(() =>
editorMode.value === 'create'
? t('knowledgeEditor.buttons.create')
: t('knowledgeEditor.buttons.saveAndClose')
)
const copyKbId = async () => {
await copyWithToast(activeKbId.value, 'common.copied')
}
const currentSection = ref<string>('basic')
const onKbEditorFocusSection = (event: Event) => {
const section = (event as CustomEvent<{ section?: string }>).detail?.section
if (section) {
currentSection.value = section
}
}
onMounted(() => {
window.addEventListener(KB_EDITOR_FOCUS_SECTION_EVENT, onKbEditorFocusSection)
})
onBeforeUnmount(() => {
window.removeEventListener(KB_EDITOR_FOCUS_SECTION_EVENT, onKbEditorFocusSection)
})
const saving = ref(false)
const loading = ref(false)
const allModels = ref<any[]>([])
const hasFiles = ref(false)
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
// AI-generated knowledge-base description (edit mode only). Kept outside
// formData because it is never submitted: the backend owns it.
const generatedProfile = ref<KnowledgeBaseProfile | null>(null)
const generatingProfile = ref(false)
const generatedProfileHasText = computed(() => {
const p = generatedProfile.value
return !!(p && (p.gist || p.topics?.length || p.typical_questions?.length))
})
const generatedProfileMeta = computed(() => {
const p = generatedProfile.value
if (!p || !p.generated_at) return ''
const when = new Date(p.generated_at)
const stamp = isNaN(when.getTime()) ? p.generated_at : when.toLocaleString()
return t('knowledgeEditor.basic.profile.generatedAt', {
time: stamp,
count: p.stats?.document_count ?? 0,
})
})
const initialStorageProvider = ref<string>('')
/** Tenant-wide default from Settings → Storage engine (used when creating a KB). */
const tenantDefaultStorageProvider = ref('local')
const initialIndexingStrategy = ref<any>(null)
const dsCount = ref(0)
feat: expose KB ↔ vector store binding in list, editor, and detail UI Backend ------- ListKnowledgeBases now enriches each row with the resolved vector_store metadata (name / source / engine_type / status) via a new buildKBListResponse helper. Store views are batch-resolved once per request through BatchResolveStoreView so an N-KB list costs one vector-store service call rather than N — closing the N+1 limitation flagged in #1372's known-limitations section. Cross-tenant shared KBs continue to render via SharedStoreDisplay so the owning tenant's store inventory cannot be correlated across rows; the underlying vector_store_id UUID is stripped from those responses. Resolver failures degrade gracefully: bound KBs render as unavailable instead of breaking the list. Test coverage pins the env / bound / shared distinction, the batch-call-count invariant, and the graceful-failure path. Frontend -------- KB editor modal gains a new "Vector Store" section. Create mode shows a dropdown that combines the system default (env store) and the tenant's configured user stores, fetched once at mount via the existing listVectorStores API. Edit mode shows the bound store read-only via a new VectorStoreBadge component with an explicit immutability hint — matching the backend's `<-:create` GORM tag and the service-layer UpdateKnowledgeBaseRequest DTO that already omit the field. KB list cards surface a small engine-type badge for own-tenant bound KBs, and a warning badge when the bound store is unavailable. Env-bound and shared KBs render no badge (visual noise control). KB detail header shows the bound store via the same VectorStoreBadge component; shared KBs fall through to the badge's internal "shared" branch with no name / engine / id rendered. The KB editor's create-time error handler translates the typed ErrVectorStoreBindingInvalid (2200) and ErrVectorStoreUnavailable (2201) into localized messages and jumps the user back to the VectorStore section so they can pick a different store or fall back to the system default. The KB row type gains five optional fields (vector_store_id / name / engine_type / source / status). i18n: 18 new keys added to en-US, ko-KR, zh-CN; ru-RU receives English placeholders pending translation (consistent with prior PRs in this locale). Part of #993 (Phase 2: Per-KB VectorStore Binding). Phase 2 roadmap item: PR 5 (KB binding UI + list-response enrichment). Depends on #994, #1310, #1372, #1386 (all backend in the Phase 2 series).
2026-05-18 14:50:09 +00:00
// Identifier of the user who created this KB. Empty for older rows
// that predate per-KB ownership tracking; those KBs have no "owner" and
// only tenant Admin+ can mutate their share settings.
const kbCreatorId = ref<string>('')
const kbTenantId = ref<number>(0)
// Backend gate for /knowledge-bases/:id/shares (POST/PUT/DELETE) is
// g.OwnedKBOrAdmin(): only the KB creator or tenant Admin+ may mutate
// shares. Org-admins on a shared KB do NOT pass this guard, so they
// would only see 403s if we let them try. Mirror the matrix here so
// the buttons disappear instead of failing.
const canShareKB = computed(() => {
if (!activeKbId.value) return false
const userId = authStore.user?.id || ''
if (kbCreatorId.value && userId && kbCreatorId.value === userId) return true
return authStore.hasRole('admin')
})
const isKbOwner = computed(() => {
const userId = authStore.user?.id || ''
return Boolean(kbCreatorId.value && userId && kbCreatorId.value === userId)
})
const canViewActivity = computed(() => {
if (editorMode.value !== 'edit' || !activeKbId.value) return false
if (Number(kbTenantId.value || 0) !== Number(authStore.currentTenantId || 0)) return false
return isKbOwner.value || authStore.hasRole('admin')
})
// 用户是否在分块设置中手动改过任何值。一旦为 true,就不再根据索引策略自动调整默认分块参数。
const chunkingDirty = ref(false)
// 仅 Wiki 索引模式下的分块预设:更大 chunk、无 overlap、关闭父子分块。
// 该预设只在「创建模式」下、且用户尚未手动调整分块参数时生效,避免覆盖既有 KB 的配置。
const WIKI_ONLY_CHUNKING_PRESET = {
chunkSize: 2048,
chunkOverlap: 0,
enableParentChild: false,
} as const
docs(chunking): align overlap default + sharpen UI/source/repo docs Three documentation passes around the adaptive chunking work: UI - Frontend ChunkOverlap default consolidated to 80 (was 100), matching chunker.DefaultChunkOverlap on the backend. Both DEFAULT_CHUNKING_PRESET and initFormData updated. The KB-load fallback also uses 80 when a loaded KB has no chunk_overlap stored. - All four locales (en-US, zh-CN, ko-KR, ru-RU) get rewritten chunking setting descriptions: each now states the validated range, the default, and the situations where you'd deviate (FAQ vs narrative, embedder token limits, language-specific corpora). Source code - splitter.go: DefaultChunkSize / DefaultChunkOverlap constants get a longer block-comment explaining the per-language token math and the use-case sweet spots, plus the migration note on what the old inconsistent defaults were. - KBChunkingSettings.vue: new comment block above ChunkingConfig documents the slider min/max for each setting, why those bounds exist, and the recommended TokenLimit values per embedding model. Repo docs - New docs/CHUNKING.md: end-to-end guide covering why chunking matters, the adaptive 3-tier architecture, per-setting reference with ranges and sweet spots, parent-child explanation, the token-limit table per embedder (OpenAI / Voyage / Cohere / BGE / MiniLM / Jina), 7 use-case presets, the debug panel workflow, the API surface, and known trade-offs (recursive strategy hidden from UI, no auto-reindex on strategy switch, OCR limitations). - CHANGELOG.md gets a new [Unreleased] section consolidating all the adaptive-chunking work shipped on this branch: 5 features, 8 improvements, 6 fixes, 1 docs entry. The entry references docs/CHUNKING.md for deeper explanation. https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
2026-05-03 11:57:03 +00:00
// Non-Wiki-only fallback. Mirrors chunker.DefaultChunkSize and
// DefaultChunkOverlap on the backend so a freshly created KB uses
// the same numbers whether the editor sets them or the splitter
// falls back to its package defaults.
const DEFAULT_CHUNKING_PRESET = {
chunkSize: 512,
docs(chunking): align overlap default + sharpen UI/source/repo docs Three documentation passes around the adaptive chunking work: UI - Frontend ChunkOverlap default consolidated to 80 (was 100), matching chunker.DefaultChunkOverlap on the backend. Both DEFAULT_CHUNKING_PRESET and initFormData updated. The KB-load fallback also uses 80 when a loaded KB has no chunk_overlap stored. - All four locales (en-US, zh-CN, ko-KR, ru-RU) get rewritten chunking setting descriptions: each now states the validated range, the default, and the situations where you'd deviate (FAQ vs narrative, embedder token limits, language-specific corpora). Source code - splitter.go: DefaultChunkSize / DefaultChunkOverlap constants get a longer block-comment explaining the per-language token math and the use-case sweet spots, plus the migration note on what the old inconsistent defaults were. - KBChunkingSettings.vue: new comment block above ChunkingConfig documents the slider min/max for each setting, why those bounds exist, and the recommended TokenLimit values per embedding model. Repo docs - New docs/CHUNKING.md: end-to-end guide covering why chunking matters, the adaptive 3-tier architecture, per-setting reference with ranges and sweet spots, parent-child explanation, the token-limit table per embedder (OpenAI / Voyage / Cohere / BGE / MiniLM / Jina), 7 use-case presets, the debug panel workflow, the API surface, and known trade-offs (recursive strategy hidden from UI, no auto-reindex on strategy switch, OCR limitations). - CHANGELOG.md gets a new [Unreleased] section consolidating all the adaptive-chunking work shipped on this branch: 5 features, 8 improvements, 6 fixes, 1 docs entry. The entry references docs/CHUNKING.md for deeper explanation. https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
2026-05-03 11:57:03 +00:00
chunkOverlap: 80,
enableParentChild: true,
} as const
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
// 这些分区的操作在点击时即时生效(共享 / 数据源 / 活动记录),不经过底部「保存」,
// 因此底部只显示「关闭」并提示,避免用户以为需要再点保存或以为「取消」能撤销。
const INSTANT_SECTIONS = new Set(['datasource', 'share', 'activity'])
const isInstantSection = computed(() => INSTANT_SECTIONS.has(currentSection.value))
const navItems = computed(() => {
const items: { key: string; icon: string; label: string; badge?: number }[] = [
{ key: 'basic', icon: 'info-circle', label: t('knowledgeEditor.sidebar.basic') },
feat: expose KB ↔ vector store binding in list, editor, and detail UI Backend ------- ListKnowledgeBases now enriches each row with the resolved vector_store metadata (name / source / engine_type / status) via a new buildKBListResponse helper. Store views are batch-resolved once per request through BatchResolveStoreView so an N-KB list costs one vector-store service call rather than N — closing the N+1 limitation flagged in #1372's known-limitations section. Cross-tenant shared KBs continue to render via SharedStoreDisplay so the owning tenant's store inventory cannot be correlated across rows; the underlying vector_store_id UUID is stripped from those responses. Resolver failures degrade gracefully: bound KBs render as unavailable instead of breaking the list. Test coverage pins the env / bound / shared distinction, the batch-call-count invariant, and the graceful-failure path. Frontend -------- KB editor modal gains a new "Vector Store" section. Create mode shows a dropdown that combines the system default (env store) and the tenant's configured user stores, fetched once at mount via the existing listVectorStores API. Edit mode shows the bound store read-only via a new VectorStoreBadge component with an explicit immutability hint — matching the backend's `<-:create` GORM tag and the service-layer UpdateKnowledgeBaseRequest DTO that already omit the field. KB list cards surface a small engine-type badge for own-tenant bound KBs, and a warning badge when the bound store is unavailable. Env-bound and shared KBs render no badge (visual noise control). KB detail header shows the bound store via the same VectorStoreBadge component; shared KBs fall through to the badge's internal "shared" branch with no name / engine / id rendered. The KB editor's create-time error handler translates the typed ErrVectorStoreBindingInvalid (2200) and ErrVectorStoreUnavailable (2201) into localized messages and jumps the user back to the VectorStore section so they can pick a different store or fall back to the system default. The KB row type gains five optional fields (vector_store_id / name / engine_type / source / status). i18n: 18 new keys added to en-US, ko-KR, zh-CN; ru-RU receives English placeholders pending translation (consistent with prior PRs in this locale). Part of #993 (Phase 2: Per-KB VectorStore Binding). Phase 2 roadmap item: PR 5 (KB binding UI + list-response enrichment). Depends on #994, #1310, #1372, #1386 (all backend in the Phase 2 series).
2026-05-18 14:50:09 +00:00
{ key: 'models', icon: 'control-platform', label: t('knowledgeEditor.sidebar.models') },
// VectorStore binding section — present in both create and edit
// modes. Create mode shows a dropdown; edit mode shows the bound
// store read-only with an immutability hint.
{ key: 'vectorStore', icon: 'data-base', label: t('knowledgeEditor.sidebar.vectorStore') }
]
if (formData.value?.type === 'faq') {
items.push({ key: 'faq', icon: 'help-circle', label: t('knowledgeEditor.sidebar.faq') })
} else {
items.push(
{ key: 'parser', icon: 'file-search', label: t('settings.parserEngine') },
{ key: 'multimodal', icon: 'image', label: t('knowledgeEditor.sidebar.multimodal') },
{ key: 'asr', icon: 'sound', label: t('knowledgeEditor.sidebar.asr') },
{ key: 'storage', icon: 'cloud', label: t('knowledgeEditor.sidebar.storage') },
{ key: 'chunking', icon: 'file-copy', label: t('knowledgeEditor.sidebar.chunking') },
{ key: 'graph', icon: 'chart-bubble', label: t('knowledgeEditor.sidebar.graph') },
{ key: 'advanced', icon: 'setting', label: t('knowledgeEditor.sidebar.advanced') }
)
if (editorMode.value === 'edit' && activeKbId.value) {
items.push({ key: 'datasource', icon: 'cloud-download', label: t('knowledgeEditor.sidebar.datasource'), badge: dsCount.value || undefined })
}
}
if (editorMode.value === 'edit' && activeKbId.value && !authStore.isLiteMode) {
items.push({ key: 'share', icon: 'share', label: t('knowledgeEditor.sidebar.share') })
}
if (canViewActivity.value) {
items.push({ key: 'activity', icon: 'history', label: t('knowledgeEditor.sidebar.activity') })
}
return items
})
// 左侧导航分组(与 AgentEditorModal 对齐)
const navGroups = computed(() => {
const itemMap = new Map(navItems.value.map((item) => [item.key, item]))
const pickItems = (keys: string[]) =>
keys.map((key) => itemMap.get(key)).filter(Boolean) as typeof navItems.value
return [
{
key: 'basic',
label: t('knowledgeEditor.navGroups.basic'),
items: pickItems(['basic', 'models', 'vectorStore', 'faq']),
},
{
key: 'processing',
label: t('knowledgeEditor.navGroups.processing'),
items: pickItems(['parser', 'chunking', 'multimodal', 'asr', 'graph', 'advanced']),
},
{
key: 'data',
label: t('knowledgeEditor.navGroups.data'),
items: pickItems(['storage', 'datasource']),
},
{
key: 'integration',
label: t('knowledgeEditor.navGroups.integration'),
items: pickItems(['share']),
},
{
key: 'management',
label: t('knowledgeEditor.navGroups.management'),
items: pickItems(['activity']),
},
].filter((group) => group.items.length > 0)
})
// 模型配置引用
const modelConfigRef = ref<InstanceType<typeof KBModelConfig>>()
const advancedSettingsRef = ref<InstanceType<typeof KBAdvancedSettings>>()
// 表单数据
const formData = ref<any>(null)
const isFAQ = computed(() => formData.value?.type === 'faq')
const kbCreateNeedsEmbedding = computed(() => {
if (!formData.value || formData.value.type === 'faq') return false
const s = formData.value.indexingStrategy
return Boolean(s?.vectorEnabled || s?.keywordEnabled)
})
const applyDefaultModelsIfEmpty = () => {
if (!formData.value || editorMode.value !== 'create') return
const chatModelId = selectInitialModelId(allModels.value, 'KnowledgeQA')
const embeddingModelId = selectInitialModelId(allModels.value, 'Embedding')
if (!formData.value.modelConfig.llmModelId && chatModelId) {
formData.value.modelConfig.llmModelId = chatModelId
}
if (!formData.value.modelConfig.embeddingModelId && embeddingModelId) {
formData.value.modelConfig.embeddingModelId = embeddingModelId
}
}
watch(
() => formData.value?.type,
(newType, oldType) => {
if (!formData.value) return
if (newType === 'faq') {
if (!formData.value.faqConfig) {
formData.value.faqConfig = { indexMode: 'question_only', questionIndexMode: 'separate' }
}
if (!['basic', 'models', 'faq'].includes(currentSection.value)) {
currentSection.value = 'faq'
}
} else if (oldType === 'faq' && currentSection.value === 'faq') {
currentSection.value = 'basic'
}
}
)
// 初始化表单数据
const initFormData = (type: 'document' | 'faq' = 'document') => {
return {
type,
name: '',
description: '',
faqConfig: {
indexMode: 'question_only',
questionIndexMode: 'separate'
},
modelConfig: {
llmModelId: '',
embeddingModelId: '',
wikiSynthesisModelId: '',
},
chunkingConfig: {
chunkSize: 512,
docs(chunking): align overlap default + sharpen UI/source/repo docs Three documentation passes around the adaptive chunking work: UI - Frontend ChunkOverlap default consolidated to 80 (was 100), matching chunker.DefaultChunkOverlap on the backend. Both DEFAULT_CHUNKING_PRESET and initFormData updated. The KB-load fallback also uses 80 when a loaded KB has no chunk_overlap stored. - All four locales (en-US, zh-CN, ko-KR, ru-RU) get rewritten chunking setting descriptions: each now states the validated range, the default, and the situations where you'd deviate (FAQ vs narrative, embedder token limits, language-specific corpora). Source code - splitter.go: DefaultChunkSize / DefaultChunkOverlap constants get a longer block-comment explaining the per-language token math and the use-case sweet spots, plus the migration note on what the old inconsistent defaults were. - KBChunkingSettings.vue: new comment block above ChunkingConfig documents the slider min/max for each setting, why those bounds exist, and the recommended TokenLimit values per embedding model. Repo docs - New docs/CHUNKING.md: end-to-end guide covering why chunking matters, the adaptive 3-tier architecture, per-setting reference with ranges and sweet spots, parent-child explanation, the token-limit table per embedder (OpenAI / Voyage / Cohere / BGE / MiniLM / Jina), 7 use-case presets, the debug panel workflow, the API surface, and known trade-offs (recursive strategy hidden from UI, no auto-reindex on strategy switch, OCR limitations). - CHANGELOG.md gets a new [Unreleased] section consolidating all the adaptive-chunking work shipped on this branch: 5 features, 8 improvements, 6 fixes, 1 docs entry. The entry references docs/CHUNKING.md for deeper explanation. https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
2026-05-03 11:57:03 +00:00
// 80 ≈ 15% of chunkSize — community-recommended sweet spot.
// Aligned with chunker.DefaultChunkOverlap on the backend.
chunkOverlap: 80,
separators: ['\n\n', '\n', '。', '!', '?', ';', ';'],
parserEngineRules: undefined as any,
enableParentChild: true,
parentChunkSize: 4096,
feat(frontend): expose chunking strategy in KB editor Surfaces the adaptive 3-tier chunking controls in the existing "Chunking" section of the KB editor modal. Users can now pick a strategy from a dropdown without crafting JSON for the API: - Automatic (recommended) → backend profiler picks the tier - Markdown-optimized → forces heading-aware splitting - Smart structure detection → forces heuristic boundary detection - Classic → original recursive splitter (legacy) The fifth backend value `recursive` is intentionally hidden from the UI — it's functionally near `legacy` and would dilute the choice. Advanced options (collapsible, disabled when strategy=legacy): - TokenLimit (0–8192 approx tokens; 0 = char-based budget) - Languages multi-select (DE/EN/ZH; empty = auto-detect) Behaviour: - New KBs default to strategy="auto" - Existing KBs without the field render with empty strategy and keep classic behavior on save unless the user actively picks one - Overlap warning when overlap >= chunkSize/2 Wired through: - KBChunkingSettings.vue: strategy select + advanced collapsible + ChunkingConfig interface extended - KnowledgeBaseEditorModal.vue: form-state defaults, kb-load mapping, buildSubmitData (chunking_config) + updateKBConfig (documentSplitting) pass strategy/token_limit/languages - api/initialization/index.ts: types extended - i18n: en-US / zh-CN / ko-KR / ru-RU all carry strategy + advanced keys (6 keys each) https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
2026-05-02 20:40:07 +00:00
childChunkSize: 384,
// New KBs default to the adaptive auto-strategy. User can change in the UI.
strategy: 'auto' as string,
tokenLimit: 0,
languages: [] as string[],
tableMetadataInstructions: ''
},
storageBackendId: '' as string,
storageProvider: '' as string,
multimodalConfig: {
enabled: false,
vllmModelId: '',
descriptionLanguage: '',
customInstructions: ''
},
feat(gallery): add an image gallery tab with schema-driven filters (#3694) * feat(image): observe image attributes and let the policy decide OCR Describe each image with the VLM as before, but ask it to also observe two attributes about the image in the same round — how much body text it carries (contain.text) and whether it presents data visually (contain.data_visual) — then let a small pure function decide whether that image is worth a second, separate OCR round. Per-class OCR was the first shape of this idea; a class (chart / photo / logo) is only an indirect proxy for 'is there text worth reading here', and the class table has to grow whenever a new kind of image shows up. The decision actually needs the observed attributes, so it reads them directly, and the attribute set is a backend registry row rather than a new class. The observation and the caption share one VLM call; OCR stays a separate call (prompt isolation, see #3291). An attribute the model does not answer for is left absent rather than filled with a conservative default, so the trace never claims an observation that did not happen, and an incomplete observation falls back to the on_unobserved policy (OCR still runs). The registry also carries the panel's display text, so a new attribute needs no frontend change. Off by default: image_attrs_enabled=false keeps today's behaviour (one caption and one OCR per image). KB config: image_processing_config.image_attrs_enabled / image_actions; per-upload override via process_config. Registry: GET /api/v1/image-attrs/schema. * feat(gallery): add image gallery tab with schema-driven filters Adds a 4th knowledge-base tab parallel to Documents/Wiki/Graph that browses every image asset in a KB. Backend: - GET /api/v1/knowledge-bases/:id/images lists image assets projected from chunks.image_info, with keyword (caption/OCR), multi-value attribute (attr_<name>=<value>), is_enabled and sort filters applied in memory, plus pagination. - Resolves the source knowledge item title (SourceName) via a batched GetKnowledgeBatch so the viewer can show a human-readable source. Frontend: - ImageGallery.vue: thumbnail grid + search/sort + schema-driven filter panel (from GET /image-attrs/schema) + single-image viewer with prev/next, attributes/caption/OCR/source. - Wired as the gallery tab in KnowledgeBase.vue; i18n keys in all 5 locales. * feat(gallery): drive filters/search/sort from a configurable attribute contract The gallery UI is no longer hardcoded: it renders from a self-describing contract served by GET /knowledge-bases/:id/gallery-config (live attribute sources, every attribute's definition with usage flags merged across the config tiers, and the caller's search activation state). - Attribute sources form an open registry (types.RegisterGalleryAttrSource); a builtin source models caption/ocr_text/timestamps/enabled so the gallery has zero special cases. - Usage resolution: user > KB > system > source, field by field; the system tier lives in system_settings (gallery.policy, JSON, no rebuild), the KB tier slot is wired in the engine but not stored yet. - Search activation is the user's own record: mode (all|custom) plus per-field on/off in users.preferences.gallery; source declarations never set defaults (unrecorded = off in custom mode). - image_info is read through a gallery-local struct, removing the compile dependency on the attribute-pipeline types; the gallery builds and runs with or without that feature deployed. - ListImages validates search_in / sort_by / attr_filters against the contract; ineligible fields are dropped, not served. * fix(frontend): inline the shared graph-drawer stylesheet (@import instead of <style src>) plugin-vue 6.0.6 keys unscoped src-style descriptors by the imported file path, so AgentStreamDisplay.vue and WikiBrowser.vue — both importing components/css/wiki-graph-drawer.less — overwrite each other during the build and the second one crashes with "reading 'scoped'". Adding the gallery changed the module order enough to make the collision hit every time. Inlining the same stylesheet keeps the emitted CSS identical and removes the shared descriptor key. * feat(gallery): render attributes from short labels with descriptions in tooltips A source could only say one thing about a value, so the filter panel had to put a full sentence inside a checkbox. Attributes and their values now carry two pieces of text: a short label for the space-constrained controls (checkbox, search field, sort option) and a description for wherever there is room (tooltip, detail panel). The contract's value list becomes an array of {value, label, description}, and the display helpers resolve each field separately: the gallery stamps the short name on a control and moves the sentence into a tooltip. Translation overlays are looked up per field, so a source that ships no gallery-specific text still picks up the attribute pipeline's own wording. * fix(gallery): let locale text win over the contract's wording The filter panel read the backend's own label before asking the locale, so a translated value never got a chance: the contract ships its own default-language wording, and it shadowed the overlay for every locale. Built keys were also off by a segment — imageAttr.<name> has to be imageAttr.<name>.label, and the gallery's own keys live under knowledgeEditor.wikiBrowser.gallery.attr — so builtin and system attributes fell through to English on a Chinese UI. * feat(gallery): top bar layout, pinned panels and per-value verdicts The toolbar moves onto its own row above the grid, so the controls no longer eat into the space the images are there for: search box, the two scope switches, sort field and direction, and the result count all sit in one flex row. The settings behind them are no longer inline either — each opens as a popover under its control and can be pinned to a right-hand rail, where the two panels take turns as tabs instead of both claiming width at once. Filtering gains a third state per attribute value. Where a value could only be picked or not picked, it can now be "off" (hide those images), "on" (show them whatever else says) or neutral (leave them alone), which is what lets one attribute's rules talk about an image another attribute tried to hide without the pair of them cancelling each other out: a forced display outranks a forced hide, and anything no rule speaks about stays visible. The switch that used to only exist inside the panel now has a toolbar home as well. "筛选:全显示" genuinely drops the attribute constraint instead of imposing it against a panel the user cannot see. Filtering used to empty the list the moment it was switched on. Any image whose attribute was never observed — every image ingested before the attribute pipeline existed — read as a mismatch for every filter, which is not narrowing a list but losing it. Absence now stays silence: an attribute no image carries places no constraint on it, until the pipeline catches up and fills the value in. Co-authored-by: WorkBuddy * feat(gallery): expose the image attribute pipeline as a gallery source The gallery's contract resolved to a single source, so the filter panel could only offer "Enabled" while the attributes the observe-and-describe pipeline fills in — contain.text, contain.data_visual — never reached the UI. The registry is a gallery attribute source like any other: every attribute it declares is offered to the gallery, filterable by default, with the config tiers able to override the usage flags at runtime. The registration lives in the attribute pipeline's own commit; this branch carried an earlier, squapshot of that work which predated the split of an attribute value into a short label and a description, so the registry's value shape and this file have been brought in line with it. Both PRs now hold byte-identical copies of the source hook, which is what lets either one land first and the other merge cleanly afterwards. Co-authored-by: WorkBuddy * fix(gallery): viewer race, pin icon, panel anchoring and scope wording Opening the viewer rendered the img element with the previous or empty source while the proxy fetch was still producing a blob, and the error that empty source fired locked the viewer in its failure state even after the real image arrived. The resolved source now lands before the flag is consulted, and a token keeps a slow fetch of one image from overwriting a faster one that navigated past it. The pin button drew nothing: TDesign has no "pushpin" glyph, so the button rendered as an empty shell. It now uses pin / pin-filled, keeps its place beside the tab bar, and a pinned rail assigns its columns explicitly — the panel precedes the main section in the DOM, so leaving the grid to source order handed the wide column to the panel and squeezed the images into the rail. The floating panel no longer appears at a hardcoded offset: it anchors just below the arrow that summoned it, the arrow flips up while its panel is out, a second press retracts, and any click elsewhere in the toolbar closes it. When a rail is pinned the arrows turn to the requested tab instead of spawning a second surface. The scope words (全部 / 全显示 / 自定义) become plain status text rather than a second dropdown — they name the current mode, and only the arrow beside them opens the panel that changes it. Co-authored-by: WorkBuddy * fix(web): align the OCR-on-unobserved switch with the other setting rows The switch sat bare inside its setting-row while every other switch on the page is wrapped in setting-control, which is what reserves the right column and centers the control vertically. With the row laid out from the top, the bare switch hugged the row's upper edge and crowded the description text — visibly out of place next to its neighbors. Wrapping it in setting-control gives it the same right-aligned, centered slot as the rest. Co-authored-by: WorkBuddy * fix(web): move the OCR-on-unobserved row out of the vertical schema row The row lived inside setting-row-vertical, whose descendant rule stretches every setting-info and setting-control beneath it to 100% width. Two full-width flex children side by side cannot fit, so the control overflowed the container and the switch landed past the right edge — visibly further out than the switch on the row above. The row and its note now sit beside the vertical block instead of inside it, under their own condition, so the switch shares the ordinary row layout and its right edge lines up with the "image attribute observation" switch above. Co-authored-by: WorkBuddy * fix(gallery): applying a verdict now activates the filter scope Setting an off/on verdict while the panel's master switch was off silently ignored it: buildParams only attaches attr_rules in custom scope, and setVerdict never flipped the scope. A verdict the user just expressed now switches the scope to custom; clearing the last meaningful verdict returns to all, since custom with no rules constrains nothing. * fix(gallery): search checkboxes stay visible and idle panels read as dimmed The search panel hid its field checkboxes while the master switch was on, so the only way to reach them was to flip the switch first. They now sit next to the switch like the filter panel's verdicts do: dimmed in all-field mode (where they carry no weight) yet clickable, and touching one drops the mode to custom. The filter panel's verdict rows dim the same way while the filter switch is off. * fix(gallery): bulk verdict row, neutral default mark, panel polish The clear-filters button never matched what the panel is for, so it is now a bulk verdict row: one set of -/off/on buttons that applies the chosen position to every value of every value-typed attribute, with the default mark turned into a language-neutral dash. The panel head drops its second divider (the tab bar already draws one) and the tabs follow the toolbar's order: search left, filter right. * fix(gallery): drop the all-fields caption and center the order arrow The caption above the search checkboxes showed and hid with the master switch, shoving the checkboxes down on every flip; it said nothing the dimmed state doesn't, so it is gone. The order button's arrow is an inline svg, which sits on the text baseline and reads as riding high; it now centers against the label. * fix(gallery): center the order arrow for real vertical-align never applied: the icon is a flex item inside the button's inline-flex text wrapper, and the wrapper's default stretch pins the explicitly-sized 16px icon to the top of the 22px line box. align-items: center on the wrapper is what actually centers it. * fix(gallery): shorten panel tab labels in en and ru The two-word labels overflowed the 300px panel and forced the tab bar into scroll arrows; single-word labels fit in every locale that was affected. * docs: drop the image pipeline rewrite from this branch The rewritten 'Go 侧接手后' paragraph belongs to the image attribute observation work (#3635), which this branch carries as a prerequisite and which already documents the caption_ocr / observation_driven split. Keeping a competing rewrite of the same paragraph on the gallery branch makes it collide with upstream, which extended that paragraph with the custom_instructions and inline HTML table notes. Restoring the shared wording keeps the gallery branch free of this file so upstream's edits merge cleanly. * style: gofmt the gallery attribute types Struct field tags in the resolved gallery config were one column narrow, so gofmt rebroke the alignment block. Whitespace only. * style(gallery): use design tokens in the gallery styles The style guard ratchet fails on any new violation. ImageGallery.vue shipped with 47 TDesign token fallbacks, 21 literal font sizes, 4 literal radii and a 0.15s transition; all of them now read the --app-* / --td-* tokens, which is what the guard asks for and what dark mode depends on. * lint(gallery): fix the golangci-lint findings in the gallery code lll: the three over-long swagger @Param lines and one registry row were shortened. ineffassign: ctx was assigned before the access check and then reassigned, so the first value was dead; it is now declared once, after the check. errcheck: the three unchecked c.Error calls in ListImages. revive: the AttrSpec / AttrValue doc comment block was attached to the wrong type and split into one block each. staticcheck S1016: the gallery registration converts the registry value instead of restating its fields. * lint(gallery): wrap the image query select and check the last c.Error * style: reformat the wrapped image select in chunk.go * fix(gallery): address review findings on ordering, KB switch and blob lifetime - sortImageAssets: swap operands for desc instead of negating, keeping a strict weak ordering so ties page stably - ImageGallery: reload on knowledgeBaseId change, drop stale list responses, fetch thumbnails in parallel with one cached blob per URL, revoke blobs on unmount, default sort to builtin:created_at - KnowledgeBase: non-wiki KBs with a stale wiki/graph tab fall back to documents again - handler: move ListImages godoc out of ListKnowledgeFolders' block and document attr_filters / attr_rules - DecideOCR: a payload with no OCR conditions uses the built-in policy instead of silently skipping OCR * docs(parsing): describe the caption_ocr and observation_driven image pipelines Carried over from #3635, which this PR supersedes. * fix(gallery): load local:// and other storage handles through the KB file proxy The gallery's own scheme check only caught resource://, provider:// and storage://, so local:// (the default storage), minio://, cos:// and s3:// images went straight into <img src> and never rendered. Resolve through isProviderFileURL, the scheme list chat and wiki already use, and lock the routing with a test. * fix(kb-editor): keep API-customised OCR conditions on save and upload The KB editor always wrote the registry default into image_actions.ocr.on, so any unrelated edit replaced a knowledge base's custom OCR conditions with the default table; the upload dialog did the same for the per-document override. Keep a stored custom list and fall back to the registry default only when there is none, and show the conditions actually in effect instead of the default table in both panels. * perf(gallery): de-duplicate, filter, sort and page images in SQL Every gallery request used to read every image-bearing chunk of the KB, OCR text included, decode it in Go and page in memory. A single query now expands the image_info arrays, keeps one row per image URL, applies the keyword / attribute / verdict / enabled filters and the sort, and returns only the page with the filtered total. The expansion carries narrow scalars only; filters and JSON sort keys are evaluated on the winning entry of each image, and the page's JSON is read back for its rows alone. Postgres runs the query with JIT off, since the fixed 100-rows-per-call estimate of jsonb_array_elements otherwise prices it ~100x high and compilation dominates. On 20k images with 2 KB of OCR text each (40k chunks), a page drops from ~750 ms to ~100-200 ms on postgres and ~200 ms on sqlite; keyword search over OCR text stays a full scan (~400-600 ms) until the text is indexed. The filter semantics are pinned against both databases. * perf(gallery): serve the gallery from a trigger-maintained chunk_images table Reading images out of chunks.image_info meant parsing every image chunk of the knowledge base on each request, so a page still cost time in proportion to the KB. chunk_images (versioned/000113, sqlite/000032) keeps one row per image_info entry with caption, OCR text and attributes as columns; triggers on chunks keep it in step with every write path, and the migration backfills existing chunks. Copies of one image stay separate rows and the query lists the copy on the most recently updated chunk through an indexed anti-join, so writes decide nothing and concurrent writers need no locking. On postgres, caption and OCR text get pg_trgm indexes when the extension is available. On 20k images with 2 KB of OCR text each (40k chunks): postgres first page 10 ms, page 500 41 ms, keyword 2 ms, filters 23 ms sqlite first page 3 ms, page 500 39 ms, keyword 147 ms, filters 51 ms down from ~100-600 ms. Writing those 40k image chunks costs 7.0 s instead of 1.3 s on postgres (1.9 s instead of 1.0 s on sqlite), mostly the trigram indexes; status and enable-flag updates patch rows in place. --------- Co-authored-by: tayadwx <tayadwx@users.noreply.github.com> Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 04:33:59 +00:00
// 图片属性观察管线:开关 + on_unobserved 兜底切换由 UI 编辑;其余配置
// (model_id 等)按加载时的快照原样回传,避免把 API 侧写入的设置洗掉。
// 新建模式也必须用完整默认动作初始化——imageActions.ocr.on_unobserved
// 直接被开关绑定,缺省会让打开开关的瞬间渲染崩溃。
imageAttrsEnabled: false,
imageActions: mergeImageActions(),
imageProcessingConfigSnapshot: null as Record<string, unknown> | null,
asrConfig: {
enabled: false,
modelId: '',
language: ''
},
nodeExtractConfig: {
enabled: false,
text: '',
tags: [] as string[],
nodes: [] as Array<{
name: string
attributes: string[]
}>,
relations: [] as Array<{
node1: string
node2: string
type: string
}>,
customInstructions: ''
},
questionGenerationConfig: {
enabled: true,
questionCount: 3,
customInstructions: ''
},
autoTagConfig: {
enabled: false,
modelId: '',
fix(knowledge): harden auto-tagging and let it respect manual tags Automatic tagging shipped with a few paths that quietly disabled it and a prompt that spent most of its budget on data the model never needed. Robustness: - Treat an omitted confidence as a deliberate selection instead of zero. Models frequently drop the field, and the 0.75 floor then filtered out every match, silently turning the feature off. Percentage-scale values are rescaled rather than accepted as out-of-range certainty. - Classify the first 500 tags when a knowledge base has more, logging a warning, instead of dropping the task entirely. Large knowledge bases previously got no auto-tagging at all with no user-visible signal. - Reuse common.ParseLLMJsonResponse for the model reply, and give that helper a balanced-scan fallback. The local extraction cut the payload at the last "}" or "]", so a trailing citation such as "see [1]" produced invalid JSON and burned the task's retries. Prompt: - Address candidates by ordinal rather than UUID. Tag names are short while a UUID is 36 characters, so this cuts candidate tokens roughly tenfold, keeps the model from having to reproduce (and corrupt) an id, and is what makes the raised 500 ceiling affordable. Ordinals are range-checked and mapped back to ids server-side. - Drop the rationale field. Nothing read it, and at max_tags=10 it competed with the 1024-token output budget and risked truncating the JSON. - Fence document text in <document> so file content cannot be read as instructions. Behaviour: - Add auto_tag_config.skip_if_tagged, defaulting to true, so documents the user already tagged at upload time keep their classification. Existing tags are now loaded before the model call, so a skipped document costs no LLM round-trip. Configs stored without the field adopt the default. Also promote AddKnowledgeTagRelations to KnowledgeRepository instead of reaching for it through a type assertion that failed at runtime, and route the max_tags bounds through AutoTagConfig.Normalize so the prompt, the match filter and the persisted config cannot drift apart. Adds handler-level coverage for scope, cancellation, idempotency, ordinal validation and the new toggle, plus SDK, Swagger and API doc updates.
2026-08-07 07:32:16 +00:00
maxTags: 3,
skipIfTagged: true
},
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
profileConfig: {
enabled: false,
modelId: '',
customInstructions: ''
},
feat: Implement comprehensive wiki feature for knowledge bases This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes: **Backend Changes:** - Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log) - Database schema: wiki_pages table with full migration support - WikiPageService: CRUD operations and page management - WikiPageRepository: GORM-based persistence layer - Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents * Summary page generation using LLM * Entity and concept extraction in a single LLM call * Synthesis opportunity detection * Index page rebuilding * Log page maintenance - Wiki boost feature: Enhance chat retrieval with wiki context - Wiki linting: Maintenance and validation utilities - Agent wiki tools: Enable agents to query and interact with wiki pages - Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks - Language support: Reuse existing middleware language infrastructure for LLM prompts **Frontend Changes:** - Wiki browser UI: View all wiki pages with filtering and search - Wiki API client: Knowledge base wiki management endpoints - Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model) - i18n updates: Support for English, Korean, Russian, and Chinese interfaces **Configuration:** - Container DI: Wire up all wiki services - Router: Register wiki API endpoints - Task handling: Support async wiki ingest tasks **Testing:** - Unit tests for wiki page types - Service layer tests - Endpoint tests for wiki operations - Integration tests with LLM mocking **Documentation:** - Language refactoring analysis and guides - Implementation completion reports - Quick reference guides for developers **Key Features:** ✅ LLM-powered wiki page generation from documents ✅ Multi-language support (9+ languages) ✅ Automatic extraction of entities and concepts ✅ Synthesis opportunity detection ✅ Index and log page maintenance ✅ Progressive wiki building across multiple documents ✅ Agent-based wiki interaction ✅ Chat retrieval enhancement with wiki context ✅ Full frontend UI for wiki browsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 05:56:13 +00:00
wikiConfig: {
synthesisModelId: '',
maxPagesPerIngest: 0,
extractionGranularity: 'standard' as 'focused' | 'standard' | 'exhaustive',
contentInstructions: '',
extractionInstructions: '',
feat: Implement comprehensive wiki feature for knowledge bases This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes: **Backend Changes:** - Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log) - Database schema: wiki_pages table with full migration support - WikiPageService: CRUD operations and page management - WikiPageRepository: GORM-based persistence layer - Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents * Summary page generation using LLM * Entity and concept extraction in a single LLM call * Synthesis opportunity detection * Index page rebuilding * Log page maintenance - Wiki boost feature: Enhance chat retrieval with wiki context - Wiki linting: Maintenance and validation utilities - Agent wiki tools: Enable agents to query and interact with wiki pages - Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks - Language support: Reuse existing middleware language infrastructure for LLM prompts **Frontend Changes:** - Wiki browser UI: View all wiki pages with filtering and search - Wiki API client: Knowledge base wiki management endpoints - Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model) - i18n updates: Support for English, Korean, Russian, and Chinese interfaces **Configuration:** - Container DI: Wire up all wiki services - Router: Register wiki API endpoints - Task handling: Support async wiki ingest tasks **Testing:** - Unit tests for wiki page types - Service layer tests - Endpoint tests for wiki operations - Integration tests with LLM mocking **Documentation:** - Language refactoring analysis and guides - Implementation completion reports - Quick reference guides for developers **Key Features:** ✅ LLM-powered wiki page generation from documents ✅ Multi-language support (9+ languages) ✅ Automatic extraction of entities and concepts ✅ Synthesis opportunity detection ✅ Index and log page maintenance ✅ Progressive wiki building across multiple documents ✅ Agent-based wiki interaction ✅ Chat retrieval enhancement with wiki context ✅ Full frontend UI for wiki browsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 05:56:13 +00:00
},
indexingStrategy: {
vectorEnabled: true,
keywordEnabled: true,
wikiEnabled: false,
graphEnabled: false,
},
feat: expose KB ↔ vector store binding in list, editor, and detail UI Backend ------- ListKnowledgeBases now enriches each row with the resolved vector_store metadata (name / source / engine_type / status) via a new buildKBListResponse helper. Store views are batch-resolved once per request through BatchResolveStoreView so an N-KB list costs one vector-store service call rather than N — closing the N+1 limitation flagged in #1372's known-limitations section. Cross-tenant shared KBs continue to render via SharedStoreDisplay so the owning tenant's store inventory cannot be correlated across rows; the underlying vector_store_id UUID is stripped from those responses. Resolver failures degrade gracefully: bound KBs render as unavailable instead of breaking the list. Test coverage pins the env / bound / shared distinction, the batch-call-count invariant, and the graceful-failure path. Frontend -------- KB editor modal gains a new "Vector Store" section. Create mode shows a dropdown that combines the system default (env store) and the tenant's configured user stores, fetched once at mount via the existing listVectorStores API. Edit mode shows the bound store read-only via a new VectorStoreBadge component with an explicit immutability hint — matching the backend's `<-:create` GORM tag and the service-layer UpdateKnowledgeBaseRequest DTO that already omit the field. KB list cards surface a small engine-type badge for own-tenant bound KBs, and a warning badge when the bound store is unavailable. Env-bound and shared KBs render no badge (visual noise control). KB detail header shows the bound store via the same VectorStoreBadge component; shared KBs fall through to the badge's internal "shared" branch with no name / engine / id rendered. The KB editor's create-time error handler translates the typed ErrVectorStoreBindingInvalid (2200) and ErrVectorStoreUnavailable (2201) into localized messages and jumps the user back to the VectorStore section so they can pick a different store or fall back to the system default. The KB row type gains five optional fields (vector_store_id / name / engine_type / source / status). i18n: 18 new keys added to en-US, ko-KR, zh-CN; ru-RU receives English placeholders pending translation (consistent with prior PRs in this locale). Part of #993 (Phase 2: Per-KB VectorStore Binding). Phase 2 roadmap item: PR 5 (KB binding UI + list-response enrichment). Depends on #994, #1310, #1372, #1386 (all backend in the Phase 2 series).
2026-05-18 14:50:09 +00:00
// Vector-store binding. Empty string means "use the env-configured
// store"; create mode defaults to that, edit mode loads the
// existing binding from the KB response below.
vectorStoreId: '' as string,
vectorStoreInfo: {
source: undefined as string | undefined,
name: undefined as string | undefined,
engineType: undefined as string | undefined,
status: undefined as string | undefined,
},
}
}
// 加载所有模型
const loadAllModels = async (force = false) => {
try {
await chatResources.ensureModels(force)
allModels.value = chatResources.allModels || []
} catch (error) {
console.error('Failed to load model list:', error)
MessagePlugin.error(t('knowledgeEditor.messages.loadModelsFailed'))
allModels.value = []
}
}
let kbEditorLoadGeneration = 0
const isCurrentKBLoad = (generation: number, kbId: string) => (
generation === kbEditorLoadGeneration
&& props.visible
&& activeKbId.value === kbId
)
// 加载知识库数据(编辑模式)
const loadKBData = async (
kbIdOverride?: string,
generation = kbEditorLoadGeneration,
) => {
const kbId = kbIdOverride ?? activeKbId.value
if (editorMode.value !== 'edit' || !kbId) return
loading.value = true
try {
const [kbInfo, filesResult] = await Promise.all([
getKnowledgeBaseById(kbId),
listKnowledgeFiles(kbId, { page: 1, page_size: 1 })
])
if (!isCurrentKBLoad(generation, kbId)) return
if (!kbInfo || !kbInfo.data) {
throw new Error(t('knowledgeEditor.messages.notFound'))
}
const kb = kbInfo.data
hasFiles.value = (filesResult as any)?.total > 0
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
generatedProfile.value = (kb as any).generated_profile || null
kbCreatorId.value = (kb as any).creator_id || ''
kbTenantId.value = Number((kb as any).tenant_id || 0)
// 设置表单数据
const kbType = (kb.type as 'document' | 'faq') || 'document'
formData.value = {
type: kbType,
name: kb.name || '',
description: kb.description || '',
faqConfig: {
indexMode: kb.faq_config?.index_mode || 'question_only',
questionIndexMode: kb.faq_config?.question_index_mode || 'separate'
},
modelConfig: {
llmModelId: kb.summary_model_id || '',
embeddingModelId: kb.embedding_model_id || '',
wikiSynthesisModelId: kb.wiki_config?.synthesis_model_id || ''
},
chunkingConfig: {
chunkSize: kb.chunking_config?.chunk_size || 512,
docs(chunking): align overlap default + sharpen UI/source/repo docs Three documentation passes around the adaptive chunking work: UI - Frontend ChunkOverlap default consolidated to 80 (was 100), matching chunker.DefaultChunkOverlap on the backend. Both DEFAULT_CHUNKING_PRESET and initFormData updated. The KB-load fallback also uses 80 when a loaded KB has no chunk_overlap stored. - All four locales (en-US, zh-CN, ko-KR, ru-RU) get rewritten chunking setting descriptions: each now states the validated range, the default, and the situations where you'd deviate (FAQ vs narrative, embedder token limits, language-specific corpora). Source code - splitter.go: DefaultChunkSize / DefaultChunkOverlap constants get a longer block-comment explaining the per-language token math and the use-case sweet spots, plus the migration note on what the old inconsistent defaults were. - KBChunkingSettings.vue: new comment block above ChunkingConfig documents the slider min/max for each setting, why those bounds exist, and the recommended TokenLimit values per embedding model. Repo docs - New docs/CHUNKING.md: end-to-end guide covering why chunking matters, the adaptive 3-tier architecture, per-setting reference with ranges and sweet spots, parent-child explanation, the token-limit table per embedder (OpenAI / Voyage / Cohere / BGE / MiniLM / Jina), 7 use-case presets, the debug panel workflow, the API surface, and known trade-offs (recursive strategy hidden from UI, no auto-reindex on strategy switch, OCR limitations). - CHANGELOG.md gets a new [Unreleased] section consolidating all the adaptive-chunking work shipped on this branch: 5 features, 8 improvements, 6 fixes, 1 docs entry. The entry references docs/CHUNKING.md for deeper explanation. https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
2026-05-03 11:57:03 +00:00
// Fallback only used when the loaded KB has no chunk_overlap stored.
// Aligned with chunker.DefaultChunkOverlap on the backend.
chunkOverlap: kb.chunking_config?.chunk_overlap || 80,
separators: kb.chunking_config?.separators || ['\n\n', '\n', '。', '!', '?', ';', ';'],
parserEngineRules: kb.chunking_config?.parser_engine_rules || undefined,
enableParentChild: kb.chunking_config?.enable_parent_child || false,
parentChunkSize: kb.chunking_config?.parent_chunk_size || 4096,
feat(frontend): expose chunking strategy in KB editor Surfaces the adaptive 3-tier chunking controls in the existing "Chunking" section of the KB editor modal. Users can now pick a strategy from a dropdown without crafting JSON for the API: - Automatic (recommended) → backend profiler picks the tier - Markdown-optimized → forces heading-aware splitting - Smart structure detection → forces heuristic boundary detection - Classic → original recursive splitter (legacy) The fifth backend value `recursive` is intentionally hidden from the UI — it's functionally near `legacy` and would dilute the choice. Advanced options (collapsible, disabled when strategy=legacy): - TokenLimit (0–8192 approx tokens; 0 = char-based budget) - Languages multi-select (DE/EN/ZH; empty = auto-detect) Behaviour: - New KBs default to strategy="auto" - Existing KBs without the field render with empty strategy and keep classic behavior on save unless the user actively picks one - Overlap warning when overlap >= chunkSize/2 Wired through: - KBChunkingSettings.vue: strategy select + advanced collapsible + ChunkingConfig interface extended - KnowledgeBaseEditorModal.vue: form-state defaults, kb-load mapping, buildSubmitData (chunking_config) + updateKBConfig (documentSplitting) pass strategy/token_limit/languages - api/initialization/index.ts: types extended - i18n: en-US / zh-CN / ko-KR / ru-RU all carry strategy + advanced keys (6 keys each) https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
2026-05-02 20:40:07 +00:00
childChunkSize: kb.chunking_config?.child_chunk_size || 384,
// Existing KBs without strategy field render as empty (= legacy behavior).
// The user has to actively pick a value to opt in to the new tiers.
strategy: kb.chunking_config?.strategy || '',
tokenLimit: kb.chunking_config?.token_limit || 0,
languages: kb.chunking_config?.languages || [],
tableMetadataInstructions: kb.chunking_config?.table_metadata_instructions || ''
},
storageBackendId: (kb.storage_backend_id || '') as string,
storageProvider: (kb.storage_provider_config?.provider || kb.storage_config?.provider || 'local') as string,
multimodalConfig: {
enabled: !!kb.vlm_config?.enabled,
vllmModelId: kb.vlm_config?.model_id || '',
descriptionLanguage: kb.vlm_config?.description_language || '',
customInstructions: kb.vlm_config?.custom_instructions || ''
},
feat(gallery): add an image gallery tab with schema-driven filters (#3694) * feat(image): observe image attributes and let the policy decide OCR Describe each image with the VLM as before, but ask it to also observe two attributes about the image in the same round — how much body text it carries (contain.text) and whether it presents data visually (contain.data_visual) — then let a small pure function decide whether that image is worth a second, separate OCR round. Per-class OCR was the first shape of this idea; a class (chart / photo / logo) is only an indirect proxy for 'is there text worth reading here', and the class table has to grow whenever a new kind of image shows up. The decision actually needs the observed attributes, so it reads them directly, and the attribute set is a backend registry row rather than a new class. The observation and the caption share one VLM call; OCR stays a separate call (prompt isolation, see #3291). An attribute the model does not answer for is left absent rather than filled with a conservative default, so the trace never claims an observation that did not happen, and an incomplete observation falls back to the on_unobserved policy (OCR still runs). The registry also carries the panel's display text, so a new attribute needs no frontend change. Off by default: image_attrs_enabled=false keeps today's behaviour (one caption and one OCR per image). KB config: image_processing_config.image_attrs_enabled / image_actions; per-upload override via process_config. Registry: GET /api/v1/image-attrs/schema. * feat(gallery): add image gallery tab with schema-driven filters Adds a 4th knowledge-base tab parallel to Documents/Wiki/Graph that browses every image asset in a KB. Backend: - GET /api/v1/knowledge-bases/:id/images lists image assets projected from chunks.image_info, with keyword (caption/OCR), multi-value attribute (attr_<name>=<value>), is_enabled and sort filters applied in memory, plus pagination. - Resolves the source knowledge item title (SourceName) via a batched GetKnowledgeBatch so the viewer can show a human-readable source. Frontend: - ImageGallery.vue: thumbnail grid + search/sort + schema-driven filter panel (from GET /image-attrs/schema) + single-image viewer with prev/next, attributes/caption/OCR/source. - Wired as the gallery tab in KnowledgeBase.vue; i18n keys in all 5 locales. * feat(gallery): drive filters/search/sort from a configurable attribute contract The gallery UI is no longer hardcoded: it renders from a self-describing contract served by GET /knowledge-bases/:id/gallery-config (live attribute sources, every attribute's definition with usage flags merged across the config tiers, and the caller's search activation state). - Attribute sources form an open registry (types.RegisterGalleryAttrSource); a builtin source models caption/ocr_text/timestamps/enabled so the gallery has zero special cases. - Usage resolution: user > KB > system > source, field by field; the system tier lives in system_settings (gallery.policy, JSON, no rebuild), the KB tier slot is wired in the engine but not stored yet. - Search activation is the user's own record: mode (all|custom) plus per-field on/off in users.preferences.gallery; source declarations never set defaults (unrecorded = off in custom mode). - image_info is read through a gallery-local struct, removing the compile dependency on the attribute-pipeline types; the gallery builds and runs with or without that feature deployed. - ListImages validates search_in / sort_by / attr_filters against the contract; ineligible fields are dropped, not served. * fix(frontend): inline the shared graph-drawer stylesheet (@import instead of <style src>) plugin-vue 6.0.6 keys unscoped src-style descriptors by the imported file path, so AgentStreamDisplay.vue and WikiBrowser.vue — both importing components/css/wiki-graph-drawer.less — overwrite each other during the build and the second one crashes with "reading 'scoped'". Adding the gallery changed the module order enough to make the collision hit every time. Inlining the same stylesheet keeps the emitted CSS identical and removes the shared descriptor key. * feat(gallery): render attributes from short labels with descriptions in tooltips A source could only say one thing about a value, so the filter panel had to put a full sentence inside a checkbox. Attributes and their values now carry two pieces of text: a short label for the space-constrained controls (checkbox, search field, sort option) and a description for wherever there is room (tooltip, detail panel). The contract's value list becomes an array of {value, label, description}, and the display helpers resolve each field separately: the gallery stamps the short name on a control and moves the sentence into a tooltip. Translation overlays are looked up per field, so a source that ships no gallery-specific text still picks up the attribute pipeline's own wording. * fix(gallery): let locale text win over the contract's wording The filter panel read the backend's own label before asking the locale, so a translated value never got a chance: the contract ships its own default-language wording, and it shadowed the overlay for every locale. Built keys were also off by a segment — imageAttr.<name> has to be imageAttr.<name>.label, and the gallery's own keys live under knowledgeEditor.wikiBrowser.gallery.attr — so builtin and system attributes fell through to English on a Chinese UI. * feat(gallery): top bar layout, pinned panels and per-value verdicts The toolbar moves onto its own row above the grid, so the controls no longer eat into the space the images are there for: search box, the two scope switches, sort field and direction, and the result count all sit in one flex row. The settings behind them are no longer inline either — each opens as a popover under its control and can be pinned to a right-hand rail, where the two panels take turns as tabs instead of both claiming width at once. Filtering gains a third state per attribute value. Where a value could only be picked or not picked, it can now be "off" (hide those images), "on" (show them whatever else says) or neutral (leave them alone), which is what lets one attribute's rules talk about an image another attribute tried to hide without the pair of them cancelling each other out: a forced display outranks a forced hide, and anything no rule speaks about stays visible. The switch that used to only exist inside the panel now has a toolbar home as well. "筛选:全显示" genuinely drops the attribute constraint instead of imposing it against a panel the user cannot see. Filtering used to empty the list the moment it was switched on. Any image whose attribute was never observed — every image ingested before the attribute pipeline existed — read as a mismatch for every filter, which is not narrowing a list but losing it. Absence now stays silence: an attribute no image carries places no constraint on it, until the pipeline catches up and fills the value in. Co-authored-by: WorkBuddy * feat(gallery): expose the image attribute pipeline as a gallery source The gallery's contract resolved to a single source, so the filter panel could only offer "Enabled" while the attributes the observe-and-describe pipeline fills in — contain.text, contain.data_visual — never reached the UI. The registry is a gallery attribute source like any other: every attribute it declares is offered to the gallery, filterable by default, with the config tiers able to override the usage flags at runtime. The registration lives in the attribute pipeline's own commit; this branch carried an earlier, squapshot of that work which predated the split of an attribute value into a short label and a description, so the registry's value shape and this file have been brought in line with it. Both PRs now hold byte-identical copies of the source hook, which is what lets either one land first and the other merge cleanly afterwards. Co-authored-by: WorkBuddy * fix(gallery): viewer race, pin icon, panel anchoring and scope wording Opening the viewer rendered the img element with the previous or empty source while the proxy fetch was still producing a blob, and the error that empty source fired locked the viewer in its failure state even after the real image arrived. The resolved source now lands before the flag is consulted, and a token keeps a slow fetch of one image from overwriting a faster one that navigated past it. The pin button drew nothing: TDesign has no "pushpin" glyph, so the button rendered as an empty shell. It now uses pin / pin-filled, keeps its place beside the tab bar, and a pinned rail assigns its columns explicitly — the panel precedes the main section in the DOM, so leaving the grid to source order handed the wide column to the panel and squeezed the images into the rail. The floating panel no longer appears at a hardcoded offset: it anchors just below the arrow that summoned it, the arrow flips up while its panel is out, a second press retracts, and any click elsewhere in the toolbar closes it. When a rail is pinned the arrows turn to the requested tab instead of spawning a second surface. The scope words (全部 / 全显示 / 自定义) become plain status text rather than a second dropdown — they name the current mode, and only the arrow beside them opens the panel that changes it. Co-authored-by: WorkBuddy * fix(web): align the OCR-on-unobserved switch with the other setting rows The switch sat bare inside its setting-row while every other switch on the page is wrapped in setting-control, which is what reserves the right column and centers the control vertically. With the row laid out from the top, the bare switch hugged the row's upper edge and crowded the description text — visibly out of place next to its neighbors. Wrapping it in setting-control gives it the same right-aligned, centered slot as the rest. Co-authored-by: WorkBuddy * fix(web): move the OCR-on-unobserved row out of the vertical schema row The row lived inside setting-row-vertical, whose descendant rule stretches every setting-info and setting-control beneath it to 100% width. Two full-width flex children side by side cannot fit, so the control overflowed the container and the switch landed past the right edge — visibly further out than the switch on the row above. The row and its note now sit beside the vertical block instead of inside it, under their own condition, so the switch shares the ordinary row layout and its right edge lines up with the "image attribute observation" switch above. Co-authored-by: WorkBuddy * fix(gallery): applying a verdict now activates the filter scope Setting an off/on verdict while the panel's master switch was off silently ignored it: buildParams only attaches attr_rules in custom scope, and setVerdict never flipped the scope. A verdict the user just expressed now switches the scope to custom; clearing the last meaningful verdict returns to all, since custom with no rules constrains nothing. * fix(gallery): search checkboxes stay visible and idle panels read as dimmed The search panel hid its field checkboxes while the master switch was on, so the only way to reach them was to flip the switch first. They now sit next to the switch like the filter panel's verdicts do: dimmed in all-field mode (where they carry no weight) yet clickable, and touching one drops the mode to custom. The filter panel's verdict rows dim the same way while the filter switch is off. * fix(gallery): bulk verdict row, neutral default mark, panel polish The clear-filters button never matched what the panel is for, so it is now a bulk verdict row: one set of -/off/on buttons that applies the chosen position to every value of every value-typed attribute, with the default mark turned into a language-neutral dash. The panel head drops its second divider (the tab bar already draws one) and the tabs follow the toolbar's order: search left, filter right. * fix(gallery): drop the all-fields caption and center the order arrow The caption above the search checkboxes showed and hid with the master switch, shoving the checkboxes down on every flip; it said nothing the dimmed state doesn't, so it is gone. The order button's arrow is an inline svg, which sits on the text baseline and reads as riding high; it now centers against the label. * fix(gallery): center the order arrow for real vertical-align never applied: the icon is a flex item inside the button's inline-flex text wrapper, and the wrapper's default stretch pins the explicitly-sized 16px icon to the top of the 22px line box. align-items: center on the wrapper is what actually centers it. * fix(gallery): shorten panel tab labels in en and ru The two-word labels overflowed the 300px panel and forced the tab bar into scroll arrows; single-word labels fit in every locale that was affected. * docs: drop the image pipeline rewrite from this branch The rewritten 'Go 侧接手后' paragraph belongs to the image attribute observation work (#3635), which this branch carries as a prerequisite and which already documents the caption_ocr / observation_driven split. Keeping a competing rewrite of the same paragraph on the gallery branch makes it collide with upstream, which extended that paragraph with the custom_instructions and inline HTML table notes. Restoring the shared wording keeps the gallery branch free of this file so upstream's edits merge cleanly. * style: gofmt the gallery attribute types Struct field tags in the resolved gallery config were one column narrow, so gofmt rebroke the alignment block. Whitespace only. * style(gallery): use design tokens in the gallery styles The style guard ratchet fails on any new violation. ImageGallery.vue shipped with 47 TDesign token fallbacks, 21 literal font sizes, 4 literal radii and a 0.15s transition; all of them now read the --app-* / --td-* tokens, which is what the guard asks for and what dark mode depends on. * lint(gallery): fix the golangci-lint findings in the gallery code lll: the three over-long swagger @Param lines and one registry row were shortened. ineffassign: ctx was assigned before the access check and then reassigned, so the first value was dead; it is now declared once, after the check. errcheck: the three unchecked c.Error calls in ListImages. revive: the AttrSpec / AttrValue doc comment block was attached to the wrong type and split into one block each. staticcheck S1016: the gallery registration converts the registry value instead of restating its fields. * lint(gallery): wrap the image query select and check the last c.Error * style: reformat the wrapped image select in chunk.go * fix(gallery): address review findings on ordering, KB switch and blob lifetime - sortImageAssets: swap operands for desc instead of negating, keeping a strict weak ordering so ties page stably - ImageGallery: reload on knowledgeBaseId change, drop stale list responses, fetch thumbnails in parallel with one cached blob per URL, revoke blobs on unmount, default sort to builtin:created_at - KnowledgeBase: non-wiki KBs with a stale wiki/graph tab fall back to documents again - handler: move ListImages godoc out of ListKnowledgeFolders' block and document attr_filters / attr_rules - DecideOCR: a payload with no OCR conditions uses the built-in policy instead of silently skipping OCR * docs(parsing): describe the caption_ocr and observation_driven image pipelines Carried over from #3635, which this PR supersedes. * fix(gallery): load local:// and other storage handles through the KB file proxy The gallery's own scheme check only caught resource://, provider:// and storage://, so local:// (the default storage), minio://, cos:// and s3:// images went straight into <img src> and never rendered. Resolve through isProviderFileURL, the scheme list chat and wiki already use, and lock the routing with a test. * fix(kb-editor): keep API-customised OCR conditions on save and upload The KB editor always wrote the registry default into image_actions.ocr.on, so any unrelated edit replaced a knowledge base's custom OCR conditions with the default table; the upload dialog did the same for the per-document override. Keep a stored custom list and fall back to the registry default only when there is none, and show the conditions actually in effect instead of the default table in both panels. * perf(gallery): de-duplicate, filter, sort and page images in SQL Every gallery request used to read every image-bearing chunk of the KB, OCR text included, decode it in Go and page in memory. A single query now expands the image_info arrays, keeps one row per image URL, applies the keyword / attribute / verdict / enabled filters and the sort, and returns only the page with the filtered total. The expansion carries narrow scalars only; filters and JSON sort keys are evaluated on the winning entry of each image, and the page's JSON is read back for its rows alone. Postgres runs the query with JIT off, since the fixed 100-rows-per-call estimate of jsonb_array_elements otherwise prices it ~100x high and compilation dominates. On 20k images with 2 KB of OCR text each (40k chunks), a page drops from ~750 ms to ~100-200 ms on postgres and ~200 ms on sqlite; keyword search over OCR text stays a full scan (~400-600 ms) until the text is indexed. The filter semantics are pinned against both databases. * perf(gallery): serve the gallery from a trigger-maintained chunk_images table Reading images out of chunks.image_info meant parsing every image chunk of the knowledge base on each request, so a page still cost time in proportion to the KB. chunk_images (versioned/000113, sqlite/000032) keeps one row per image_info entry with caption, OCR text and attributes as columns; triggers on chunks keep it in step with every write path, and the migration backfills existing chunks. Copies of one image stay separate rows and the query lists the copy on the most recently updated chunk through an indexed anti-join, so writes decide nothing and concurrent writers need no locking. On postgres, caption and OCR text get pg_trgm indexes when the extension is available. On 20k images with 2 KB of OCR text each (40k chunks): postgres first page 10 ms, page 500 41 ms, keyword 2 ms, filters 23 ms sqlite first page 3 ms, page 500 39 ms, keyword 147 ms, filters 51 ms down from ~100-600 ms. Writing those 40k image chunks costs 7.0 s instead of 1.3 s on postgres (1.9 s instead of 1.0 s on sqlite), mostly the trigram indexes; status and enable-flag updates patch rows in place. --------- Co-authored-by: tayadwx <tayadwx@users.noreply.github.com> Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 04:33:59 +00:00
imageAttrsEnabled:
!!(kb as Record<string, any>).image_processing_config?.image_attrs_enabled,
imageActions: mergeImageActions(
(kb as Record<string, any>).image_processing_config?.image_actions,
),
imageProcessingConfigSnapshot:
(kb as Record<string, any>).image_processing_config || null,
asrConfig: {
enabled: !!kb.asr_config?.enabled,
modelId: kb.asr_config?.model_id || '',
language: kb.asr_config?.language || ''
},
nodeExtractConfig: {
enabled: kb.extract_config?.enabled || false,
text: kb.extract_config?.text || '',
tags: kb.extract_config?.tags || [],
nodes: (kb.extract_config?.nodes || []).map((node: any) => ({
name: node.name,
attributes: node.attributes || []
})),
relations: kb.extract_config?.relations || [],
customInstructions: kb.extract_config?.custom_instructions || ''
},
questionGenerationConfig: {
enabled: kb.question_generation_config?.enabled || false,
questionCount: kb.question_generation_config?.question_count || 3,
customInstructions: kb.question_generation_config?.custom_instructions || ''
},
autoTagConfig: {
enabled: kb.auto_tag_config?.enabled || false,
modelId: kb.auto_tag_config?.model_id || '',
fix(knowledge): harden auto-tagging and let it respect manual tags Automatic tagging shipped with a few paths that quietly disabled it and a prompt that spent most of its budget on data the model never needed. Robustness: - Treat an omitted confidence as a deliberate selection instead of zero. Models frequently drop the field, and the 0.75 floor then filtered out every match, silently turning the feature off. Percentage-scale values are rescaled rather than accepted as out-of-range certainty. - Classify the first 500 tags when a knowledge base has more, logging a warning, instead of dropping the task entirely. Large knowledge bases previously got no auto-tagging at all with no user-visible signal. - Reuse common.ParseLLMJsonResponse for the model reply, and give that helper a balanced-scan fallback. The local extraction cut the payload at the last "}" or "]", so a trailing citation such as "see [1]" produced invalid JSON and burned the task's retries. Prompt: - Address candidates by ordinal rather than UUID. Tag names are short while a UUID is 36 characters, so this cuts candidate tokens roughly tenfold, keeps the model from having to reproduce (and corrupt) an id, and is what makes the raised 500 ceiling affordable. Ordinals are range-checked and mapped back to ids server-side. - Drop the rationale field. Nothing read it, and at max_tags=10 it competed with the 1024-token output budget and risked truncating the JSON. - Fence document text in <document> so file content cannot be read as instructions. Behaviour: - Add auto_tag_config.skip_if_tagged, defaulting to true, so documents the user already tagged at upload time keep their classification. Existing tags are now loaded before the model call, so a skipped document costs no LLM round-trip. Configs stored without the field adopt the default. Also promote AddKnowledgeTagRelations to KnowledgeRepository instead of reaching for it through a type assertion that failed at runtime, and route the max_tags bounds through AutoTagConfig.Normalize so the prompt, the match filter and the persisted config cannot drift apart. Adds handler-level coverage for scope, cancellation, idempotency, ordinal validation and the new toggle, plus SDK, Swagger and API doc updates.
2026-08-07 07:32:16 +00:00
maxTags: kb.auto_tag_config?.max_tags || 3,
// Absent on knowledge bases saved before the toggle existed; the
// backend treats that as "skip", so mirror it here.
skipIfTagged: kb.auto_tag_config?.skip_if_tagged ?? true
},
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
profileConfig: {
enabled: kb.profile_config?.enabled || false,
modelId: kb.profile_config?.model_id || '',
customInstructions: kb.profile_config?.custom_instructions || ''
},
feat: Implement comprehensive wiki feature for knowledge bases This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes: **Backend Changes:** - Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log) - Database schema: wiki_pages table with full migration support - WikiPageService: CRUD operations and page management - WikiPageRepository: GORM-based persistence layer - Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents * Summary page generation using LLM * Entity and concept extraction in a single LLM call * Synthesis opportunity detection * Index page rebuilding * Log page maintenance - Wiki boost feature: Enhance chat retrieval with wiki context - Wiki linting: Maintenance and validation utilities - Agent wiki tools: Enable agents to query and interact with wiki pages - Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks - Language support: Reuse existing middleware language infrastructure for LLM prompts **Frontend Changes:** - Wiki browser UI: View all wiki pages with filtering and search - Wiki API client: Knowledge base wiki management endpoints - Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model) - i18n updates: Support for English, Korean, Russian, and Chinese interfaces **Configuration:** - Container DI: Wire up all wiki services - Router: Register wiki API endpoints - Task handling: Support async wiki ingest tasks **Testing:** - Unit tests for wiki page types - Service layer tests - Endpoint tests for wiki operations - Integration tests with LLM mocking **Documentation:** - Language refactoring analysis and guides - Implementation completion reports - Quick reference guides for developers **Key Features:** ✅ LLM-powered wiki page generation from documents ✅ Multi-language support (9+ languages) ✅ Automatic extraction of entities and concepts ✅ Synthesis opportunity detection ✅ Index and log page maintenance ✅ Progressive wiki building across multiple documents ✅ Agent-based wiki interaction ✅ Chat retrieval enhancement with wiki context ✅ Full frontend UI for wiki browsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 05:56:13 +00:00
wikiConfig: {
synthesisModelId: kb.wiki_config?.synthesis_model_id || '',
maxPagesPerIngest: kb.wiki_config?.max_pages_per_ingest || 0,
extractionGranularity: (
kb.wiki_config?.extraction_granularity === 'focused' ||
kb.wiki_config?.extraction_granularity === 'exhaustive'
? kb.wiki_config.extraction_granularity
: 'standard'
) as 'focused' | 'standard' | 'exhaustive',
contentInstructions: kb.wiki_config?.content_instructions || '',
extractionInstructions: kb.wiki_config?.extraction_instructions || '',
feat: Implement comprehensive wiki feature for knowledge bases This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes: **Backend Changes:** - Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log) - Database schema: wiki_pages table with full migration support - WikiPageService: CRUD operations and page management - WikiPageRepository: GORM-based persistence layer - Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents * Summary page generation using LLM * Entity and concept extraction in a single LLM call * Synthesis opportunity detection * Index page rebuilding * Log page maintenance - Wiki boost feature: Enhance chat retrieval with wiki context - Wiki linting: Maintenance and validation utilities - Agent wiki tools: Enable agents to query and interact with wiki pages - Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks - Language support: Reuse existing middleware language infrastructure for LLM prompts **Frontend Changes:** - Wiki browser UI: View all wiki pages with filtering and search - Wiki API client: Knowledge base wiki management endpoints - Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model) - i18n updates: Support for English, Korean, Russian, and Chinese interfaces **Configuration:** - Container DI: Wire up all wiki services - Router: Register wiki API endpoints - Task handling: Support async wiki ingest tasks **Testing:** - Unit tests for wiki page types - Service layer tests - Endpoint tests for wiki operations - Integration tests with LLM mocking **Documentation:** - Language refactoring analysis and guides - Implementation completion reports - Quick reference guides for developers **Key Features:** ✅ LLM-powered wiki page generation from documents ✅ Multi-language support (9+ languages) ✅ Automatic extraction of entities and concepts ✅ Synthesis opportunity detection ✅ Index and log page maintenance ✅ Progressive wiki building across multiple documents ✅ Agent-based wiki interaction ✅ Chat retrieval enhancement with wiki context ✅ Full frontend UI for wiki browsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 05:56:13 +00:00
},
indexingStrategy: {
vectorEnabled: kb.indexing_strategy?.vector_enabled ?? true,
keywordEnabled: kb.indexing_strategy?.keyword_enabled ?? true,
wikiEnabled: kb.indexing_strategy?.wiki_enabled ?? false,
graphEnabled: kb.indexing_strategy?.graph_enabled ?? false,
},
feat: expose KB ↔ vector store binding in list, editor, and detail UI Backend ------- ListKnowledgeBases now enriches each row with the resolved vector_store metadata (name / source / engine_type / status) via a new buildKBListResponse helper. Store views are batch-resolved once per request through BatchResolveStoreView so an N-KB list costs one vector-store service call rather than N — closing the N+1 limitation flagged in #1372's known-limitations section. Cross-tenant shared KBs continue to render via SharedStoreDisplay so the owning tenant's store inventory cannot be correlated across rows; the underlying vector_store_id UUID is stripped from those responses. Resolver failures degrade gracefully: bound KBs render as unavailable instead of breaking the list. Test coverage pins the env / bound / shared distinction, the batch-call-count invariant, and the graceful-failure path. Frontend -------- KB editor modal gains a new "Vector Store" section. Create mode shows a dropdown that combines the system default (env store) and the tenant's configured user stores, fetched once at mount via the existing listVectorStores API. Edit mode shows the bound store read-only via a new VectorStoreBadge component with an explicit immutability hint — matching the backend's `<-:create` GORM tag and the service-layer UpdateKnowledgeBaseRequest DTO that already omit the field. KB list cards surface a small engine-type badge for own-tenant bound KBs, and a warning badge when the bound store is unavailable. Env-bound and shared KBs render no badge (visual noise control). KB detail header shows the bound store via the same VectorStoreBadge component; shared KBs fall through to the badge's internal "shared" branch with no name / engine / id rendered. The KB editor's create-time error handler translates the typed ErrVectorStoreBindingInvalid (2200) and ErrVectorStoreUnavailable (2201) into localized messages and jumps the user back to the VectorStore section so they can pick a different store or fall back to the system default. The KB row type gains five optional fields (vector_store_id / name / engine_type / source / status). i18n: 18 new keys added to en-US, ko-KR, zh-CN; ru-RU receives English placeholders pending translation (consistent with prior PRs in this locale). Part of #993 (Phase 2: Per-KB VectorStore Binding). Phase 2 roadmap item: PR 5 (KB binding UI + list-response enrichment). Depends on #994, #1310, #1372, #1386 (all backend in the Phase 2 series).
2026-05-18 14:50:09 +00:00
// Vector-store binding. vectorStoreId is editor-only state; it
// is only included in the create request, never the update
// request, because the binding is immutable after creation.
// vectorStoreInfo carries the read-only display fields that the
// edit view renders below; they come straight from the KB
// response.
vectorStoreId: '',
vectorStoreInfo: {
source: kb.vector_store_source,
name: kb.vector_store_name,
engineType: kb.vector_store_engine_type,
status: kb.vector_store_status,
},
}
feat(gallery): add an image gallery tab with schema-driven filters (#3694) * feat(image): observe image attributes and let the policy decide OCR Describe each image with the VLM as before, but ask it to also observe two attributes about the image in the same round — how much body text it carries (contain.text) and whether it presents data visually (contain.data_visual) — then let a small pure function decide whether that image is worth a second, separate OCR round. Per-class OCR was the first shape of this idea; a class (chart / photo / logo) is only an indirect proxy for 'is there text worth reading here', and the class table has to grow whenever a new kind of image shows up. The decision actually needs the observed attributes, so it reads them directly, and the attribute set is a backend registry row rather than a new class. The observation and the caption share one VLM call; OCR stays a separate call (prompt isolation, see #3291). An attribute the model does not answer for is left absent rather than filled with a conservative default, so the trace never claims an observation that did not happen, and an incomplete observation falls back to the on_unobserved policy (OCR still runs). The registry also carries the panel's display text, so a new attribute needs no frontend change. Off by default: image_attrs_enabled=false keeps today's behaviour (one caption and one OCR per image). KB config: image_processing_config.image_attrs_enabled / image_actions; per-upload override via process_config. Registry: GET /api/v1/image-attrs/schema. * feat(gallery): add image gallery tab with schema-driven filters Adds a 4th knowledge-base tab parallel to Documents/Wiki/Graph that browses every image asset in a KB. Backend: - GET /api/v1/knowledge-bases/:id/images lists image assets projected from chunks.image_info, with keyword (caption/OCR), multi-value attribute (attr_<name>=<value>), is_enabled and sort filters applied in memory, plus pagination. - Resolves the source knowledge item title (SourceName) via a batched GetKnowledgeBatch so the viewer can show a human-readable source. Frontend: - ImageGallery.vue: thumbnail grid + search/sort + schema-driven filter panel (from GET /image-attrs/schema) + single-image viewer with prev/next, attributes/caption/OCR/source. - Wired as the gallery tab in KnowledgeBase.vue; i18n keys in all 5 locales. * feat(gallery): drive filters/search/sort from a configurable attribute contract The gallery UI is no longer hardcoded: it renders from a self-describing contract served by GET /knowledge-bases/:id/gallery-config (live attribute sources, every attribute's definition with usage flags merged across the config tiers, and the caller's search activation state). - Attribute sources form an open registry (types.RegisterGalleryAttrSource); a builtin source models caption/ocr_text/timestamps/enabled so the gallery has zero special cases. - Usage resolution: user > KB > system > source, field by field; the system tier lives in system_settings (gallery.policy, JSON, no rebuild), the KB tier slot is wired in the engine but not stored yet. - Search activation is the user's own record: mode (all|custom) plus per-field on/off in users.preferences.gallery; source declarations never set defaults (unrecorded = off in custom mode). - image_info is read through a gallery-local struct, removing the compile dependency on the attribute-pipeline types; the gallery builds and runs with or without that feature deployed. - ListImages validates search_in / sort_by / attr_filters against the contract; ineligible fields are dropped, not served. * fix(frontend): inline the shared graph-drawer stylesheet (@import instead of <style src>) plugin-vue 6.0.6 keys unscoped src-style descriptors by the imported file path, so AgentStreamDisplay.vue and WikiBrowser.vue — both importing components/css/wiki-graph-drawer.less — overwrite each other during the build and the second one crashes with "reading 'scoped'". Adding the gallery changed the module order enough to make the collision hit every time. Inlining the same stylesheet keeps the emitted CSS identical and removes the shared descriptor key. * feat(gallery): render attributes from short labels with descriptions in tooltips A source could only say one thing about a value, so the filter panel had to put a full sentence inside a checkbox. Attributes and their values now carry two pieces of text: a short label for the space-constrained controls (checkbox, search field, sort option) and a description for wherever there is room (tooltip, detail panel). The contract's value list becomes an array of {value, label, description}, and the display helpers resolve each field separately: the gallery stamps the short name on a control and moves the sentence into a tooltip. Translation overlays are looked up per field, so a source that ships no gallery-specific text still picks up the attribute pipeline's own wording. * fix(gallery): let locale text win over the contract's wording The filter panel read the backend's own label before asking the locale, so a translated value never got a chance: the contract ships its own default-language wording, and it shadowed the overlay for every locale. Built keys were also off by a segment — imageAttr.<name> has to be imageAttr.<name>.label, and the gallery's own keys live under knowledgeEditor.wikiBrowser.gallery.attr — so builtin and system attributes fell through to English on a Chinese UI. * feat(gallery): top bar layout, pinned panels and per-value verdicts The toolbar moves onto its own row above the grid, so the controls no longer eat into the space the images are there for: search box, the two scope switches, sort field and direction, and the result count all sit in one flex row. The settings behind them are no longer inline either — each opens as a popover under its control and can be pinned to a right-hand rail, where the two panels take turns as tabs instead of both claiming width at once. Filtering gains a third state per attribute value. Where a value could only be picked or not picked, it can now be "off" (hide those images), "on" (show them whatever else says) or neutral (leave them alone), which is what lets one attribute's rules talk about an image another attribute tried to hide without the pair of them cancelling each other out: a forced display outranks a forced hide, and anything no rule speaks about stays visible. The switch that used to only exist inside the panel now has a toolbar home as well. "筛选:全显示" genuinely drops the attribute constraint instead of imposing it against a panel the user cannot see. Filtering used to empty the list the moment it was switched on. Any image whose attribute was never observed — every image ingested before the attribute pipeline existed — read as a mismatch for every filter, which is not narrowing a list but losing it. Absence now stays silence: an attribute no image carries places no constraint on it, until the pipeline catches up and fills the value in. Co-authored-by: WorkBuddy * feat(gallery): expose the image attribute pipeline as a gallery source The gallery's contract resolved to a single source, so the filter panel could only offer "Enabled" while the attributes the observe-and-describe pipeline fills in — contain.text, contain.data_visual — never reached the UI. The registry is a gallery attribute source like any other: every attribute it declares is offered to the gallery, filterable by default, with the config tiers able to override the usage flags at runtime. The registration lives in the attribute pipeline's own commit; this branch carried an earlier, squapshot of that work which predated the split of an attribute value into a short label and a description, so the registry's value shape and this file have been brought in line with it. Both PRs now hold byte-identical copies of the source hook, which is what lets either one land first and the other merge cleanly afterwards. Co-authored-by: WorkBuddy * fix(gallery): viewer race, pin icon, panel anchoring and scope wording Opening the viewer rendered the img element with the previous or empty source while the proxy fetch was still producing a blob, and the error that empty source fired locked the viewer in its failure state even after the real image arrived. The resolved source now lands before the flag is consulted, and a token keeps a slow fetch of one image from overwriting a faster one that navigated past it. The pin button drew nothing: TDesign has no "pushpin" glyph, so the button rendered as an empty shell. It now uses pin / pin-filled, keeps its place beside the tab bar, and a pinned rail assigns its columns explicitly — the panel precedes the main section in the DOM, so leaving the grid to source order handed the wide column to the panel and squeezed the images into the rail. The floating panel no longer appears at a hardcoded offset: it anchors just below the arrow that summoned it, the arrow flips up while its panel is out, a second press retracts, and any click elsewhere in the toolbar closes it. When a rail is pinned the arrows turn to the requested tab instead of spawning a second surface. The scope words (全部 / 全显示 / 自定义) become plain status text rather than a second dropdown — they name the current mode, and only the arrow beside them opens the panel that changes it. Co-authored-by: WorkBuddy * fix(web): align the OCR-on-unobserved switch with the other setting rows The switch sat bare inside its setting-row while every other switch on the page is wrapped in setting-control, which is what reserves the right column and centers the control vertically. With the row laid out from the top, the bare switch hugged the row's upper edge and crowded the description text — visibly out of place next to its neighbors. Wrapping it in setting-control gives it the same right-aligned, centered slot as the rest. Co-authored-by: WorkBuddy * fix(web): move the OCR-on-unobserved row out of the vertical schema row The row lived inside setting-row-vertical, whose descendant rule stretches every setting-info and setting-control beneath it to 100% width. Two full-width flex children side by side cannot fit, so the control overflowed the container and the switch landed past the right edge — visibly further out than the switch on the row above. The row and its note now sit beside the vertical block instead of inside it, under their own condition, so the switch shares the ordinary row layout and its right edge lines up with the "image attribute observation" switch above. Co-authored-by: WorkBuddy * fix(gallery): applying a verdict now activates the filter scope Setting an off/on verdict while the panel's master switch was off silently ignored it: buildParams only attaches attr_rules in custom scope, and setVerdict never flipped the scope. A verdict the user just expressed now switches the scope to custom; clearing the last meaningful verdict returns to all, since custom with no rules constrains nothing. * fix(gallery): search checkboxes stay visible and idle panels read as dimmed The search panel hid its field checkboxes while the master switch was on, so the only way to reach them was to flip the switch first. They now sit next to the switch like the filter panel's verdicts do: dimmed in all-field mode (where they carry no weight) yet clickable, and touching one drops the mode to custom. The filter panel's verdict rows dim the same way while the filter switch is off. * fix(gallery): bulk verdict row, neutral default mark, panel polish The clear-filters button never matched what the panel is for, so it is now a bulk verdict row: one set of -/off/on buttons that applies the chosen position to every value of every value-typed attribute, with the default mark turned into a language-neutral dash. The panel head drops its second divider (the tab bar already draws one) and the tabs follow the toolbar's order: search left, filter right. * fix(gallery): drop the all-fields caption and center the order arrow The caption above the search checkboxes showed and hid with the master switch, shoving the checkboxes down on every flip; it said nothing the dimmed state doesn't, so it is gone. The order button's arrow is an inline svg, which sits on the text baseline and reads as riding high; it now centers against the label. * fix(gallery): center the order arrow for real vertical-align never applied: the icon is a flex item inside the button's inline-flex text wrapper, and the wrapper's default stretch pins the explicitly-sized 16px icon to the top of the 22px line box. align-items: center on the wrapper is what actually centers it. * fix(gallery): shorten panel tab labels in en and ru The two-word labels overflowed the 300px panel and forced the tab bar into scroll arrows; single-word labels fit in every locale that was affected. * docs: drop the image pipeline rewrite from this branch The rewritten 'Go 侧接手后' paragraph belongs to the image attribute observation work (#3635), which this branch carries as a prerequisite and which already documents the caption_ocr / observation_driven split. Keeping a competing rewrite of the same paragraph on the gallery branch makes it collide with upstream, which extended that paragraph with the custom_instructions and inline HTML table notes. Restoring the shared wording keeps the gallery branch free of this file so upstream's edits merge cleanly. * style: gofmt the gallery attribute types Struct field tags in the resolved gallery config were one column narrow, so gofmt rebroke the alignment block. Whitespace only. * style(gallery): use design tokens in the gallery styles The style guard ratchet fails on any new violation. ImageGallery.vue shipped with 47 TDesign token fallbacks, 21 literal font sizes, 4 literal radii and a 0.15s transition; all of them now read the --app-* / --td-* tokens, which is what the guard asks for and what dark mode depends on. * lint(gallery): fix the golangci-lint findings in the gallery code lll: the three over-long swagger @Param lines and one registry row were shortened. ineffassign: ctx was assigned before the access check and then reassigned, so the first value was dead; it is now declared once, after the check. errcheck: the three unchecked c.Error calls in ListImages. revive: the AttrSpec / AttrValue doc comment block was attached to the wrong type and split into one block each. staticcheck S1016: the gallery registration converts the registry value instead of restating its fields. * lint(gallery): wrap the image query select and check the last c.Error * style: reformat the wrapped image select in chunk.go * fix(gallery): address review findings on ordering, KB switch and blob lifetime - sortImageAssets: swap operands for desc instead of negating, keeping a strict weak ordering so ties page stably - ImageGallery: reload on knowledgeBaseId change, drop stale list responses, fetch thumbnails in parallel with one cached blob per URL, revoke blobs on unmount, default sort to builtin:created_at - KnowledgeBase: non-wiki KBs with a stale wiki/graph tab fall back to documents again - handler: move ListImages godoc out of ListKnowledgeFolders' block and document attr_filters / attr_rules - DecideOCR: a payload with no OCR conditions uses the built-in policy instead of silently skipping OCR * docs(parsing): describe the caption_ocr and observation_driven image pipelines Carried over from #3635, which this PR supersedes. * fix(gallery): load local:// and other storage handles through the KB file proxy The gallery's own scheme check only caught resource://, provider:// and storage://, so local:// (the default storage), minio://, cos:// and s3:// images went straight into <img src> and never rendered. Resolve through isProviderFileURL, the scheme list chat and wiki already use, and lock the routing with a test. * fix(kb-editor): keep API-customised OCR conditions on save and upload The KB editor always wrote the registry default into image_actions.ocr.on, so any unrelated edit replaced a knowledge base's custom OCR conditions with the default table; the upload dialog did the same for the per-document override. Keep a stored custom list and fall back to the registry default only when there is none, and show the conditions actually in effect instead of the default table in both panels. * perf(gallery): de-duplicate, filter, sort and page images in SQL Every gallery request used to read every image-bearing chunk of the KB, OCR text included, decode it in Go and page in memory. A single query now expands the image_info arrays, keeps one row per image URL, applies the keyword / attribute / verdict / enabled filters and the sort, and returns only the page with the filtered total. The expansion carries narrow scalars only; filters and JSON sort keys are evaluated on the winning entry of each image, and the page's JSON is read back for its rows alone. Postgres runs the query with JIT off, since the fixed 100-rows-per-call estimate of jsonb_array_elements otherwise prices it ~100x high and compilation dominates. On 20k images with 2 KB of OCR text each (40k chunks), a page drops from ~750 ms to ~100-200 ms on postgres and ~200 ms on sqlite; keyword search over OCR text stays a full scan (~400-600 ms) until the text is indexed. The filter semantics are pinned against both databases. * perf(gallery): serve the gallery from a trigger-maintained chunk_images table Reading images out of chunks.image_info meant parsing every image chunk of the knowledge base on each request, so a page still cost time in proportion to the KB. chunk_images (versioned/000113, sqlite/000032) keeps one row per image_info entry with caption, OCR text and attributes as columns; triggers on chunks keep it in step with every write path, and the migration backfills existing chunks. Copies of one image stay separate rows and the query lists the copy on the most recently updated chunk through an indexed anti-join, so writes decide nothing and concurrent writers need no locking. On postgres, caption and OCR text get pg_trgm indexes when the extension is available. On 20k images with 2 KB of OCR text each (40k chunks): postgres first page 10 ms, page 500 41 ms, keyword 2 ms, filters 23 ms sqlite first page 3 ms, page 500 39 ms, keyword 147 ms, filters 51 ms down from ~100-600 ms. Writing those 40k image chunks costs 7.0 s instead of 1.3 s on postgres (1.9 s instead of 1.0 s on sqlite), mostly the trigram indexes; status and enable-flag updates patch rows in place. --------- Co-authored-by: tayadwx <tayadwx@users.noreply.github.com> Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 04:33:59 +00:00
// 拉取后端属性注册表,驱动属性面板的动态渲染(编辑模式有 kbId)。
loadImageAttrSchema(kbId)
initialStorageProvider.value = formData.value.storageProvider
initialIndexingStrategy.value = { ...formData.value.indexingStrategy }
} catch (error) {
if (!isCurrentKBLoad(generation, kbId)) return
console.error('Failed to load knowledge base data:', error)
MessagePlugin.error(t('knowledgeEditor.messages.loadDataFailed'))
handleClose()
} finally {
if (isCurrentKBLoad(generation, kbId)) {
loading.value = false
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
modalShell.markClean()
}
}
}
// 处理配置更新
const handleModelConfigUpdate = (config: any) => {
if (formData.value) {
formData.value.modelConfig = { ...config }
}
}
// 粒度选择器:从 formData.wikiConfig 读出并规范化,未知值回退到 'standard',
// 与后端 WikiExtractionGranularity.Normalize() 的契约保持一致。
const resolvedGranularity = computed<'focused' | 'standard' | 'exhaustive'>(() => {
const g = formData.value?.wikiConfig?.extractionGranularity
if (g === 'focused' || g === 'standard' || g === 'exhaustive') {
return g
}
return 'standard'
})
const granularityHint = computed<string>(() => {
switch (resolvedGranularity.value) {
case 'focused':
return t('knowledgeEditor.wiki.granularityFocusedHint')
case 'exhaustive':
return t('knowledgeEditor.wiki.granularityExhaustiveHint')
default:
return t('knowledgeEditor.wiki.granularityStandardHint')
}
})
const handleGranularityChange = (value: string | number | boolean) => {
if (!formData.value) return
const next: 'focused' | 'standard' | 'exhaustive' =
value === 'focused' || value === 'exhaustive'
? (value as 'focused' | 'exhaustive')
: 'standard'
formData.value.wikiConfig = {
...formData.value.wikiConfig,
extractionGranularity: next,
}
}
const isIndexingLocked = computed(() => editorMode.value === 'edit' && hasFiles.value)
const toggleVectorIndexing = () => {
if (!formData.value) return
if (isIndexingLocked.value) return
const next = !formData.value.indexingStrategy.vectorEnabled
formData.value.indexingStrategy.vectorEnabled = next
formData.value.indexingStrategy.keywordEnabled = next
}
const toggleWikiIndexing = () => {
if (!formData.value) return
if (isIndexingLocked.value) return
formData.value.indexingStrategy.wikiEnabled = !formData.value.indexingStrategy.wikiEnabled
}
const handleChunkingConfigUpdate = (config: any) => {
if (formData.value) {
formData.value.chunkingConfig = { ...config }
// 用户已经手动触达分块设置,后续索引策略切换不再覆盖这些值
chunkingDirty.value = true
}
}
// 判断当前是否为「仅 Wiki 索引」:只开了 Wiki,关了向量/关键词检索
const isWikiOnlyStrategy = computed(() => {
const s = formData.value?.indexingStrategy
if (!s) return false
return !!s.wikiEnabled && !s.vectorEnabled && !s.keywordEnabled
})
// 仅在创建模式、用户未改过分块设置时,随索引策略自动应用/撤销 Wiki-only 预设。
// 编辑模式严格保持后端已有配置不变,避免误改。
watch(isWikiOnlyStrategy, (wikiOnly) => {
if (editorMode.value !== 'create') return
if (!formData.value) return
if (chunkingDirty.value) return
const preset = wikiOnly ? WIKI_ONLY_CHUNKING_PRESET : DEFAULT_CHUNKING_PRESET
formData.value.chunkingConfig = {
...formData.value.chunkingConfig,
...preset,
}
})
const handleParserEngineRulesUpdate = (rules: any[]) => {
if (formData.value) {
formData.value.chunkingConfig.parserEngineRules = rules?.length ? rules : undefined
}
}
const handleMultimodalToggle = () => {
if (formData.value && !formData.value.multimodalConfig.enabled) {
formData.value.multimodalConfig.vllmModelId = ''
}
}
const handleMultimodalVLLMChange = (modelId: string) => {
if (formData.value) {
formData.value.multimodalConfig.vllmModelId = modelId
}
}
const handleAddVLLMModel = () => {
uiStore.openSettings('models', 'vllm')
}
const handleAddASRModel = () => {
uiStore.openSettings('models', 'asr')
}
const handleAddWikiModel = () => {
uiStore.openSettings('models', 'knowledgeqa')
}
const handleStorageProviderUpdate = (value: string) => {
if (formData.value) {
formData.value.storageProvider = editorMode.value === 'create'
? editorResources.resolveUsableStorageProvider(value || tenantDefaultStorageProvider.value)
: (value || tenantDefaultStorageProvider.value || 'local')
}
}
const handleStorageBackendUpdate = (value: string) => {
if (formData.value) {
formData.value.storageBackendId = value
}
}
async function loadTenantDefaultStorageProvider(force = false) {
try {
await editorResources.ensureStorageEngine(force)
tenantDefaultStorageProvider.value = editorResources.resolveUsableStorageProvider(
editorResources.storageConfig?.default_provider,
)
} catch {
tenantDefaultStorageProvider.value = editorResources.resolveUsableStorageProvider()
}
}
/** Resolved storage provider for create payload (never silently default to local before tenant config loads). */
function resolvedStorageProvider(): string {
const explicit = formData.value?.storageProvider?.trim()
if (editorMode.value === 'create') {
return editorResources.resolveUsableStorageProvider(explicit || tenantDefaultStorageProvider.value)
}
if (explicit) return explicit
return tenantDefaultStorageProvider.value || 'local'
}
feat: expose KB ↔ vector store binding in list, editor, and detail UI Backend ------- ListKnowledgeBases now enriches each row with the resolved vector_store metadata (name / source / engine_type / status) via a new buildKBListResponse helper. Store views are batch-resolved once per request through BatchResolveStoreView so an N-KB list costs one vector-store service call rather than N — closing the N+1 limitation flagged in #1372's known-limitations section. Cross-tenant shared KBs continue to render via SharedStoreDisplay so the owning tenant's store inventory cannot be correlated across rows; the underlying vector_store_id UUID is stripped from those responses. Resolver failures degrade gracefully: bound KBs render as unavailable instead of breaking the list. Test coverage pins the env / bound / shared distinction, the batch-call-count invariant, and the graceful-failure path. Frontend -------- KB editor modal gains a new "Vector Store" section. Create mode shows a dropdown that combines the system default (env store) and the tenant's configured user stores, fetched once at mount via the existing listVectorStores API. Edit mode shows the bound store read-only via a new VectorStoreBadge component with an explicit immutability hint — matching the backend's `<-:create` GORM tag and the service-layer UpdateKnowledgeBaseRequest DTO that already omit the field. KB list cards surface a small engine-type badge for own-tenant bound KBs, and a warning badge when the bound store is unavailable. Env-bound and shared KBs render no badge (visual noise control). KB detail header shows the bound store via the same VectorStoreBadge component; shared KBs fall through to the badge's internal "shared" branch with no name / engine / id rendered. The KB editor's create-time error handler translates the typed ErrVectorStoreBindingInvalid (2200) and ErrVectorStoreUnavailable (2201) into localized messages and jumps the user back to the VectorStore section so they can pick a different store or fall back to the system default. The KB row type gains five optional fields (vector_store_id / name / engine_type / source / status). i18n: 18 new keys added to en-US, ko-KR, zh-CN; ru-RU receives English placeholders pending translation (consistent with prior PRs in this locale). Part of #993 (Phase 2: Per-KB VectorStore Binding). Phase 2 roadmap item: PR 5 (KB binding UI + list-response enrichment). Depends on #994, #1310, #1372, #1386 (all backend in the Phase 2 series).
2026-05-18 14:50:09 +00:00
const handleVectorStoreIdUpdate = (id: string) => {
if (formData.value) {
// Empty string here means "use system default" (env-store fallback).
// The create-payload assembly below converts this back to `omit` so
// the backend stores NULL — keeping the wire shape identical to
// pre-Phase-2 clients.
formData.value.vectorStoreId = id || ''
}
}
const handleQuestionGenerationUpdate = (config: any) => {
if (formData.value) {
formData.value.questionGenerationConfig = { ...config }
}
}
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
// Regenerate the AI description now (synchronous: one aggregation + one
// small model call). The result replaces the card but never the manual
// description; "adopt" copies the gist over explicitly.
const handleGenerateProfile = async () => {
const kbId = activeKbId.value
if (!kbId || generatingProfile.value) return
generatingProfile.value = true
try {
const result: any = await generateKnowledgeBaseProfile(kbId)
if (!result?.success) {
throw new Error(result?.message || t('knowledgeEditor.basic.profile.generateFailed'))
}
generatedProfile.value = result.data || null
MessagePlugin.success(t('knowledgeEditor.basic.profile.generated'))
} catch (error: any) {
console.error('Generate knowledge base profile failed:', error)
MessagePlugin.error(error?.message || t('knowledgeEditor.basic.profile.generateFailed'))
} finally {
generatingProfile.value = false
}
}
const handleAdoptProfileGist = () => {
const gist = generatedProfile.value?.gist
if (!gist || !formData.value) return
formData.value.description = gist.slice(0, 200)
MessagePlugin.success(t('knowledgeEditor.basic.profile.adopted'))
}
const handleNodeExtractUpdate = (config: any) => {
if (formData.value) {
formData.value.nodeExtractConfig = { ...config }
}
}
// 验证表单
const validateForm = (): boolean => {
if (!formData.value) return false
// 验证基本信息
if (!formData.value.name || !formData.value.name.trim()) {
MessagePlugin.warning(t('knowledgeEditor.messages.nameRequired'))
currentSection.value = 'basic'
return false
}
// 验证索引策略 — 文档类型至少需要开启一种
if (formData.value.type !== 'faq') {
const s = formData.value.indexingStrategy
if (s && !s.vectorEnabled && !s.keywordEnabled && !s.wikiEnabled && !s.graphEnabled) {
MessagePlugin.warning(t('knowledgeEditor.indexing.atLeastOne'))
currentSection.value = 'basic'
return false
}
}
// 验证模型配置 - embedding 模型仅在检索索引启用时必须
const needsEmbedding = formData.value.indexingStrategy?.vectorEnabled || formData.value.indexingStrategy?.keywordEnabled
if (needsEmbedding && !formData.value.modelConfig.embeddingModelId) {
MessagePlugin.warning(t('knowledgeEditor.indexing.embeddingRequired'))
currentSection.value = 'models'
return false
}
if (!formData.value.modelConfig.llmModelId) {
MessagePlugin.warning(t('knowledgeEditor.messages.summaryRequired'))
currentSection.value = 'models'
return false
}
// 验证多模态配置(如果启用)
if (formData.value.multimodalConfig.enabled && !formData.value.multimodalConfig.vllmModelId) {
MessagePlugin.warning(t('knowledgeEditor.messages.multimodalInvalid'))
currentSection.value = 'multimodal'
return false
}
if (formData.value.type === 'faq' && !formData.value.faqConfig?.indexMode) {
MessagePlugin.warning(t('knowledgeEditor.messages.indexModeRequired'))
currentSection.value = 'faq'
return false
}
return true
}
// 构建提交数据
const buildSubmitData = () => {
if (!formData.value) return null
const data: any = {
name: formData.value.name,
description: formData.value.description,
type: formData.value.type,
chunking_config: {
chunk_size: formData.value.chunkingConfig.chunkSize,
chunk_overlap: formData.value.chunkingConfig.chunkOverlap,
separators: formData.value.chunkingConfig.separators,
enable_parent_child: formData.value.chunkingConfig.enableParentChild,
parent_chunk_size: formData.value.chunkingConfig.parentChunkSize,
child_chunk_size: formData.value.chunkingConfig.childChunkSize,
fix(chunker): QA audit — pointer DTOs, profile reuse, stats correctness Resolves the issues surfaced by the post-Phase-3 self-review. High severity - Strategy / TokenLimit / Languages can now be reset. The KB-config handler uses pointer DTOs so the absence of a field in the payload means "no change" while an explicit empty string / 0 / [] clears the value. The frontend now sends the fields unconditionally so the user can revert to defaults via the clear icon — previously these fields were write-once. - DocProfile is no longer computed twice in the preview endpoint. Diagnostics carries the profile that drove tier selection (when auto-strategy ran); the handler only re-profiles for explicit strategies that bypass the profiler. - Chunk-size stats (avg / min / max / stddev) are now computed over the FULL chunk set before the response is truncated to previewMaxChunks. Avoids systematically misleading metrics for large documents. - SplitWithDiagnostics defaults SelectedTier to TierLegacy so an empty-text request never leaves the diag with a blank tier string. Medium severity - Split() reverts to its own loop instead of delegating to SplitWithDiagnostics. Diagnostics struct allocation is reserved for callers that actually want the trace (preview endpoint). Matters in SplitParentChild where Split runs once per parent. - Preview endpoint runs the splitter on a goroutine wrapped in a 5s context.WithTimeout. CJK input at the 256k-rune ceiling could otherwise tie up the worker for several seconds. Low severity - KBChunkingSettings emits arrays via spread copies so parent-side mutation cannot drift the form's reactive state. - KBChunkingDebug font-family includes a monospace fallback so the chunk content stays monospaced even when the TDesign CSS variable is missing. Documentation - DocProfile JSON shape is now annotated as part of the public preview API; field renames would be breaking. https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
2026-05-03 07:01:20 +00:00
// Adaptive chunking fields are always sent (empty/zero values
// included) so the user can clear them — backend uses pointer DTOs
// to distinguish "not in payload" from "explicitly empty".
strategy: formData.value.chunkingConfig.strategy ?? '',
token_limit: formData.value.chunkingConfig.tokenLimit ?? 0,
languages: formData.value.chunkingConfig.languages ?? [],
table_metadata_instructions: formData.value.chunkingConfig.tableMetadataInstructions || '',
...(formData.value.chunkingConfig.parserEngineRules?.length
? { parser_engine_rules: formData.value.chunkingConfig.parserEngineRules }
: {})
},
embedding_model_id: formData.value.modelConfig.embeddingModelId,
summary_model_id: formData.value.modelConfig.llmModelId
}
feat: expose KB ↔ vector store binding in list, editor, and detail UI Backend ------- ListKnowledgeBases now enriches each row with the resolved vector_store metadata (name / source / engine_type / status) via a new buildKBListResponse helper. Store views are batch-resolved once per request through BatchResolveStoreView so an N-KB list costs one vector-store service call rather than N — closing the N+1 limitation flagged in #1372's known-limitations section. Cross-tenant shared KBs continue to render via SharedStoreDisplay so the owning tenant's store inventory cannot be correlated across rows; the underlying vector_store_id UUID is stripped from those responses. Resolver failures degrade gracefully: bound KBs render as unavailable instead of breaking the list. Test coverage pins the env / bound / shared distinction, the batch-call-count invariant, and the graceful-failure path. Frontend -------- KB editor modal gains a new "Vector Store" section. Create mode shows a dropdown that combines the system default (env store) and the tenant's configured user stores, fetched once at mount via the existing listVectorStores API. Edit mode shows the bound store read-only via a new VectorStoreBadge component with an explicit immutability hint — matching the backend's `<-:create` GORM tag and the service-layer UpdateKnowledgeBaseRequest DTO that already omit the field. KB list cards surface a small engine-type badge for own-tenant bound KBs, and a warning badge when the bound store is unavailable. Env-bound and shared KBs render no badge (visual noise control). KB detail header shows the bound store via the same VectorStoreBadge component; shared KBs fall through to the badge's internal "shared" branch with no name / engine / id rendered. The KB editor's create-time error handler translates the typed ErrVectorStoreBindingInvalid (2200) and ErrVectorStoreUnavailable (2201) into localized messages and jumps the user back to the VectorStore section so they can pick a different store or fall back to the system default. The KB row type gains five optional fields (vector_store_id / name / engine_type / source / status). i18n: 18 new keys added to en-US, ko-KR, zh-CN; ru-RU receives English placeholders pending translation (consistent with prior PRs in this locale). Part of #993 (Phase 2: Per-KB VectorStore Binding). Phase 2 roadmap item: PR 5 (KB binding UI + list-response enrichment). Depends on #994, #1310, #1372, #1386 (all backend in the Phase 2 series).
2026-05-18 14:50:09 +00:00
// Vector-store binding. Only attach the field when the user actively
// selected a non-default store. The server treats an empty string as
// NULL, but keeping the field absent on the wire matches what a
// client that doesn't know about this binding would send — which
// makes A/B response diffs easier to read.
if (formData.value.vectorStoreId) {
data.vector_store_id = formData.value.vectorStoreId
}
// 添加多模态配置
data.vlm_config = {
enabled: formData.value.multimodalConfig.enabled,
model_id: formData.value.multimodalConfig.enabled
? (formData.value.multimodalConfig.vllmModelId || '')
: '',
description_language: formData.value.multimodalConfig.descriptionLanguage || '',
custom_instructions: formData.value.multimodalConfig.customInstructions || ''
}
feat(gallery): add an image gallery tab with schema-driven filters (#3694) * feat(image): observe image attributes and let the policy decide OCR Describe each image with the VLM as before, but ask it to also observe two attributes about the image in the same round — how much body text it carries (contain.text) and whether it presents data visually (contain.data_visual) — then let a small pure function decide whether that image is worth a second, separate OCR round. Per-class OCR was the first shape of this idea; a class (chart / photo / logo) is only an indirect proxy for 'is there text worth reading here', and the class table has to grow whenever a new kind of image shows up. The decision actually needs the observed attributes, so it reads them directly, and the attribute set is a backend registry row rather than a new class. The observation and the caption share one VLM call; OCR stays a separate call (prompt isolation, see #3291). An attribute the model does not answer for is left absent rather than filled with a conservative default, so the trace never claims an observation that did not happen, and an incomplete observation falls back to the on_unobserved policy (OCR still runs). The registry also carries the panel's display text, so a new attribute needs no frontend change. Off by default: image_attrs_enabled=false keeps today's behaviour (one caption and one OCR per image). KB config: image_processing_config.image_attrs_enabled / image_actions; per-upload override via process_config. Registry: GET /api/v1/image-attrs/schema. * feat(gallery): add image gallery tab with schema-driven filters Adds a 4th knowledge-base tab parallel to Documents/Wiki/Graph that browses every image asset in a KB. Backend: - GET /api/v1/knowledge-bases/:id/images lists image assets projected from chunks.image_info, with keyword (caption/OCR), multi-value attribute (attr_<name>=<value>), is_enabled and sort filters applied in memory, plus pagination. - Resolves the source knowledge item title (SourceName) via a batched GetKnowledgeBatch so the viewer can show a human-readable source. Frontend: - ImageGallery.vue: thumbnail grid + search/sort + schema-driven filter panel (from GET /image-attrs/schema) + single-image viewer with prev/next, attributes/caption/OCR/source. - Wired as the gallery tab in KnowledgeBase.vue; i18n keys in all 5 locales. * feat(gallery): drive filters/search/sort from a configurable attribute contract The gallery UI is no longer hardcoded: it renders from a self-describing contract served by GET /knowledge-bases/:id/gallery-config (live attribute sources, every attribute's definition with usage flags merged across the config tiers, and the caller's search activation state). - Attribute sources form an open registry (types.RegisterGalleryAttrSource); a builtin source models caption/ocr_text/timestamps/enabled so the gallery has zero special cases. - Usage resolution: user > KB > system > source, field by field; the system tier lives in system_settings (gallery.policy, JSON, no rebuild), the KB tier slot is wired in the engine but not stored yet. - Search activation is the user's own record: mode (all|custom) plus per-field on/off in users.preferences.gallery; source declarations never set defaults (unrecorded = off in custom mode). - image_info is read through a gallery-local struct, removing the compile dependency on the attribute-pipeline types; the gallery builds and runs with or without that feature deployed. - ListImages validates search_in / sort_by / attr_filters against the contract; ineligible fields are dropped, not served. * fix(frontend): inline the shared graph-drawer stylesheet (@import instead of <style src>) plugin-vue 6.0.6 keys unscoped src-style descriptors by the imported file path, so AgentStreamDisplay.vue and WikiBrowser.vue — both importing components/css/wiki-graph-drawer.less — overwrite each other during the build and the second one crashes with "reading 'scoped'". Adding the gallery changed the module order enough to make the collision hit every time. Inlining the same stylesheet keeps the emitted CSS identical and removes the shared descriptor key. * feat(gallery): render attributes from short labels with descriptions in tooltips A source could only say one thing about a value, so the filter panel had to put a full sentence inside a checkbox. Attributes and their values now carry two pieces of text: a short label for the space-constrained controls (checkbox, search field, sort option) and a description for wherever there is room (tooltip, detail panel). The contract's value list becomes an array of {value, label, description}, and the display helpers resolve each field separately: the gallery stamps the short name on a control and moves the sentence into a tooltip. Translation overlays are looked up per field, so a source that ships no gallery-specific text still picks up the attribute pipeline's own wording. * fix(gallery): let locale text win over the contract's wording The filter panel read the backend's own label before asking the locale, so a translated value never got a chance: the contract ships its own default-language wording, and it shadowed the overlay for every locale. Built keys were also off by a segment — imageAttr.<name> has to be imageAttr.<name>.label, and the gallery's own keys live under knowledgeEditor.wikiBrowser.gallery.attr — so builtin and system attributes fell through to English on a Chinese UI. * feat(gallery): top bar layout, pinned panels and per-value verdicts The toolbar moves onto its own row above the grid, so the controls no longer eat into the space the images are there for: search box, the two scope switches, sort field and direction, and the result count all sit in one flex row. The settings behind them are no longer inline either — each opens as a popover under its control and can be pinned to a right-hand rail, where the two panels take turns as tabs instead of both claiming width at once. Filtering gains a third state per attribute value. Where a value could only be picked or not picked, it can now be "off" (hide those images), "on" (show them whatever else says) or neutral (leave them alone), which is what lets one attribute's rules talk about an image another attribute tried to hide without the pair of them cancelling each other out: a forced display outranks a forced hide, and anything no rule speaks about stays visible. The switch that used to only exist inside the panel now has a toolbar home as well. "筛选:全显示" genuinely drops the attribute constraint instead of imposing it against a panel the user cannot see. Filtering used to empty the list the moment it was switched on. Any image whose attribute was never observed — every image ingested before the attribute pipeline existed — read as a mismatch for every filter, which is not narrowing a list but losing it. Absence now stays silence: an attribute no image carries places no constraint on it, until the pipeline catches up and fills the value in. Co-authored-by: WorkBuddy * feat(gallery): expose the image attribute pipeline as a gallery source The gallery's contract resolved to a single source, so the filter panel could only offer "Enabled" while the attributes the observe-and-describe pipeline fills in — contain.text, contain.data_visual — never reached the UI. The registry is a gallery attribute source like any other: every attribute it declares is offered to the gallery, filterable by default, with the config tiers able to override the usage flags at runtime. The registration lives in the attribute pipeline's own commit; this branch carried an earlier, squapshot of that work which predated the split of an attribute value into a short label and a description, so the registry's value shape and this file have been brought in line with it. Both PRs now hold byte-identical copies of the source hook, which is what lets either one land first and the other merge cleanly afterwards. Co-authored-by: WorkBuddy * fix(gallery): viewer race, pin icon, panel anchoring and scope wording Opening the viewer rendered the img element with the previous or empty source while the proxy fetch was still producing a blob, and the error that empty source fired locked the viewer in its failure state even after the real image arrived. The resolved source now lands before the flag is consulted, and a token keeps a slow fetch of one image from overwriting a faster one that navigated past it. The pin button drew nothing: TDesign has no "pushpin" glyph, so the button rendered as an empty shell. It now uses pin / pin-filled, keeps its place beside the tab bar, and a pinned rail assigns its columns explicitly — the panel precedes the main section in the DOM, so leaving the grid to source order handed the wide column to the panel and squeezed the images into the rail. The floating panel no longer appears at a hardcoded offset: it anchors just below the arrow that summoned it, the arrow flips up while its panel is out, a second press retracts, and any click elsewhere in the toolbar closes it. When a rail is pinned the arrows turn to the requested tab instead of spawning a second surface. The scope words (全部 / 全显示 / 自定义) become plain status text rather than a second dropdown — they name the current mode, and only the arrow beside them opens the panel that changes it. Co-authored-by: WorkBuddy * fix(web): align the OCR-on-unobserved switch with the other setting rows The switch sat bare inside its setting-row while every other switch on the page is wrapped in setting-control, which is what reserves the right column and centers the control vertically. With the row laid out from the top, the bare switch hugged the row's upper edge and crowded the description text — visibly out of place next to its neighbors. Wrapping it in setting-control gives it the same right-aligned, centered slot as the rest. Co-authored-by: WorkBuddy * fix(web): move the OCR-on-unobserved row out of the vertical schema row The row lived inside setting-row-vertical, whose descendant rule stretches every setting-info and setting-control beneath it to 100% width. Two full-width flex children side by side cannot fit, so the control overflowed the container and the switch landed past the right edge — visibly further out than the switch on the row above. The row and its note now sit beside the vertical block instead of inside it, under their own condition, so the switch shares the ordinary row layout and its right edge lines up with the "image attribute observation" switch above. Co-authored-by: WorkBuddy * fix(gallery): applying a verdict now activates the filter scope Setting an off/on verdict while the panel's master switch was off silently ignored it: buildParams only attaches attr_rules in custom scope, and setVerdict never flipped the scope. A verdict the user just expressed now switches the scope to custom; clearing the last meaningful verdict returns to all, since custom with no rules constrains nothing. * fix(gallery): search checkboxes stay visible and idle panels read as dimmed The search panel hid its field checkboxes while the master switch was on, so the only way to reach them was to flip the switch first. They now sit next to the switch like the filter panel's verdicts do: dimmed in all-field mode (where they carry no weight) yet clickable, and touching one drops the mode to custom. The filter panel's verdict rows dim the same way while the filter switch is off. * fix(gallery): bulk verdict row, neutral default mark, panel polish The clear-filters button never matched what the panel is for, so it is now a bulk verdict row: one set of -/off/on buttons that applies the chosen position to every value of every value-typed attribute, with the default mark turned into a language-neutral dash. The panel head drops its second divider (the tab bar already draws one) and the tabs follow the toolbar's order: search left, filter right. * fix(gallery): drop the all-fields caption and center the order arrow The caption above the search checkboxes showed and hid with the master switch, shoving the checkboxes down on every flip; it said nothing the dimmed state doesn't, so it is gone. The order button's arrow is an inline svg, which sits on the text baseline and reads as riding high; it now centers against the label. * fix(gallery): center the order arrow for real vertical-align never applied: the icon is a flex item inside the button's inline-flex text wrapper, and the wrapper's default stretch pins the explicitly-sized 16px icon to the top of the 22px line box. align-items: center on the wrapper is what actually centers it. * fix(gallery): shorten panel tab labels in en and ru The two-word labels overflowed the 300px panel and forced the tab bar into scroll arrows; single-word labels fit in every locale that was affected. * docs: drop the image pipeline rewrite from this branch The rewritten 'Go 侧接手后' paragraph belongs to the image attribute observation work (#3635), which this branch carries as a prerequisite and which already documents the caption_ocr / observation_driven split. Keeping a competing rewrite of the same paragraph on the gallery branch makes it collide with upstream, which extended that paragraph with the custom_instructions and inline HTML table notes. Restoring the shared wording keeps the gallery branch free of this file so upstream's edits merge cleanly. * style: gofmt the gallery attribute types Struct field tags in the resolved gallery config were one column narrow, so gofmt rebroke the alignment block. Whitespace only. * style(gallery): use design tokens in the gallery styles The style guard ratchet fails on any new violation. ImageGallery.vue shipped with 47 TDesign token fallbacks, 21 literal font sizes, 4 literal radii and a 0.15s transition; all of them now read the --app-* / --td-* tokens, which is what the guard asks for and what dark mode depends on. * lint(gallery): fix the golangci-lint findings in the gallery code lll: the three over-long swagger @Param lines and one registry row were shortened. ineffassign: ctx was assigned before the access check and then reassigned, so the first value was dead; it is now declared once, after the check. errcheck: the three unchecked c.Error calls in ListImages. revive: the AttrSpec / AttrValue doc comment block was attached to the wrong type and split into one block each. staticcheck S1016: the gallery registration converts the registry value instead of restating its fields. * lint(gallery): wrap the image query select and check the last c.Error * style: reformat the wrapped image select in chunk.go * fix(gallery): address review findings on ordering, KB switch and blob lifetime - sortImageAssets: swap operands for desc instead of negating, keeping a strict weak ordering so ties page stably - ImageGallery: reload on knowledgeBaseId change, drop stale list responses, fetch thumbnails in parallel with one cached blob per URL, revoke blobs on unmount, default sort to builtin:created_at - KnowledgeBase: non-wiki KBs with a stale wiki/graph tab fall back to documents again - handler: move ListImages godoc out of ListKnowledgeFolders' block and document attr_filters / attr_rules - DecideOCR: a payload with no OCR conditions uses the built-in policy instead of silently skipping OCR * docs(parsing): describe the caption_ocr and observation_driven image pipelines Carried over from #3635, which this PR supersedes. * fix(gallery): load local:// and other storage handles through the KB file proxy The gallery's own scheme check only caught resource://, provider:// and storage://, so local:// (the default storage), minio://, cos:// and s3:// images went straight into <img src> and never rendered. Resolve through isProviderFileURL, the scheme list chat and wiki already use, and lock the routing with a test. * fix(kb-editor): keep API-customised OCR conditions on save and upload The KB editor always wrote the registry default into image_actions.ocr.on, so any unrelated edit replaced a knowledge base's custom OCR conditions with the default table; the upload dialog did the same for the per-document override. Keep a stored custom list and fall back to the registry default only when there is none, and show the conditions actually in effect instead of the default table in both panels. * perf(gallery): de-duplicate, filter, sort and page images in SQL Every gallery request used to read every image-bearing chunk of the KB, OCR text included, decode it in Go and page in memory. A single query now expands the image_info arrays, keeps one row per image URL, applies the keyword / attribute / verdict / enabled filters and the sort, and returns only the page with the filtered total. The expansion carries narrow scalars only; filters and JSON sort keys are evaluated on the winning entry of each image, and the page's JSON is read back for its rows alone. Postgres runs the query with JIT off, since the fixed 100-rows-per-call estimate of jsonb_array_elements otherwise prices it ~100x high and compilation dominates. On 20k images with 2 KB of OCR text each (40k chunks), a page drops from ~750 ms to ~100-200 ms on postgres and ~200 ms on sqlite; keyword search over OCR text stays a full scan (~400-600 ms) until the text is indexed. The filter semantics are pinned against both databases. * perf(gallery): serve the gallery from a trigger-maintained chunk_images table Reading images out of chunks.image_info meant parsing every image chunk of the knowledge base on each request, so a page still cost time in proportion to the KB. chunk_images (versioned/000113, sqlite/000032) keeps one row per image_info entry with caption, OCR text and attributes as columns; triggers on chunks keep it in step with every write path, and the migration backfills existing chunks. Copies of one image stay separate rows and the query lists the copy on the most recently updated chunk through an indexed anti-join, so writes decide nothing and concurrent writers need no locking. On postgres, caption and OCR text get pg_trgm indexes when the extension is available. On 20k images with 2 KB of OCR text each (40k chunks): postgres first page 10 ms, page 500 41 ms, keyword 2 ms, filters 23 ms sqlite first page 3 ms, page 500 39 ms, keyword 147 ms, filters 51 ms down from ~100-600 ms. Writing those 40k image chunks costs 7.0 s instead of 1.3 s on postgres (1.9 s instead of 1.0 s on sqlite), mostly the trigram indexes; status and enable-flag updates patch rows in place. --------- Co-authored-by: tayadwx <tayadwx@users.noreply.github.com> Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 04:33:59 +00:00
// 图片属性观察配置:后端是整体替换语义(payload 不带该字段 = 保持不变)。
// UI 只编辑观察开关与 on_unobserved;快照里用 API 自定义过的 on 原样保留,
// 没有自定义时才取注册表默认值。合并规则见 buildImageProcessingConfig。
{
const built = buildImageProcessingConfig(formData.value.imageProcessingConfigSnapshot, {
imageAttrsEnabled: formData.value.imageAttrsEnabled,
onUnobserved: formData.value.imageActions.ocr.on_unobserved,
defaultOn: displaySchema.value.default_actions.ocr.on,
})
if (built) {
data.image_processing_config = built
}
}
// 添加ASR语音识别配置
data.asr_config = {
enabled: formData.value.asrConfig?.enabled || false,
model_id: formData.value.asrConfig?.enabled
? (formData.value.asrConfig?.modelId || '')
: '',
language: formData.value.asrConfig?.language || ''
}
// storage_backend_id is authoritative. Keep provider projection for old clients
// and for rolling upgrades where a node has not picked up the new schema yet.
if (formData.value.storageBackendId) {
data.storage_backend_id = formData.value.storageBackendId
}
const storageProvider = resolvedStorageProvider()
data.storage_provider_config = {
provider: storageProvider
}
data.storage_config = {
provider: storageProvider
}
// 添加知识图谱配置 — now synced via indexingStrategy.graphEnabled
// extract_config is sent below along with indexing_strategy
// 添加问题生成配置
if (formData.value.questionGenerationConfig?.enabled) {
data.question_generation_config = {
enabled: true,
question_count: formData.value.questionGenerationConfig.questionCount || 3,
custom_instructions: formData.value.questionGenerationConfig.customInstructions || ''
}
} else {
data.question_generation_config = {
enabled: false,
question_count: 3,
custom_instructions: formData.value.questionGenerationConfig?.customInstructions || ''
}
}
data.auto_tag_config = {
enabled: formData.value.autoTagConfig?.enabled || false,
model_id: formData.value.autoTagConfig?.modelId || '',
fix(knowledge): harden auto-tagging and let it respect manual tags Automatic tagging shipped with a few paths that quietly disabled it and a prompt that spent most of its budget on data the model never needed. Robustness: - Treat an omitted confidence as a deliberate selection instead of zero. Models frequently drop the field, and the 0.75 floor then filtered out every match, silently turning the feature off. Percentage-scale values are rescaled rather than accepted as out-of-range certainty. - Classify the first 500 tags when a knowledge base has more, logging a warning, instead of dropping the task entirely. Large knowledge bases previously got no auto-tagging at all with no user-visible signal. - Reuse common.ParseLLMJsonResponse for the model reply, and give that helper a balanced-scan fallback. The local extraction cut the payload at the last "}" or "]", so a trailing citation such as "see [1]" produced invalid JSON and burned the task's retries. Prompt: - Address candidates by ordinal rather than UUID. Tag names are short while a UUID is 36 characters, so this cuts candidate tokens roughly tenfold, keeps the model from having to reproduce (and corrupt) an id, and is what makes the raised 500 ceiling affordable. Ordinals are range-checked and mapped back to ids server-side. - Drop the rationale field. Nothing read it, and at max_tags=10 it competed with the 1024-token output budget and risked truncating the JSON. - Fence document text in <document> so file content cannot be read as instructions. Behaviour: - Add auto_tag_config.skip_if_tagged, defaulting to true, so documents the user already tagged at upload time keep their classification. Existing tags are now loaded before the model call, so a skipped document costs no LLM round-trip. Configs stored without the field adopt the default. Also promote AddKnowledgeTagRelations to KnowledgeRepository instead of reaching for it through a type assertion that failed at runtime, and route the max_tags bounds through AutoTagConfig.Normalize so the prompt, the match filter and the persisted config cannot drift apart. Adds handler-level coverage for scope, cancellation, idempotency, ordinal validation and the new toggle, plus SDK, Swagger and API doc updates.
2026-08-07 07:32:16 +00:00
max_tags: formData.value.autoTagConfig?.maxTags || 3,
skip_if_tagged: formData.value.autoTagConfig?.skipIfTagged ?? true
}
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
data.profile_config = {
enabled: formData.value.profileConfig?.enabled || false,
model_id: formData.value.profileConfig?.modelId || '',
custom_instructions: formData.value.profileConfig?.customInstructions || ''
}
if (formData.value.type === 'faq') {
data.faq_config = {
index_mode: formData.value.faqConfig?.indexMode || 'question_only',
question_index_mode: formData.value.faqConfig?.questionIndexMode || 'separate'
}
}
// Wiki enablement is carried solely by indexing_strategy.wiki_enabled.
// wiki_config only holds wiki-specific tunables.
if (formData.value.type !== 'faq') {
feat: Implement comprehensive wiki feature for knowledge bases This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes: **Backend Changes:** - Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log) - Database schema: wiki_pages table with full migration support - WikiPageService: CRUD operations and page management - WikiPageRepository: GORM-based persistence layer - Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents * Summary page generation using LLM * Entity and concept extraction in a single LLM call * Synthesis opportunity detection * Index page rebuilding * Log page maintenance - Wiki boost feature: Enhance chat retrieval with wiki context - Wiki linting: Maintenance and validation utilities - Agent wiki tools: Enable agents to query and interact with wiki pages - Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks - Language support: Reuse existing middleware language infrastructure for LLM prompts **Frontend Changes:** - Wiki browser UI: View all wiki pages with filtering and search - Wiki API client: Knowledge base wiki management endpoints - Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model) - i18n updates: Support for English, Korean, Russian, and Chinese interfaces **Configuration:** - Container DI: Wire up all wiki services - Router: Register wiki API endpoints - Task handling: Support async wiki ingest tasks **Testing:** - Unit tests for wiki page types - Service layer tests - Endpoint tests for wiki operations - Integration tests with LLM mocking **Documentation:** - Language refactoring analysis and guides - Implementation completion reports - Quick reference guides for developers **Key Features:** ✅ LLM-powered wiki page generation from documents ✅ Multi-language support (9+ languages) ✅ Automatic extraction of entities and concepts ✅ Synthesis opportunity detection ✅ Index and log page maintenance ✅ Progressive wiki building across multiple documents ✅ Agent-based wiki interaction ✅ Chat retrieval enhancement with wiki context ✅ Full frontend UI for wiki browsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 05:56:13 +00:00
data.wiki_config = {
synthesis_model_id: formData.value.modelConfig?.wikiSynthesisModelId || '',
feat: Implement comprehensive wiki feature for knowledge bases This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes: **Backend Changes:** - Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log) - Database schema: wiki_pages table with full migration support - WikiPageService: CRUD operations and page management - WikiPageRepository: GORM-based persistence layer - Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents * Summary page generation using LLM * Entity and concept extraction in a single LLM call * Synthesis opportunity detection * Index page rebuilding * Log page maintenance - Wiki boost feature: Enhance chat retrieval with wiki context - Wiki linting: Maintenance and validation utilities - Agent wiki tools: Enable agents to query and interact with wiki pages - Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks - Language support: Reuse existing middleware language infrastructure for LLM prompts **Frontend Changes:** - Wiki browser UI: View all wiki pages with filtering and search - Wiki API client: Knowledge base wiki management endpoints - Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model) - i18n updates: Support for English, Korean, Russian, and Chinese interfaces **Configuration:** - Container DI: Wire up all wiki services - Router: Register wiki API endpoints - Task handling: Support async wiki ingest tasks **Testing:** - Unit tests for wiki page types - Service layer tests - Endpoint tests for wiki operations - Integration tests with LLM mocking **Documentation:** - Language refactoring analysis and guides - Implementation completion reports - Quick reference guides for developers **Key Features:** ✅ LLM-powered wiki page generation from documents ✅ Multi-language support (9+ languages) ✅ Automatic extraction of entities and concepts ✅ Synthesis opportunity detection ✅ Index and log page maintenance ✅ Progressive wiki building across multiple documents ✅ Agent-based wiki interaction ✅ Chat retrieval enhancement with wiki context ✅ Full frontend UI for wiki browsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 05:56:13 +00:00
max_pages_per_ingest: formData.value.wikiConfig?.maxPagesPerIngest || 0,
extraction_granularity: formData.value.wikiConfig?.extractionGranularity || 'standard',
content_instructions: formData.value.wikiConfig?.contentInstructions || '',
extraction_instructions: formData.value.wikiConfig?.extractionInstructions || '',
feat: Implement comprehensive wiki feature for knowledge bases This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes: **Backend Changes:** - Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log) - Database schema: wiki_pages table with full migration support - WikiPageService: CRUD operations and page management - WikiPageRepository: GORM-based persistence layer - Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents * Summary page generation using LLM * Entity and concept extraction in a single LLM call * Synthesis opportunity detection * Index page rebuilding * Log page maintenance - Wiki boost feature: Enhance chat retrieval with wiki context - Wiki linting: Maintenance and validation utilities - Agent wiki tools: Enable agents to query and interact with wiki pages - Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks - Language support: Reuse existing middleware language infrastructure for LLM prompts **Frontend Changes:** - Wiki browser UI: View all wiki pages with filtering and search - Wiki API client: Knowledge base wiki management endpoints - Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model) - i18n updates: Support for English, Korean, Russian, and Chinese interfaces **Configuration:** - Container DI: Wire up all wiki services - Router: Register wiki API endpoints - Task handling: Support async wiki ingest tasks **Testing:** - Unit tests for wiki page types - Service layer tests - Endpoint tests for wiki operations - Integration tests with LLM mocking **Documentation:** - Language refactoring analysis and guides - Implementation completion reports - Quick reference guides for developers **Key Features:** ✅ LLM-powered wiki page generation from documents ✅ Multi-language support (9+ languages) ✅ Automatic extraction of entities and concepts ✅ Synthesis opportunity detection ✅ Index and log page maintenance ✅ Progressive wiki building across multiple documents ✅ Agent-based wiki interaction ✅ Chat retrieval enhancement with wiki context ✅ Full frontend UI for wiki browsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 05:56:13 +00:00
}
}
// Send indexing strategy
if (formData.value.type !== 'faq') {
data.indexing_strategy = {
vector_enabled: formData.value.indexingStrategy?.vectorEnabled ?? true,
keyword_enabled: formData.value.indexingStrategy?.keywordEnabled ?? true,
wiki_enabled: formData.value.indexingStrategy?.wikiEnabled ?? false,
graph_enabled: formData.value.indexingStrategy?.graphEnabled ?? false,
}
}
// Always persist extract_config so the toggle state from GraphSettings is saved,
// regardless of whether the graph indexing strategy is currently enabled.
if (formData.value.nodeExtractConfig) {
data.extract_config = {
enabled: !!formData.value.nodeExtractConfig.enabled,
text: formData.value.nodeExtractConfig.text || '',
tags: formData.value.nodeExtractConfig.tags || [],
nodes: formData.value.nodeExtractConfig.nodes || [],
relations: formData.value.nodeExtractConfig.relations || [],
custom_instructions: formData.value.nodeExtractConfig.customInstructions || ''
}
}
return data
}
// 提交表单
const handleSubmit = async () => {
if (!validateForm()) {
return
}
// 编辑模式下,若已有文件且存储引擎发生了变化,弹窗确认
if (
editorMode.value === 'edit' &&
hasFiles.value &&
formData.value &&
initialStorageProvider.value &&
formData.value.storageProvider !== initialStorageProvider.value
) {
const dialog = DialogPlugin.confirm({
header: t('common.confirm'),
body: t('knowledgeEditor.messages.storageChangeConfirm'),
confirmBtn: t('common.confirm'),
cancelBtn: t('common.cancel'),
onConfirm: () => {
dialog.destroy()
doSubmit()
},
onCancel: () => {
dialog.destroy()
},
})
return
}
doSubmit()
}
const doSubmit = async () => {
saving.value = true
try {
const data = buildSubmitData()
if (!data) {
throw new Error(t('knowledgeEditor.messages.buildDataFailed'))
}
if (editorMode.value === 'create') {
// 创建模式:一次性创建知识库及所有配置
const result: any = await createKnowledgeBase(data)
if (!result.success || !result.data?.id) {
throw new Error(result.message || t('knowledgeEditor.messages.createFailed'))
}
const createdKbId = result.data.id as string
savedKbId.value = createdKbId
currentSection.value = 'basic'
await loadKBData(createdKbId)
MessagePlugin.success(t('knowledgeEditor.messages.createSuccess'))
markContextualGuideDone('kbCreate')
emit('success', createdKbId)
} else {
// 编辑模式:分别更新基本信息和配置
const kbId = activeKbId.value
if (!kbId) {
throw new Error(t('knowledgeEditor.messages.missingId'))
}
feat: Implement comprehensive wiki feature for knowledge bases This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes: **Backend Changes:** - Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log) - Database schema: wiki_pages table with full migration support - WikiPageService: CRUD operations and page management - WikiPageRepository: GORM-based persistence layer - Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents * Summary page generation using LLM * Entity and concept extraction in a single LLM call * Synthesis opportunity detection * Index page rebuilding * Log page maintenance - Wiki boost feature: Enhance chat retrieval with wiki context - Wiki linting: Maintenance and validation utilities - Agent wiki tools: Enable agents to query and interact with wiki pages - Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks - Language support: Reuse existing middleware language infrastructure for LLM prompts **Frontend Changes:** - Wiki browser UI: View all wiki pages with filtering and search - Wiki API client: Knowledge base wiki management endpoints - Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model) - i18n updates: Support for English, Korean, Russian, and Chinese interfaces **Configuration:** - Container DI: Wire up all wiki services - Router: Register wiki API endpoints - Task handling: Support async wiki ingest tasks **Testing:** - Unit tests for wiki page types - Service layer tests - Endpoint tests for wiki operations - Integration tests with LLM mocking **Documentation:** - Language refactoring analysis and guides - Implementation completion reports - Quick reference guides for developers **Key Features:** ✅ LLM-powered wiki page generation from documents ✅ Multi-language support (9+ languages) ✅ Automatic extraction of entities and concepts ✅ Synthesis opportunity detection ✅ Index and log page maintenance ✅ Progressive wiki building across multiple documents ✅ Agent-based wiki interaction ✅ Chat retrieval enhancement with wiki context ✅ Full frontend UI for wiki browsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 05:56:13 +00:00
// 1. 更新基本信息(名称、描述)和 FAQ/Wiki 配置
const updateConfig: any = {}
if (formData.value.type === 'faq' && formData.value.faqConfig) {
updateConfig.faq_config = {
index_mode: formData.value.faqConfig.indexMode || 'question_only',
question_index_mode: formData.value.faqConfig.questionIndexMode || 'separate'
}
}
if (formData.value.wikiConfig && formData.value.type !== 'faq') {
feat: Implement comprehensive wiki feature for knowledge bases This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes: **Backend Changes:** - Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log) - Database schema: wiki_pages table with full migration support - WikiPageService: CRUD operations and page management - WikiPageRepository: GORM-based persistence layer - Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents * Summary page generation using LLM * Entity and concept extraction in a single LLM call * Synthesis opportunity detection * Index page rebuilding * Log page maintenance - Wiki boost feature: Enhance chat retrieval with wiki context - Wiki linting: Maintenance and validation utilities - Agent wiki tools: Enable agents to query and interact with wiki pages - Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks - Language support: Reuse existing middleware language infrastructure for LLM prompts **Frontend Changes:** - Wiki browser UI: View all wiki pages with filtering and search - Wiki API client: Knowledge base wiki management endpoints - Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model) - i18n updates: Support for English, Korean, Russian, and Chinese interfaces **Configuration:** - Container DI: Wire up all wiki services - Router: Register wiki API endpoints - Task handling: Support async wiki ingest tasks **Testing:** - Unit tests for wiki page types - Service layer tests - Endpoint tests for wiki operations - Integration tests with LLM mocking **Documentation:** - Language refactoring analysis and guides - Implementation completion reports - Quick reference guides for developers **Key Features:** ✅ LLM-powered wiki page generation from documents ✅ Multi-language support (9+ languages) ✅ Automatic extraction of entities and concepts ✅ Synthesis opportunity detection ✅ Index and log page maintenance ✅ Progressive wiki building across multiple documents ✅ Agent-based wiki interaction ✅ Chat retrieval enhancement with wiki context ✅ Full frontend UI for wiki browsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 05:56:13 +00:00
updateConfig.wiki_config = {
synthesis_model_id: formData.value.modelConfig?.wikiSynthesisModelId || '',
feat: Implement comprehensive wiki feature for knowledge bases This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes: **Backend Changes:** - Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log) - Database schema: wiki_pages table with full migration support - WikiPageService: CRUD operations and page management - WikiPageRepository: GORM-based persistence layer - Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents * Summary page generation using LLM * Entity and concept extraction in a single LLM call * Synthesis opportunity detection * Index page rebuilding * Log page maintenance - Wiki boost feature: Enhance chat retrieval with wiki context - Wiki linting: Maintenance and validation utilities - Agent wiki tools: Enable agents to query and interact with wiki pages - Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks - Language support: Reuse existing middleware language infrastructure for LLM prompts **Frontend Changes:** - Wiki browser UI: View all wiki pages with filtering and search - Wiki API client: Knowledge base wiki management endpoints - Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model) - i18n updates: Support for English, Korean, Russian, and Chinese interfaces **Configuration:** - Container DI: Wire up all wiki services - Router: Register wiki API endpoints - Task handling: Support async wiki ingest tasks **Testing:** - Unit tests for wiki page types - Service layer tests - Endpoint tests for wiki operations - Integration tests with LLM mocking **Documentation:** - Language refactoring analysis and guides - Implementation completion reports - Quick reference guides for developers **Key Features:** ✅ LLM-powered wiki page generation from documents ✅ Multi-language support (9+ languages) ✅ Automatic extraction of entities and concepts ✅ Synthesis opportunity detection ✅ Index and log page maintenance ✅ Progressive wiki building across multiple documents ✅ Agent-based wiki interaction ✅ Chat retrieval enhancement with wiki context ✅ Full frontend UI for wiki browsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 05:56:13 +00:00
max_pages_per_ingest: formData.value.wikiConfig.maxPagesPerIngest || 0,
extraction_granularity: formData.value.wikiConfig.extractionGranularity || 'standard',
content_instructions: formData.value.wikiConfig.contentInstructions || '',
extraction_instructions: formData.value.wikiConfig.extractionInstructions || '',
feat: Implement comprehensive wiki feature for knowledge bases This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes: **Backend Changes:** - Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log) - Database schema: wiki_pages table with full migration support - WikiPageService: CRUD operations and page management - WikiPageRepository: GORM-based persistence layer - Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents * Summary page generation using LLM * Entity and concept extraction in a single LLM call * Synthesis opportunity detection * Index page rebuilding * Log page maintenance - Wiki boost feature: Enhance chat retrieval with wiki context - Wiki linting: Maintenance and validation utilities - Agent wiki tools: Enable agents to query and interact with wiki pages - Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks - Language support: Reuse existing middleware language infrastructure for LLM prompts **Frontend Changes:** - Wiki browser UI: View all wiki pages with filtering and search - Wiki API client: Knowledge base wiki management endpoints - Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model) - i18n updates: Support for English, Korean, Russian, and Chinese interfaces **Configuration:** - Container DI: Wire up all wiki services - Router: Register wiki API endpoints - Task handling: Support async wiki ingest tasks **Testing:** - Unit tests for wiki page types - Service layer tests - Endpoint tests for wiki operations - Integration tests with LLM mocking **Documentation:** - Language refactoring analysis and guides - Implementation completion reports - Quick reference guides for developers **Key Features:** ✅ LLM-powered wiki page generation from documents ✅ Multi-language support (9+ languages) ✅ Automatic extraction of entities and concepts ✅ Synthesis opportunity detection ✅ Index and log page maintenance ✅ Progressive wiki building across multiple documents ✅ Agent-based wiki interaction ✅ Chat retrieval enhancement with wiki context ✅ Full frontend UI for wiki browsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 05:56:13 +00:00
}
}
if (formData.value.type !== 'faq') {
updateConfig.auto_tag_config = data.auto_tag_config
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
updateConfig.profile_config = data.profile_config
updateConfig.indexing_strategy = {
vector_enabled: formData.value.indexingStrategy?.vectorEnabled ?? true,
keyword_enabled: formData.value.indexingStrategy?.keywordEnabled ?? true,
wiki_enabled: formData.value.indexingStrategy?.wikiEnabled ?? false,
graph_enabled: formData.value.indexingStrategy?.graphEnabled ?? false,
}
}
feat(gallery): add an image gallery tab with schema-driven filters (#3694) * feat(image): observe image attributes and let the policy decide OCR Describe each image with the VLM as before, but ask it to also observe two attributes about the image in the same round — how much body text it carries (contain.text) and whether it presents data visually (contain.data_visual) — then let a small pure function decide whether that image is worth a second, separate OCR round. Per-class OCR was the first shape of this idea; a class (chart / photo / logo) is only an indirect proxy for 'is there text worth reading here', and the class table has to grow whenever a new kind of image shows up. The decision actually needs the observed attributes, so it reads them directly, and the attribute set is a backend registry row rather than a new class. The observation and the caption share one VLM call; OCR stays a separate call (prompt isolation, see #3291). An attribute the model does not answer for is left absent rather than filled with a conservative default, so the trace never claims an observation that did not happen, and an incomplete observation falls back to the on_unobserved policy (OCR still runs). The registry also carries the panel's display text, so a new attribute needs no frontend change. Off by default: image_attrs_enabled=false keeps today's behaviour (one caption and one OCR per image). KB config: image_processing_config.image_attrs_enabled / image_actions; per-upload override via process_config. Registry: GET /api/v1/image-attrs/schema. * feat(gallery): add image gallery tab with schema-driven filters Adds a 4th knowledge-base tab parallel to Documents/Wiki/Graph that browses every image asset in a KB. Backend: - GET /api/v1/knowledge-bases/:id/images lists image assets projected from chunks.image_info, with keyword (caption/OCR), multi-value attribute (attr_<name>=<value>), is_enabled and sort filters applied in memory, plus pagination. - Resolves the source knowledge item title (SourceName) via a batched GetKnowledgeBatch so the viewer can show a human-readable source. Frontend: - ImageGallery.vue: thumbnail grid + search/sort + schema-driven filter panel (from GET /image-attrs/schema) + single-image viewer with prev/next, attributes/caption/OCR/source. - Wired as the gallery tab in KnowledgeBase.vue; i18n keys in all 5 locales. * feat(gallery): drive filters/search/sort from a configurable attribute contract The gallery UI is no longer hardcoded: it renders from a self-describing contract served by GET /knowledge-bases/:id/gallery-config (live attribute sources, every attribute's definition with usage flags merged across the config tiers, and the caller's search activation state). - Attribute sources form an open registry (types.RegisterGalleryAttrSource); a builtin source models caption/ocr_text/timestamps/enabled so the gallery has zero special cases. - Usage resolution: user > KB > system > source, field by field; the system tier lives in system_settings (gallery.policy, JSON, no rebuild), the KB tier slot is wired in the engine but not stored yet. - Search activation is the user's own record: mode (all|custom) plus per-field on/off in users.preferences.gallery; source declarations never set defaults (unrecorded = off in custom mode). - image_info is read through a gallery-local struct, removing the compile dependency on the attribute-pipeline types; the gallery builds and runs with or without that feature deployed. - ListImages validates search_in / sort_by / attr_filters against the contract; ineligible fields are dropped, not served. * fix(frontend): inline the shared graph-drawer stylesheet (@import instead of <style src>) plugin-vue 6.0.6 keys unscoped src-style descriptors by the imported file path, so AgentStreamDisplay.vue and WikiBrowser.vue — both importing components/css/wiki-graph-drawer.less — overwrite each other during the build and the second one crashes with "reading 'scoped'". Adding the gallery changed the module order enough to make the collision hit every time. Inlining the same stylesheet keeps the emitted CSS identical and removes the shared descriptor key. * feat(gallery): render attributes from short labels with descriptions in tooltips A source could only say one thing about a value, so the filter panel had to put a full sentence inside a checkbox. Attributes and their values now carry two pieces of text: a short label for the space-constrained controls (checkbox, search field, sort option) and a description for wherever there is room (tooltip, detail panel). The contract's value list becomes an array of {value, label, description}, and the display helpers resolve each field separately: the gallery stamps the short name on a control and moves the sentence into a tooltip. Translation overlays are looked up per field, so a source that ships no gallery-specific text still picks up the attribute pipeline's own wording. * fix(gallery): let locale text win over the contract's wording The filter panel read the backend's own label before asking the locale, so a translated value never got a chance: the contract ships its own default-language wording, and it shadowed the overlay for every locale. Built keys were also off by a segment — imageAttr.<name> has to be imageAttr.<name>.label, and the gallery's own keys live under knowledgeEditor.wikiBrowser.gallery.attr — so builtin and system attributes fell through to English on a Chinese UI. * feat(gallery): top bar layout, pinned panels and per-value verdicts The toolbar moves onto its own row above the grid, so the controls no longer eat into the space the images are there for: search box, the two scope switches, sort field and direction, and the result count all sit in one flex row. The settings behind them are no longer inline either — each opens as a popover under its control and can be pinned to a right-hand rail, where the two panels take turns as tabs instead of both claiming width at once. Filtering gains a third state per attribute value. Where a value could only be picked or not picked, it can now be "off" (hide those images), "on" (show them whatever else says) or neutral (leave them alone), which is what lets one attribute's rules talk about an image another attribute tried to hide without the pair of them cancelling each other out: a forced display outranks a forced hide, and anything no rule speaks about stays visible. The switch that used to only exist inside the panel now has a toolbar home as well. "筛选:全显示" genuinely drops the attribute constraint instead of imposing it against a panel the user cannot see. Filtering used to empty the list the moment it was switched on. Any image whose attribute was never observed — every image ingested before the attribute pipeline existed — read as a mismatch for every filter, which is not narrowing a list but losing it. Absence now stays silence: an attribute no image carries places no constraint on it, until the pipeline catches up and fills the value in. Co-authored-by: WorkBuddy * feat(gallery): expose the image attribute pipeline as a gallery source The gallery's contract resolved to a single source, so the filter panel could only offer "Enabled" while the attributes the observe-and-describe pipeline fills in — contain.text, contain.data_visual — never reached the UI. The registry is a gallery attribute source like any other: every attribute it declares is offered to the gallery, filterable by default, with the config tiers able to override the usage flags at runtime. The registration lives in the attribute pipeline's own commit; this branch carried an earlier, squapshot of that work which predated the split of an attribute value into a short label and a description, so the registry's value shape and this file have been brought in line with it. Both PRs now hold byte-identical copies of the source hook, which is what lets either one land first and the other merge cleanly afterwards. Co-authored-by: WorkBuddy * fix(gallery): viewer race, pin icon, panel anchoring and scope wording Opening the viewer rendered the img element with the previous or empty source while the proxy fetch was still producing a blob, and the error that empty source fired locked the viewer in its failure state even after the real image arrived. The resolved source now lands before the flag is consulted, and a token keeps a slow fetch of one image from overwriting a faster one that navigated past it. The pin button drew nothing: TDesign has no "pushpin" glyph, so the button rendered as an empty shell. It now uses pin / pin-filled, keeps its place beside the tab bar, and a pinned rail assigns its columns explicitly — the panel precedes the main section in the DOM, so leaving the grid to source order handed the wide column to the panel and squeezed the images into the rail. The floating panel no longer appears at a hardcoded offset: it anchors just below the arrow that summoned it, the arrow flips up while its panel is out, a second press retracts, and any click elsewhere in the toolbar closes it. When a rail is pinned the arrows turn to the requested tab instead of spawning a second surface. The scope words (全部 / 全显示 / 自定义) become plain status text rather than a second dropdown — they name the current mode, and only the arrow beside them opens the panel that changes it. Co-authored-by: WorkBuddy * fix(web): align the OCR-on-unobserved switch with the other setting rows The switch sat bare inside its setting-row while every other switch on the page is wrapped in setting-control, which is what reserves the right column and centers the control vertically. With the row laid out from the top, the bare switch hugged the row's upper edge and crowded the description text — visibly out of place next to its neighbors. Wrapping it in setting-control gives it the same right-aligned, centered slot as the rest. Co-authored-by: WorkBuddy * fix(web): move the OCR-on-unobserved row out of the vertical schema row The row lived inside setting-row-vertical, whose descendant rule stretches every setting-info and setting-control beneath it to 100% width. Two full-width flex children side by side cannot fit, so the control overflowed the container and the switch landed past the right edge — visibly further out than the switch on the row above. The row and its note now sit beside the vertical block instead of inside it, under their own condition, so the switch shares the ordinary row layout and its right edge lines up with the "image attribute observation" switch above. Co-authored-by: WorkBuddy * fix(gallery): applying a verdict now activates the filter scope Setting an off/on verdict while the panel's master switch was off silently ignored it: buildParams only attaches attr_rules in custom scope, and setVerdict never flipped the scope. A verdict the user just expressed now switches the scope to custom; clearing the last meaningful verdict returns to all, since custom with no rules constrains nothing. * fix(gallery): search checkboxes stay visible and idle panels read as dimmed The search panel hid its field checkboxes while the master switch was on, so the only way to reach them was to flip the switch first. They now sit next to the switch like the filter panel's verdicts do: dimmed in all-field mode (where they carry no weight) yet clickable, and touching one drops the mode to custom. The filter panel's verdict rows dim the same way while the filter switch is off. * fix(gallery): bulk verdict row, neutral default mark, panel polish The clear-filters button never matched what the panel is for, so it is now a bulk verdict row: one set of -/off/on buttons that applies the chosen position to every value of every value-typed attribute, with the default mark turned into a language-neutral dash. The panel head drops its second divider (the tab bar already draws one) and the tabs follow the toolbar's order: search left, filter right. * fix(gallery): drop the all-fields caption and center the order arrow The caption above the search checkboxes showed and hid with the master switch, shoving the checkboxes down on every flip; it said nothing the dimmed state doesn't, so it is gone. The order button's arrow is an inline svg, which sits on the text baseline and reads as riding high; it now centers against the label. * fix(gallery): center the order arrow for real vertical-align never applied: the icon is a flex item inside the button's inline-flex text wrapper, and the wrapper's default stretch pins the explicitly-sized 16px icon to the top of the 22px line box. align-items: center on the wrapper is what actually centers it. * fix(gallery): shorten panel tab labels in en and ru The two-word labels overflowed the 300px panel and forced the tab bar into scroll arrows; single-word labels fit in every locale that was affected. * docs: drop the image pipeline rewrite from this branch The rewritten 'Go 侧接手后' paragraph belongs to the image attribute observation work (#3635), which this branch carries as a prerequisite and which already documents the caption_ocr / observation_driven split. Keeping a competing rewrite of the same paragraph on the gallery branch makes it collide with upstream, which extended that paragraph with the custom_instructions and inline HTML table notes. Restoring the shared wording keeps the gallery branch free of this file so upstream's edits merge cleanly. * style: gofmt the gallery attribute types Struct field tags in the resolved gallery config were one column narrow, so gofmt rebroke the alignment block. Whitespace only. * style(gallery): use design tokens in the gallery styles The style guard ratchet fails on any new violation. ImageGallery.vue shipped with 47 TDesign token fallbacks, 21 literal font sizes, 4 literal radii and a 0.15s transition; all of them now read the --app-* / --td-* tokens, which is what the guard asks for and what dark mode depends on. * lint(gallery): fix the golangci-lint findings in the gallery code lll: the three over-long swagger @Param lines and one registry row were shortened. ineffassign: ctx was assigned before the access check and then reassigned, so the first value was dead; it is now declared once, after the check. errcheck: the three unchecked c.Error calls in ListImages. revive: the AttrSpec / AttrValue doc comment block was attached to the wrong type and split into one block each. staticcheck S1016: the gallery registration converts the registry value instead of restating its fields. * lint(gallery): wrap the image query select and check the last c.Error * style: reformat the wrapped image select in chunk.go * fix(gallery): address review findings on ordering, KB switch and blob lifetime - sortImageAssets: swap operands for desc instead of negating, keeping a strict weak ordering so ties page stably - ImageGallery: reload on knowledgeBaseId change, drop stale list responses, fetch thumbnails in parallel with one cached blob per URL, revoke blobs on unmount, default sort to builtin:created_at - KnowledgeBase: non-wiki KBs with a stale wiki/graph tab fall back to documents again - handler: move ListImages godoc out of ListKnowledgeFolders' block and document attr_filters / attr_rules - DecideOCR: a payload with no OCR conditions uses the built-in policy instead of silently skipping OCR * docs(parsing): describe the caption_ocr and observation_driven image pipelines Carried over from #3635, which this PR supersedes. * fix(gallery): load local:// and other storage handles through the KB file proxy The gallery's own scheme check only caught resource://, provider:// and storage://, so local:// (the default storage), minio://, cos:// and s3:// images went straight into <img src> and never rendered. Resolve through isProviderFileURL, the scheme list chat and wiki already use, and lock the routing with a test. * fix(kb-editor): keep API-customised OCR conditions on save and upload The KB editor always wrote the registry default into image_actions.ocr.on, so any unrelated edit replaced a knowledge base's custom OCR conditions with the default table; the upload dialog did the same for the per-document override. Keep a stored custom list and fall back to the registry default only when there is none, and show the conditions actually in effect instead of the default table in both panels. * perf(gallery): de-duplicate, filter, sort and page images in SQL Every gallery request used to read every image-bearing chunk of the KB, OCR text included, decode it in Go and page in memory. A single query now expands the image_info arrays, keeps one row per image URL, applies the keyword / attribute / verdict / enabled filters and the sort, and returns only the page with the filtered total. The expansion carries narrow scalars only; filters and JSON sort keys are evaluated on the winning entry of each image, and the page's JSON is read back for its rows alone. Postgres runs the query with JIT off, since the fixed 100-rows-per-call estimate of jsonb_array_elements otherwise prices it ~100x high and compilation dominates. On 20k images with 2 KB of OCR text each (40k chunks), a page drops from ~750 ms to ~100-200 ms on postgres and ~200 ms on sqlite; keyword search over OCR text stays a full scan (~400-600 ms) until the text is indexed. The filter semantics are pinned against both databases. * perf(gallery): serve the gallery from a trigger-maintained chunk_images table Reading images out of chunks.image_info meant parsing every image chunk of the knowledge base on each request, so a page still cost time in proportion to the KB. chunk_images (versioned/000113, sqlite/000032) keeps one row per image_info entry with caption, OCR text and attributes as columns; triggers on chunks keep it in step with every write path, and the migration backfills existing chunks. Copies of one image stay separate rows and the query lists the copy on the most recently updated chunk through an indexed anti-join, so writes decide nothing and concurrent writers need no locking. On postgres, caption and OCR text get pg_trgm indexes when the extension is available. On 20k images with 2 KB of OCR text each (40k chunks): postgres first page 10 ms, page 500 41 ms, keyword 2 ms, filters 23 ms sqlite first page 3 ms, page 500 39 ms, keyword 147 ms, filters 51 ms down from ~100-600 ms. Writing those 40k image chunks costs 7.0 s instead of 1.3 s on postgres (1.9 s instead of 1.0 s on sqlite), mostly the trigram indexes; status and enable-flag updates patch rows in place. --------- Co-authored-by: tayadwx <tayadwx@users.noreply.github.com> Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 04:33:59 +00:00
// 图片分类配置:buildSubmitData 只在与快照有差异时才产出该字段,带上即
// 整体替换(后端语义:字段缺失 = 保持不变)。编辑模式此前漏带,导致 KB
// 编辑器里对图片分类的修改被静默丢弃(新建时能存、之后再改无效)。
if (data.image_processing_config) {
updateConfig.image_processing_config = data.image_processing_config
}
await updateKnowledgeBase(kbId, {
name: data.name,
description: data.description,
config: updateConfig
})
// 2. 更新完整配置(模型、分块、多模态、存储引擎、知识图谱等)
const config: KBModelConfigRequest = {
llmModelId: data.summary_model_id,
embeddingModelId: data.embedding_model_id,
vlm_config: data.vlm_config,
asr_config: data.asr_config,
documentSplitting: {
chunkSize: data.chunking_config.chunk_size,
chunkOverlap: data.chunking_config.chunk_overlap,
separators: data.chunking_config.separators,
parserEngineRules: data.chunking_config.parser_engine_rules || undefined,
enableParentChild: data.chunking_config.enable_parent_child || false,
parentChunkSize: data.chunking_config.parent_chunk_size || 4096,
feat(frontend): expose chunking strategy in KB editor Surfaces the adaptive 3-tier chunking controls in the existing "Chunking" section of the KB editor modal. Users can now pick a strategy from a dropdown without crafting JSON for the API: - Automatic (recommended) → backend profiler picks the tier - Markdown-optimized → forces heading-aware splitting - Smart structure detection → forces heuristic boundary detection - Classic → original recursive splitter (legacy) The fifth backend value `recursive` is intentionally hidden from the UI — it's functionally near `legacy` and would dilute the choice. Advanced options (collapsible, disabled when strategy=legacy): - TokenLimit (0–8192 approx tokens; 0 = char-based budget) - Languages multi-select (DE/EN/ZH; empty = auto-detect) Behaviour: - New KBs default to strategy="auto" - Existing KBs without the field render with empty strategy and keep classic behavior on save unless the user actively picks one - Overlap warning when overlap >= chunkSize/2 Wired through: - KBChunkingSettings.vue: strategy select + advanced collapsible + ChunkingConfig interface extended - KnowledgeBaseEditorModal.vue: form-state defaults, kb-load mapping, buildSubmitData (chunking_config) + updateKBConfig (documentSplitting) pass strategy/token_limit/languages - api/initialization/index.ts: types extended - i18n: en-US / zh-CN / ko-KR / ru-RU all carry strategy + advanced keys (6 keys each) https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
2026-05-02 20:40:07 +00:00
childChunkSize: data.chunking_config.child_chunk_size || 384,
fix(chunker): QA audit — pointer DTOs, profile reuse, stats correctness Resolves the issues surfaced by the post-Phase-3 self-review. High severity - Strategy / TokenLimit / Languages can now be reset. The KB-config handler uses pointer DTOs so the absence of a field in the payload means "no change" while an explicit empty string / 0 / [] clears the value. The frontend now sends the fields unconditionally so the user can revert to defaults via the clear icon — previously these fields were write-once. - DocProfile is no longer computed twice in the preview endpoint. Diagnostics carries the profile that drove tier selection (when auto-strategy ran); the handler only re-profiles for explicit strategies that bypass the profiler. - Chunk-size stats (avg / min / max / stddev) are now computed over the FULL chunk set before the response is truncated to previewMaxChunks. Avoids systematically misleading metrics for large documents. - SplitWithDiagnostics defaults SelectedTier to TierLegacy so an empty-text request never leaves the diag with a blank tier string. Medium severity - Split() reverts to its own loop instead of delegating to SplitWithDiagnostics. Diagnostics struct allocation is reserved for callers that actually want the trace (preview endpoint). Matters in SplitParentChild where Split runs once per parent. - Preview endpoint runs the splitter on a goroutine wrapped in a 5s context.WithTimeout. CJK input at the 256k-rune ceiling could otherwise tie up the worker for several seconds. Low severity - KBChunkingSettings emits arrays via spread copies so parent-side mutation cannot drift the form's reactive state. - KBChunkingDebug font-family includes a monospace fallback so the chunk content stays monospaced even when the TDesign CSS variable is missing. Documentation - DocProfile JSON shape is now annotated as part of the public preview API; field renames would be breaking. https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
2026-05-03 07:01:20 +00:00
// Always send strategy / tokenLimit / languages — backend treats
// empty/0/[] as a valid clear, so we must include them in the
// payload to let users reset back to defaults.
strategy: formData.value?.chunkingConfig.strategy ?? '',
tokenLimit: formData.value?.chunkingConfig.tokenLimit ?? 0,
languages: formData.value?.chunkingConfig.languages ?? [],
tableMetadataInstructions: formData.value?.chunkingConfig.tableMetadataInstructions ?? ''
},
multimodal: {
enabled: !!data.vlm_config?.enabled
},
storageBackendId: formData.value?.storageBackendId || '',
storageProvider: data.storage_provider_config?.provider || data.storage_config?.provider || 'local',
nodeExtract: {
enabled: data.extract_config?.enabled || false,
text: data.extract_config?.text || '',
tags: data.extract_config?.tags || [],
nodes: data.extract_config?.nodes || [],
relations: data.extract_config?.relations || [],
customInstructions: data.extract_config?.custom_instructions || ''
},
questionGeneration: {
enabled: data.question_generation_config?.enabled || false,
questionCount: data.question_generation_config?.question_count || 3,
customInstructions: data.question_generation_config?.custom_instructions || ''
}
}
await updateKBConfig(kbId, config)
MessagePlugin.success(t('knowledgeEditor.messages.updateSuccess'))
// Check if indexing strategy changed and offer rebuild
if (hasFiles.value && initialIndexingStrategy.value && formData.value) {
const curr = formData.value.indexingStrategy
const prev = initialIndexingStrategy.value
const strategyChanged = (
curr.vectorEnabled !== prev.vectorEnabled ||
curr.keywordEnabled !== prev.keywordEnabled ||
curr.wikiEnabled !== prev.wikiEnabled ||
curr.graphEnabled !== prev.graphEnabled
)
if (strategyChanged) {
const dialog = DialogPlugin.confirm({
header: t('knowledgeEditor.indexing.rebuildConfirmTitle'),
body: t('knowledgeEditor.indexing.rebuildConfirmBody', { count: '...' }),
confirmBtn: t('common.confirm'),
cancelBtn: t('common.cancel'),
onConfirm: async () => {
dialog.destroy()
try {
const result: any = await rebuildKBIndex(kbId)
const count = result?.data?.document_count ?? 0
MessagePlugin.success(t('knowledgeEditor.indexing.rebuildSuccess', { count }))
} catch (e) {
console.error('Rebuild index failed:', e)
}
},
onCancel: () => {
dialog.destroy()
MessagePlugin.info(t('knowledgeEditor.indexing.rebuildSkip'))
},
})
}
}
emit('success', kbId)
handleClose()
}
} catch (error: any) {
console.error('Knowledge base operation failed:', error)
feat: expose KB ↔ vector store binding in list, editor, and detail UI Backend ------- ListKnowledgeBases now enriches each row with the resolved vector_store metadata (name / source / engine_type / status) via a new buildKBListResponse helper. Store views are batch-resolved once per request through BatchResolveStoreView so an N-KB list costs one vector-store service call rather than N — closing the N+1 limitation flagged in #1372's known-limitations section. Cross-tenant shared KBs continue to render via SharedStoreDisplay so the owning tenant's store inventory cannot be correlated across rows; the underlying vector_store_id UUID is stripped from those responses. Resolver failures degrade gracefully: bound KBs render as unavailable instead of breaking the list. Test coverage pins the env / bound / shared distinction, the batch-call-count invariant, and the graceful-failure path. Frontend -------- KB editor modal gains a new "Vector Store" section. Create mode shows a dropdown that combines the system default (env store) and the tenant's configured user stores, fetched once at mount via the existing listVectorStores API. Edit mode shows the bound store read-only via a new VectorStoreBadge component with an explicit immutability hint — matching the backend's `<-:create` GORM tag and the service-layer UpdateKnowledgeBaseRequest DTO that already omit the field. KB list cards surface a small engine-type badge for own-tenant bound KBs, and a warning badge when the bound store is unavailable. Env-bound and shared KBs render no badge (visual noise control). KB detail header shows the bound store via the same VectorStoreBadge component; shared KBs fall through to the badge's internal "shared" branch with no name / engine / id rendered. The KB editor's create-time error handler translates the typed ErrVectorStoreBindingInvalid (2200) and ErrVectorStoreUnavailable (2201) into localized messages and jumps the user back to the VectorStore section so they can pick a different store or fall back to the system default. The KB row type gains five optional fields (vector_store_id / name / engine_type / source / status). i18n: 18 new keys added to en-US, ko-KR, zh-CN; ru-RU receives English placeholders pending translation (consistent with prior PRs in this locale). Part of #993 (Phase 2: Per-KB VectorStore Binding). Phase 2 roadmap item: PR 5 (KB binding UI + list-response enrichment). Depends on #994, #1310, #1372, #1386 (all backend in the Phase 2 series).
2026-05-18 14:50:09 +00:00
// Vector-store-binding error codes from the server. Both indicate
// the selected store cannot be used: 2200 is "the binding itself
// is invalid" (e.g. unknown id, foreign tenant), 2201 is "the
// store is currently unreachable". For either, swap in a localized
// message and jump the user back to the Vector Store section so
// they can pick a different store or fall back to the system
// default.
const code = error?.response?.data?.error?.code ?? error?.code
if (code === 2200) {
MessagePlugin.error(t('knowledgeEditor.errors.vectorStoreBindingInvalid'))
currentSection.value = 'vectorStore'
} else if (code === 2201) {
MessagePlugin.error(t('knowledgeEditor.errors.vectorStoreUnavailable'))
currentSection.value = 'vectorStore'
} else {
MessagePlugin.error(error?.message || t('common.operationFailed'))
}
} finally {
saving.value = false
}
}
// 重置所有状态
const resetState = () => {
savedKbId.value = null
currentSection.value = 'basic'
formData.value = null
hasFiles.value = false
initialStorageProvider.value = ''
tenantDefaultStorageProvider.value = 'local'
initialIndexingStrategy.value = null
saving.value = false
loading.value = false
chunkingDirty.value = false
kbCreatorId.value = ''
kbTenantId.value = 0
}
// 关闭弹窗
const handleClose = () => {
emit('update:visible', false)
setTimeout(() => {
if (props.visible) return
resetState()
}, 300)
}
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
const modalShell = useModalShell({
visible: () => props.visible,
close: handleClose,
snapshot: () => formData.value,
})
// 监听弹窗打开/关闭
watch(() => props.visible, async (newVal) => {
const generation = ++kbEditorLoadGeneration
if (newVal) {
// 打开弹窗时,先重置状态
resetState()
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
modalShell.markClean()
loading.value = true
const targetKbId = props.kbId
// 检查是否有初始 section,如果有则跳转
if (uiStore.kbEditorInitialSection) {
currentSection.value = uiStore.kbEditorInitialSection
}
// 加载模型列表与空间默认存储引擎(创建 KB 时即使用,不依赖是否打开「存储引擎」Tab)
await Promise.all([loadAllModels(), loadTenantDefaultStorageProvider()])
if (generation !== kbEditorLoadGeneration || !props.visible) return
// 根据模式加载数据
if (props.mode === 'edit' && targetKbId) {
await loadKBData(targetKbId, generation)
} else {
// 创建模式:初始化空表单,并预填空间默认存储引擎
formData.value = initFormData(props.initialType || 'document')
formData.value.storageProvider = tenantDefaultStorageProvider.value
hasFiles.value = false
applyDefaultModelsIfEmpty()
loading.value = false
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
modalShell.markClean()
}
} else {
// 关闭弹窗时,延迟重置状态(等待动画结束)
setTimeout(() => {
if (props.visible) return
resetState()
currentSection.value = 'basic' // 重置为默认 section
}, 300)
}
})
// 监听全局设置弹窗关闭后刷新模型列表
watch(
() => uiStore.showSettingsModal,
async (visible, previous) => {
if (!visible && previous && props.visible) {
await loadAllModels(true)
}
}
)
watch(() => chatResources.allModels, (list) => {
if (props.visible) {
allModels.value = list || []
}
})
</script>
<style scoped lang="less">
feat(gallery): add an image gallery tab with schema-driven filters (#3694) * feat(image): observe image attributes and let the policy decide OCR Describe each image with the VLM as before, but ask it to also observe two attributes about the image in the same round — how much body text it carries (contain.text) and whether it presents data visually (contain.data_visual) — then let a small pure function decide whether that image is worth a second, separate OCR round. Per-class OCR was the first shape of this idea; a class (chart / photo / logo) is only an indirect proxy for 'is there text worth reading here', and the class table has to grow whenever a new kind of image shows up. The decision actually needs the observed attributes, so it reads them directly, and the attribute set is a backend registry row rather than a new class. The observation and the caption share one VLM call; OCR stays a separate call (prompt isolation, see #3291). An attribute the model does not answer for is left absent rather than filled with a conservative default, so the trace never claims an observation that did not happen, and an incomplete observation falls back to the on_unobserved policy (OCR still runs). The registry also carries the panel's display text, so a new attribute needs no frontend change. Off by default: image_attrs_enabled=false keeps today's behaviour (one caption and one OCR per image). KB config: image_processing_config.image_attrs_enabled / image_actions; per-upload override via process_config. Registry: GET /api/v1/image-attrs/schema. * feat(gallery): add image gallery tab with schema-driven filters Adds a 4th knowledge-base tab parallel to Documents/Wiki/Graph that browses every image asset in a KB. Backend: - GET /api/v1/knowledge-bases/:id/images lists image assets projected from chunks.image_info, with keyword (caption/OCR), multi-value attribute (attr_<name>=<value>), is_enabled and sort filters applied in memory, plus pagination. - Resolves the source knowledge item title (SourceName) via a batched GetKnowledgeBatch so the viewer can show a human-readable source. Frontend: - ImageGallery.vue: thumbnail grid + search/sort + schema-driven filter panel (from GET /image-attrs/schema) + single-image viewer with prev/next, attributes/caption/OCR/source. - Wired as the gallery tab in KnowledgeBase.vue; i18n keys in all 5 locales. * feat(gallery): drive filters/search/sort from a configurable attribute contract The gallery UI is no longer hardcoded: it renders from a self-describing contract served by GET /knowledge-bases/:id/gallery-config (live attribute sources, every attribute's definition with usage flags merged across the config tiers, and the caller's search activation state). - Attribute sources form an open registry (types.RegisterGalleryAttrSource); a builtin source models caption/ocr_text/timestamps/enabled so the gallery has zero special cases. - Usage resolution: user > KB > system > source, field by field; the system tier lives in system_settings (gallery.policy, JSON, no rebuild), the KB tier slot is wired in the engine but not stored yet. - Search activation is the user's own record: mode (all|custom) plus per-field on/off in users.preferences.gallery; source declarations never set defaults (unrecorded = off in custom mode). - image_info is read through a gallery-local struct, removing the compile dependency on the attribute-pipeline types; the gallery builds and runs with or without that feature deployed. - ListImages validates search_in / sort_by / attr_filters against the contract; ineligible fields are dropped, not served. * fix(frontend): inline the shared graph-drawer stylesheet (@import instead of <style src>) plugin-vue 6.0.6 keys unscoped src-style descriptors by the imported file path, so AgentStreamDisplay.vue and WikiBrowser.vue — both importing components/css/wiki-graph-drawer.less — overwrite each other during the build and the second one crashes with "reading 'scoped'". Adding the gallery changed the module order enough to make the collision hit every time. Inlining the same stylesheet keeps the emitted CSS identical and removes the shared descriptor key. * feat(gallery): render attributes from short labels with descriptions in tooltips A source could only say one thing about a value, so the filter panel had to put a full sentence inside a checkbox. Attributes and their values now carry two pieces of text: a short label for the space-constrained controls (checkbox, search field, sort option) and a description for wherever there is room (tooltip, detail panel). The contract's value list becomes an array of {value, label, description}, and the display helpers resolve each field separately: the gallery stamps the short name on a control and moves the sentence into a tooltip. Translation overlays are looked up per field, so a source that ships no gallery-specific text still picks up the attribute pipeline's own wording. * fix(gallery): let locale text win over the contract's wording The filter panel read the backend's own label before asking the locale, so a translated value never got a chance: the contract ships its own default-language wording, and it shadowed the overlay for every locale. Built keys were also off by a segment — imageAttr.<name> has to be imageAttr.<name>.label, and the gallery's own keys live under knowledgeEditor.wikiBrowser.gallery.attr — so builtin and system attributes fell through to English on a Chinese UI. * feat(gallery): top bar layout, pinned panels and per-value verdicts The toolbar moves onto its own row above the grid, so the controls no longer eat into the space the images are there for: search box, the two scope switches, sort field and direction, and the result count all sit in one flex row. The settings behind them are no longer inline either — each opens as a popover under its control and can be pinned to a right-hand rail, where the two panels take turns as tabs instead of both claiming width at once. Filtering gains a third state per attribute value. Where a value could only be picked or not picked, it can now be "off" (hide those images), "on" (show them whatever else says) or neutral (leave them alone), which is what lets one attribute's rules talk about an image another attribute tried to hide without the pair of them cancelling each other out: a forced display outranks a forced hide, and anything no rule speaks about stays visible. The switch that used to only exist inside the panel now has a toolbar home as well. "筛选:全显示" genuinely drops the attribute constraint instead of imposing it against a panel the user cannot see. Filtering used to empty the list the moment it was switched on. Any image whose attribute was never observed — every image ingested before the attribute pipeline existed — read as a mismatch for every filter, which is not narrowing a list but losing it. Absence now stays silence: an attribute no image carries places no constraint on it, until the pipeline catches up and fills the value in. Co-authored-by: WorkBuddy * feat(gallery): expose the image attribute pipeline as a gallery source The gallery's contract resolved to a single source, so the filter panel could only offer "Enabled" while the attributes the observe-and-describe pipeline fills in — contain.text, contain.data_visual — never reached the UI. The registry is a gallery attribute source like any other: every attribute it declares is offered to the gallery, filterable by default, with the config tiers able to override the usage flags at runtime. The registration lives in the attribute pipeline's own commit; this branch carried an earlier, squapshot of that work which predated the split of an attribute value into a short label and a description, so the registry's value shape and this file have been brought in line with it. Both PRs now hold byte-identical copies of the source hook, which is what lets either one land first and the other merge cleanly afterwards. Co-authored-by: WorkBuddy * fix(gallery): viewer race, pin icon, panel anchoring and scope wording Opening the viewer rendered the img element with the previous or empty source while the proxy fetch was still producing a blob, and the error that empty source fired locked the viewer in its failure state even after the real image arrived. The resolved source now lands before the flag is consulted, and a token keeps a slow fetch of one image from overwriting a faster one that navigated past it. The pin button drew nothing: TDesign has no "pushpin" glyph, so the button rendered as an empty shell. It now uses pin / pin-filled, keeps its place beside the tab bar, and a pinned rail assigns its columns explicitly — the panel precedes the main section in the DOM, so leaving the grid to source order handed the wide column to the panel and squeezed the images into the rail. The floating panel no longer appears at a hardcoded offset: it anchors just below the arrow that summoned it, the arrow flips up while its panel is out, a second press retracts, and any click elsewhere in the toolbar closes it. When a rail is pinned the arrows turn to the requested tab instead of spawning a second surface. The scope words (全部 / 全显示 / 自定义) become plain status text rather than a second dropdown — they name the current mode, and only the arrow beside them opens the panel that changes it. Co-authored-by: WorkBuddy * fix(web): align the OCR-on-unobserved switch with the other setting rows The switch sat bare inside its setting-row while every other switch on the page is wrapped in setting-control, which is what reserves the right column and centers the control vertically. With the row laid out from the top, the bare switch hugged the row's upper edge and crowded the description text — visibly out of place next to its neighbors. Wrapping it in setting-control gives it the same right-aligned, centered slot as the rest. Co-authored-by: WorkBuddy * fix(web): move the OCR-on-unobserved row out of the vertical schema row The row lived inside setting-row-vertical, whose descendant rule stretches every setting-info and setting-control beneath it to 100% width. Two full-width flex children side by side cannot fit, so the control overflowed the container and the switch landed past the right edge — visibly further out than the switch on the row above. The row and its note now sit beside the vertical block instead of inside it, under their own condition, so the switch shares the ordinary row layout and its right edge lines up with the "image attribute observation" switch above. Co-authored-by: WorkBuddy * fix(gallery): applying a verdict now activates the filter scope Setting an off/on verdict while the panel's master switch was off silently ignored it: buildParams only attaches attr_rules in custom scope, and setVerdict never flipped the scope. A verdict the user just expressed now switches the scope to custom; clearing the last meaningful verdict returns to all, since custom with no rules constrains nothing. * fix(gallery): search checkboxes stay visible and idle panels read as dimmed The search panel hid its field checkboxes while the master switch was on, so the only way to reach them was to flip the switch first. They now sit next to the switch like the filter panel's verdicts do: dimmed in all-field mode (where they carry no weight) yet clickable, and touching one drops the mode to custom. The filter panel's verdict rows dim the same way while the filter switch is off. * fix(gallery): bulk verdict row, neutral default mark, panel polish The clear-filters button never matched what the panel is for, so it is now a bulk verdict row: one set of -/off/on buttons that applies the chosen position to every value of every value-typed attribute, with the default mark turned into a language-neutral dash. The panel head drops its second divider (the tab bar already draws one) and the tabs follow the toolbar's order: search left, filter right. * fix(gallery): drop the all-fields caption and center the order arrow The caption above the search checkboxes showed and hid with the master switch, shoving the checkboxes down on every flip; it said nothing the dimmed state doesn't, so it is gone. The order button's arrow is an inline svg, which sits on the text baseline and reads as riding high; it now centers against the label. * fix(gallery): center the order arrow for real vertical-align never applied: the icon is a flex item inside the button's inline-flex text wrapper, and the wrapper's default stretch pins the explicitly-sized 16px icon to the top of the 22px line box. align-items: center on the wrapper is what actually centers it. * fix(gallery): shorten panel tab labels in en and ru The two-word labels overflowed the 300px panel and forced the tab bar into scroll arrows; single-word labels fit in every locale that was affected. * docs: drop the image pipeline rewrite from this branch The rewritten 'Go 侧接手后' paragraph belongs to the image attribute observation work (#3635), which this branch carries as a prerequisite and which already documents the caption_ocr / observation_driven split. Keeping a competing rewrite of the same paragraph on the gallery branch makes it collide with upstream, which extended that paragraph with the custom_instructions and inline HTML table notes. Restoring the shared wording keeps the gallery branch free of this file so upstream's edits merge cleanly. * style: gofmt the gallery attribute types Struct field tags in the resolved gallery config were one column narrow, so gofmt rebroke the alignment block. Whitespace only. * style(gallery): use design tokens in the gallery styles The style guard ratchet fails on any new violation. ImageGallery.vue shipped with 47 TDesign token fallbacks, 21 literal font sizes, 4 literal radii and a 0.15s transition; all of them now read the --app-* / --td-* tokens, which is what the guard asks for and what dark mode depends on. * lint(gallery): fix the golangci-lint findings in the gallery code lll: the three over-long swagger @Param lines and one registry row were shortened. ineffassign: ctx was assigned before the access check and then reassigned, so the first value was dead; it is now declared once, after the check. errcheck: the three unchecked c.Error calls in ListImages. revive: the AttrSpec / AttrValue doc comment block was attached to the wrong type and split into one block each. staticcheck S1016: the gallery registration converts the registry value instead of restating its fields. * lint(gallery): wrap the image query select and check the last c.Error * style: reformat the wrapped image select in chunk.go * fix(gallery): address review findings on ordering, KB switch and blob lifetime - sortImageAssets: swap operands for desc instead of negating, keeping a strict weak ordering so ties page stably - ImageGallery: reload on knowledgeBaseId change, drop stale list responses, fetch thumbnails in parallel with one cached blob per URL, revoke blobs on unmount, default sort to builtin:created_at - KnowledgeBase: non-wiki KBs with a stale wiki/graph tab fall back to documents again - handler: move ListImages godoc out of ListKnowledgeFolders' block and document attr_filters / attr_rules - DecideOCR: a payload with no OCR conditions uses the built-in policy instead of silently skipping OCR * docs(parsing): describe the caption_ocr and observation_driven image pipelines Carried over from #3635, which this PR supersedes. * fix(gallery): load local:// and other storage handles through the KB file proxy The gallery's own scheme check only caught resource://, provider:// and storage://, so local:// (the default storage), minio://, cos:// and s3:// images went straight into <img src> and never rendered. Resolve through isProviderFileURL, the scheme list chat and wiki already use, and lock the routing with a test. * fix(kb-editor): keep API-customised OCR conditions on save and upload The KB editor always wrote the registry default into image_actions.ocr.on, so any unrelated edit replaced a knowledge base's custom OCR conditions with the default table; the upload dialog did the same for the per-document override. Keep a stored custom list and fall back to the registry default only when there is none, and show the conditions actually in effect instead of the default table in both panels. * perf(gallery): de-duplicate, filter, sort and page images in SQL Every gallery request used to read every image-bearing chunk of the KB, OCR text included, decode it in Go and page in memory. A single query now expands the image_info arrays, keeps one row per image URL, applies the keyword / attribute / verdict / enabled filters and the sort, and returns only the page with the filtered total. The expansion carries narrow scalars only; filters and JSON sort keys are evaluated on the winning entry of each image, and the page's JSON is read back for its rows alone. Postgres runs the query with JIT off, since the fixed 100-rows-per-call estimate of jsonb_array_elements otherwise prices it ~100x high and compilation dominates. On 20k images with 2 KB of OCR text each (40k chunks), a page drops from ~750 ms to ~100-200 ms on postgres and ~200 ms on sqlite; keyword search over OCR text stays a full scan (~400-600 ms) until the text is indexed. The filter semantics are pinned against both databases. * perf(gallery): serve the gallery from a trigger-maintained chunk_images table Reading images out of chunks.image_info meant parsing every image chunk of the knowledge base on each request, so a page still cost time in proportion to the KB. chunk_images (versioned/000113, sqlite/000032) keeps one row per image_info entry with caption, OCR text and attributes as columns; triggers on chunks keep it in step with every write path, and the migration backfills existing chunks. Copies of one image stay separate rows and the query lists the copy on the most recently updated chunk through an indexed anti-join, so writes decide nothing and concurrent writers need no locking. On postgres, caption and OCR text get pg_trgm indexes when the extension is available. On 20k images with 2 KB of OCR text each (40k chunks): postgres first page 10 ms, page 500 41 ms, keyword 2 ms, filters 23 ms sqlite first page 3 ms, page 500 39 ms, keyword 147 ms, filters 51 ms down from ~100-600 ms. Writing those 40k image chunks costs 7.0 s instead of 1.3 s on postgres (1.9 s instead of 1.0 s on sqlite), mostly the trigram indexes; status and enable-flag updates patch rows in place. --------- Co-authored-by: tayadwx <tayadwx@users.noreply.github.com> Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 04:33:59 +00:00
// 图片属性面板(可观察属性 / OCR 触发条件 / 观察失败兜底)
// 文案全部来自后端属性注册表(人话名 + 每个取值的含义),前端只做翻译覆盖,
// 因此新增属性无需改这里。铺在所在设置区里、不套独立底色块(与整体风格一致)。
.image-attr-panel {
margin-top: 4px;
}
.image-attr-list,
.image-attr-value-list,
.image-attr-condition-list {
margin: 0;
padding: 0;
list-style: none;
}
.image-attr-row + .image-attr-row {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid var(--td-component-border);
}
.image-attr-head {
display: flex;
align-items: baseline;
gap: 6px;
flex-wrap: wrap;
}
.image-attr-label {
font-weight: 600;
color: var(--td-text-color-primary);
}
// 原始属性名缩小并加括号,便于与处理轨迹里的字段对上,又不干扰阅读
.image-attr-name {
font-family: ui-monospace, Menlo, Consolas, monospace;
font-size: var(--app-text-xs);
color: var(--td-text-color-placeholder);
&::before {
content: '(';
}
&::after {
content: ')';
}
}
.image-attr-desc {
margin: 2px 0 0;
font-size: var(--app-text-sm);
line-height: 20px;
color: var(--td-text-color-secondary);
}
// 每个取值一行:值(等宽,左列对齐)+ 冒号 + 人话解释
.image-attr-value-list {
display: grid;
grid-template-columns: max-content 1fr;
column-gap: 2px;
row-gap: 2px;
margin-top: 6px;
font-size: var(--app-text-sm);
}
// display: contents 让值与解释分别落进上面两列,取值因此左对齐成列
.image-attr-value {
display: contents;
code {
font-family: ui-monospace, Menlo, Consolas, monospace;
color: var(--td-text-color-primary);
// 冒号紧跟取值,不留空隙:none: 没有文字
&::after {
content: ':';
}
}
}
.image-attr-value-label {
color: var(--td-text-color-secondary);
}
.image-attr-section {
margin-top: 14px;
}
// 一条 OCR 条件两行:人话在上,原始 property = value 在下
.image-attr-condition-list {
margin-top: 6px;
font-size: var(--app-text-sm);
}
.image-attr-condition + .image-attr-condition {
margin-top: 6px;
}
.image-attr-condition-label {
display: block;
color: var(--td-text-color-primary);
}
.image-attr-condition-raw {
display: block;
margin-top: 1px;
font-family: ui-monospace, Menlo, Consolas, monospace;
font-size: var(--app-text-xs);
color: var(--td-text-color-placeholder);
}
// 复用创建知识库的样式
/* 左侧导航:与 AgentEditorModal 对齐 */
.content-wrapper {
flex: 1;
overflow-y: auto;
padding: 24px 32px;
}
.section {
margin-bottom: 32px;
&:last-child {
margin-bottom: 0;
}
}
.section-content {
.section-header {
margin-bottom: 16px;
}
.section-title {
margin: 0 0 6px 0;
font-family: var(--app-font-family);
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-3xl);
font-weight: 600;
color: var(--td-text-color-primary);
}
.section-desc {
margin: 0;
font-family: var(--app-font-family);
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-base);
color: var(--td-text-color-placeholder);
line-height: 22px;
}
.section-body {
background: var(--td-bg-color-container);
}
}
.form-item {
margin-bottom: 16px;
&:last-child {
margin-bottom: 0;
}
}
.form-label {
display: block;
margin-bottom: 8px;
font-family: var(--app-font-family);
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-lg);
font-weight: 500;
color: var(--td-text-color-primary);
&.required::after {
content: '*';
color: var(--td-error-color);
margin-left: 4px;
}
}
.form-tip {
margin-top: 6px;
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-sm);
color: var(--td-text-color-placeholder);
}
.kb-id-field {
display: flex;
align-items: center;
gap: 4px;
width: 100%;
max-width: 480px;
margin-top: 8px;
padding: 6px 8px 6px 12px;
background: var(--td-bg-color-secondarycontainer);
border: 1px solid var(--td-component-stroke);
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
border-radius: var(--app-radius-sm);
.kb-id-value {
flex: 1;
min-width: 0;
margin: 0;
padding: 0;
background: none;
border: none;
font-family: var(--app-font-family-mono);
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-md);
line-height: 1.5;
color: var(--td-text-color-primary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.kb-id-copy {
flex-shrink: 0;
color: var(--td-text-color-secondary);
&:hover {
color: var(--td-brand-color);
}
}
}
.granularity-radio-group {
margin-top: 4px;
}
.granularity-hint {
margin-top: 8px;
line-height: 1.6;
color: var(--td-text-color-secondary);
white-space: normal;
word-break: break-word;
}
.indexing-checks {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
gap: 12px;
margin-top: 10px;
}
.indexing-check-item {
display: flex;
flex-direction: column;
gap: 6px;
padding: 12px 14px;
border: 1px solid var(--td-component-stroke);
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
border-radius: var(--app-radius-md);
background: var(--td-bg-color-container);
cursor: pointer;
user-select: none;
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
transition: border-color var(--app-motion-base) ease, background var(--app-motion-base) ease;
&:hover {
border-color: var(--td-brand-color);
}
&.is-checked {
border-color: var(--td-brand-color);
background: var(--td-brand-color-light);
}
&.is-disabled {
cursor: not-allowed;
opacity: 0.7;
&:hover {
border-color: var(--td-component-stroke);
}
&.is-checked:hover {
border-color: var(--td-brand-color);
}
}
:deep(.t-checkbox__label) {
font-weight: 500;
color: var(--td-text-color-primary);
}
}
.locked-tip {
color: var(--td-warning-color);
margin-top: 8px;
}
// 禁用内部 checkbox 自身的点击事件,统一由卡片处理
.indexing-check-box {
pointer-events: none;
}
.indexing-check-title {
display: inline-flex;
align-items: center;
gap: 6px;
}
.indexing-new-badge {
display: inline-flex;
align-items: center;
padding: 0 6px;
height: 16px;
border-radius: 3px;
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-2xs);
font-weight: 600;
line-height: 1;
letter-spacing: 0.4px;
color: var(--td-brand-color);
background: var(--td-brand-color-light);
}
.indexing-check-desc {
margin: 0;
padding-left: 24px;
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-sm);
line-height: 18px;
color: var(--td-text-color-placeholder);
}
.faq-guide {
margin-top: 20px;
padding: 12px 16px;
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
border-radius: var(--app-radius-md);
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-md);
line-height: 20px;
}
// 过渡动画
// 多模态配置内联样式(与子组件 KBStorageSettings/KBAdvancedSettings 一致)
.kb-multimodal-settings {
width: 100%;
.section-header {
margin-bottom: 20px;
h2 {
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-3xl);
font-weight: 600;
color: var(--td-text-color-primary);
margin: 0 0 6px 0;
}
.section-description {
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-base);
color: var(--td-text-color-secondary);
margin: 0;
line-height: 1.5;
}
}
.settings-group {
display: flex;
flex-direction: column;
}
.setting-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
padding: 16px 0;
border-bottom: 1px solid var(--td-component-stroke);
&:last-child {
border-bottom: none;
}
}
feat(gallery): add an image gallery tab with schema-driven filters (#3694) * feat(image): observe image attributes and let the policy decide OCR Describe each image with the VLM as before, but ask it to also observe two attributes about the image in the same round — how much body text it carries (contain.text) and whether it presents data visually (contain.data_visual) — then let a small pure function decide whether that image is worth a second, separate OCR round. Per-class OCR was the first shape of this idea; a class (chart / photo / logo) is only an indirect proxy for 'is there text worth reading here', and the class table has to grow whenever a new kind of image shows up. The decision actually needs the observed attributes, so it reads them directly, and the attribute set is a backend registry row rather than a new class. The observation and the caption share one VLM call; OCR stays a separate call (prompt isolation, see #3291). An attribute the model does not answer for is left absent rather than filled with a conservative default, so the trace never claims an observation that did not happen, and an incomplete observation falls back to the on_unobserved policy (OCR still runs). The registry also carries the panel's display text, so a new attribute needs no frontend change. Off by default: image_attrs_enabled=false keeps today's behaviour (one caption and one OCR per image). KB config: image_processing_config.image_attrs_enabled / image_actions; per-upload override via process_config. Registry: GET /api/v1/image-attrs/schema. * feat(gallery): add image gallery tab with schema-driven filters Adds a 4th knowledge-base tab parallel to Documents/Wiki/Graph that browses every image asset in a KB. Backend: - GET /api/v1/knowledge-bases/:id/images lists image assets projected from chunks.image_info, with keyword (caption/OCR), multi-value attribute (attr_<name>=<value>), is_enabled and sort filters applied in memory, plus pagination. - Resolves the source knowledge item title (SourceName) via a batched GetKnowledgeBatch so the viewer can show a human-readable source. Frontend: - ImageGallery.vue: thumbnail grid + search/sort + schema-driven filter panel (from GET /image-attrs/schema) + single-image viewer with prev/next, attributes/caption/OCR/source. - Wired as the gallery tab in KnowledgeBase.vue; i18n keys in all 5 locales. * feat(gallery): drive filters/search/sort from a configurable attribute contract The gallery UI is no longer hardcoded: it renders from a self-describing contract served by GET /knowledge-bases/:id/gallery-config (live attribute sources, every attribute's definition with usage flags merged across the config tiers, and the caller's search activation state). - Attribute sources form an open registry (types.RegisterGalleryAttrSource); a builtin source models caption/ocr_text/timestamps/enabled so the gallery has zero special cases. - Usage resolution: user > KB > system > source, field by field; the system tier lives in system_settings (gallery.policy, JSON, no rebuild), the KB tier slot is wired in the engine but not stored yet. - Search activation is the user's own record: mode (all|custom) plus per-field on/off in users.preferences.gallery; source declarations never set defaults (unrecorded = off in custom mode). - image_info is read through a gallery-local struct, removing the compile dependency on the attribute-pipeline types; the gallery builds and runs with or without that feature deployed. - ListImages validates search_in / sort_by / attr_filters against the contract; ineligible fields are dropped, not served. * fix(frontend): inline the shared graph-drawer stylesheet (@import instead of <style src>) plugin-vue 6.0.6 keys unscoped src-style descriptors by the imported file path, so AgentStreamDisplay.vue and WikiBrowser.vue — both importing components/css/wiki-graph-drawer.less — overwrite each other during the build and the second one crashes with "reading 'scoped'". Adding the gallery changed the module order enough to make the collision hit every time. Inlining the same stylesheet keeps the emitted CSS identical and removes the shared descriptor key. * feat(gallery): render attributes from short labels with descriptions in tooltips A source could only say one thing about a value, so the filter panel had to put a full sentence inside a checkbox. Attributes and their values now carry two pieces of text: a short label for the space-constrained controls (checkbox, search field, sort option) and a description for wherever there is room (tooltip, detail panel). The contract's value list becomes an array of {value, label, description}, and the display helpers resolve each field separately: the gallery stamps the short name on a control and moves the sentence into a tooltip. Translation overlays are looked up per field, so a source that ships no gallery-specific text still picks up the attribute pipeline's own wording. * fix(gallery): let locale text win over the contract's wording The filter panel read the backend's own label before asking the locale, so a translated value never got a chance: the contract ships its own default-language wording, and it shadowed the overlay for every locale. Built keys were also off by a segment — imageAttr.<name> has to be imageAttr.<name>.label, and the gallery's own keys live under knowledgeEditor.wikiBrowser.gallery.attr — so builtin and system attributes fell through to English on a Chinese UI. * feat(gallery): top bar layout, pinned panels and per-value verdicts The toolbar moves onto its own row above the grid, so the controls no longer eat into the space the images are there for: search box, the two scope switches, sort field and direction, and the result count all sit in one flex row. The settings behind them are no longer inline either — each opens as a popover under its control and can be pinned to a right-hand rail, where the two panels take turns as tabs instead of both claiming width at once. Filtering gains a third state per attribute value. Where a value could only be picked or not picked, it can now be "off" (hide those images), "on" (show them whatever else says) or neutral (leave them alone), which is what lets one attribute's rules talk about an image another attribute tried to hide without the pair of them cancelling each other out: a forced display outranks a forced hide, and anything no rule speaks about stays visible. The switch that used to only exist inside the panel now has a toolbar home as well. "筛选:全显示" genuinely drops the attribute constraint instead of imposing it against a panel the user cannot see. Filtering used to empty the list the moment it was switched on. Any image whose attribute was never observed — every image ingested before the attribute pipeline existed — read as a mismatch for every filter, which is not narrowing a list but losing it. Absence now stays silence: an attribute no image carries places no constraint on it, until the pipeline catches up and fills the value in. Co-authored-by: WorkBuddy * feat(gallery): expose the image attribute pipeline as a gallery source The gallery's contract resolved to a single source, so the filter panel could only offer "Enabled" while the attributes the observe-and-describe pipeline fills in — contain.text, contain.data_visual — never reached the UI. The registry is a gallery attribute source like any other: every attribute it declares is offered to the gallery, filterable by default, with the config tiers able to override the usage flags at runtime. The registration lives in the attribute pipeline's own commit; this branch carried an earlier, squapshot of that work which predated the split of an attribute value into a short label and a description, so the registry's value shape and this file have been brought in line with it. Both PRs now hold byte-identical copies of the source hook, which is what lets either one land first and the other merge cleanly afterwards. Co-authored-by: WorkBuddy * fix(gallery): viewer race, pin icon, panel anchoring and scope wording Opening the viewer rendered the img element with the previous or empty source while the proxy fetch was still producing a blob, and the error that empty source fired locked the viewer in its failure state even after the real image arrived. The resolved source now lands before the flag is consulted, and a token keeps a slow fetch of one image from overwriting a faster one that navigated past it. The pin button drew nothing: TDesign has no "pushpin" glyph, so the button rendered as an empty shell. It now uses pin / pin-filled, keeps its place beside the tab bar, and a pinned rail assigns its columns explicitly — the panel precedes the main section in the DOM, so leaving the grid to source order handed the wide column to the panel and squeezed the images into the rail. The floating panel no longer appears at a hardcoded offset: it anchors just below the arrow that summoned it, the arrow flips up while its panel is out, a second press retracts, and any click elsewhere in the toolbar closes it. When a rail is pinned the arrows turn to the requested tab instead of spawning a second surface. The scope words (全部 / 全显示 / 自定义) become plain status text rather than a second dropdown — they name the current mode, and only the arrow beside them opens the panel that changes it. Co-authored-by: WorkBuddy * fix(web): align the OCR-on-unobserved switch with the other setting rows The switch sat bare inside its setting-row while every other switch on the page is wrapped in setting-control, which is what reserves the right column and centers the control vertically. With the row laid out from the top, the bare switch hugged the row's upper edge and crowded the description text — visibly out of place next to its neighbors. Wrapping it in setting-control gives it the same right-aligned, centered slot as the rest. Co-authored-by: WorkBuddy * fix(web): move the OCR-on-unobserved row out of the vertical schema row The row lived inside setting-row-vertical, whose descendant rule stretches every setting-info and setting-control beneath it to 100% width. Two full-width flex children side by side cannot fit, so the control overflowed the container and the switch landed past the right edge — visibly further out than the switch on the row above. The row and its note now sit beside the vertical block instead of inside it, under their own condition, so the switch shares the ordinary row layout and its right edge lines up with the "image attribute observation" switch above. Co-authored-by: WorkBuddy * fix(gallery): applying a verdict now activates the filter scope Setting an off/on verdict while the panel's master switch was off silently ignored it: buildParams only attaches attr_rules in custom scope, and setVerdict never flipped the scope. A verdict the user just expressed now switches the scope to custom; clearing the last meaningful verdict returns to all, since custom with no rules constrains nothing. * fix(gallery): search checkboxes stay visible and idle panels read as dimmed The search panel hid its field checkboxes while the master switch was on, so the only way to reach them was to flip the switch first. They now sit next to the switch like the filter panel's verdicts do: dimmed in all-field mode (where they carry no weight) yet clickable, and touching one drops the mode to custom. The filter panel's verdict rows dim the same way while the filter switch is off. * fix(gallery): bulk verdict row, neutral default mark, panel polish The clear-filters button never matched what the panel is for, so it is now a bulk verdict row: one set of -/off/on buttons that applies the chosen position to every value of every value-typed attribute, with the default mark turned into a language-neutral dash. The panel head drops its second divider (the tab bar already draws one) and the tabs follow the toolbar's order: search left, filter right. * fix(gallery): drop the all-fields caption and center the order arrow The caption above the search checkboxes showed and hid with the master switch, shoving the checkboxes down on every flip; it said nothing the dimmed state doesn't, so it is gone. The order button's arrow is an inline svg, which sits on the text baseline and reads as riding high; it now centers against the label. * fix(gallery): center the order arrow for real vertical-align never applied: the icon is a flex item inside the button's inline-flex text wrapper, and the wrapper's default stretch pins the explicitly-sized 16px icon to the top of the 22px line box. align-items: center on the wrapper is what actually centers it. * fix(gallery): shorten panel tab labels in en and ru The two-word labels overflowed the 300px panel and forced the tab bar into scroll arrows; single-word labels fit in every locale that was affected. * docs: drop the image pipeline rewrite from this branch The rewritten 'Go 侧接手后' paragraph belongs to the image attribute observation work (#3635), which this branch carries as a prerequisite and which already documents the caption_ocr / observation_driven split. Keeping a competing rewrite of the same paragraph on the gallery branch makes it collide with upstream, which extended that paragraph with the custom_instructions and inline HTML table notes. Restoring the shared wording keeps the gallery branch free of this file so upstream's edits merge cleanly. * style: gofmt the gallery attribute types Struct field tags in the resolved gallery config were one column narrow, so gofmt rebroke the alignment block. Whitespace only. * style(gallery): use design tokens in the gallery styles The style guard ratchet fails on any new violation. ImageGallery.vue shipped with 47 TDesign token fallbacks, 21 literal font sizes, 4 literal radii and a 0.15s transition; all of them now read the --app-* / --td-* tokens, which is what the guard asks for and what dark mode depends on. * lint(gallery): fix the golangci-lint findings in the gallery code lll: the three over-long swagger @Param lines and one registry row were shortened. ineffassign: ctx was assigned before the access check and then reassigned, so the first value was dead; it is now declared once, after the check. errcheck: the three unchecked c.Error calls in ListImages. revive: the AttrSpec / AttrValue doc comment block was attached to the wrong type and split into one block each. staticcheck S1016: the gallery registration converts the registry value instead of restating its fields. * lint(gallery): wrap the image query select and check the last c.Error * style: reformat the wrapped image select in chunk.go * fix(gallery): address review findings on ordering, KB switch and blob lifetime - sortImageAssets: swap operands for desc instead of negating, keeping a strict weak ordering so ties page stably - ImageGallery: reload on knowledgeBaseId change, drop stale list responses, fetch thumbnails in parallel with one cached blob per URL, revoke blobs on unmount, default sort to builtin:created_at - KnowledgeBase: non-wiki KBs with a stale wiki/graph tab fall back to documents again - handler: move ListImages godoc out of ListKnowledgeFolders' block and document attr_filters / attr_rules - DecideOCR: a payload with no OCR conditions uses the built-in policy instead of silently skipping OCR * docs(parsing): describe the caption_ocr and observation_driven image pipelines Carried over from #3635, which this PR supersedes. * fix(gallery): load local:// and other storage handles through the KB file proxy The gallery's own scheme check only caught resource://, provider:// and storage://, so local:// (the default storage), minio://, cos:// and s3:// images went straight into <img src> and never rendered. Resolve through isProviderFileURL, the scheme list chat and wiki already use, and lock the routing with a test. * fix(kb-editor): keep API-customised OCR conditions on save and upload The KB editor always wrote the registry default into image_actions.ocr.on, so any unrelated edit replaced a knowledge base's custom OCR conditions with the default table; the upload dialog did the same for the per-document override. Keep a stored custom list and fall back to the registry default only when there is none, and show the conditions actually in effect instead of the default table in both panels. * perf(gallery): de-duplicate, filter, sort and page images in SQL Every gallery request used to read every image-bearing chunk of the KB, OCR text included, decode it in Go and page in memory. A single query now expands the image_info arrays, keeps one row per image URL, applies the keyword / attribute / verdict / enabled filters and the sort, and returns only the page with the filtered total. The expansion carries narrow scalars only; filters and JSON sort keys are evaluated on the winning entry of each image, and the page's JSON is read back for its rows alone. Postgres runs the query with JIT off, since the fixed 100-rows-per-call estimate of jsonb_array_elements otherwise prices it ~100x high and compilation dominates. On 20k images with 2 KB of OCR text each (40k chunks), a page drops from ~750 ms to ~100-200 ms on postgres and ~200 ms on sqlite; keyword search over OCR text stays a full scan (~400-600 ms) until the text is indexed. The filter semantics are pinned against both databases. * perf(gallery): serve the gallery from a trigger-maintained chunk_images table Reading images out of chunks.image_info meant parsing every image chunk of the knowledge base on each request, so a page still cost time in proportion to the KB. chunk_images (versioned/000113, sqlite/000032) keeps one row per image_info entry with caption, OCR text and attributes as columns; triggers on chunks keep it in step with every write path, and the migration backfills existing chunks. Copies of one image stay separate rows and the query lists the copy on the most recently updated chunk through an indexed anti-join, so writes decide nothing and concurrent writers need no locking. On postgres, caption and OCR text get pg_trgm indexes when the extension is available. On 20k images with 2 KB of OCR text each (40k chunks): postgres first page 10 ms, page 500 41 ms, keyword 2 ms, filters 23 ms sqlite first page 3 ms, page 500 39 ms, keyword 147 ms, filters 51 ms down from ~100-600 ms. Writing those 40k image chunks costs 7.0 s instead of 1.3 s on postgres (1.9 s instead of 1.0 s on sqlite), mostly the trigram indexes; status and enable-flag updates patch rows in place. --------- Co-authored-by: tayadwx <tayadwx@users.noreply.github.com> Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-25 04:33:59 +00:00
// 纵向行(类别 OCR 策略表用):说明文字占满整行,表格换到下一行
.setting-row-vertical {
flex-direction: column;
align-items: stretch;
> .setting-info {
max-width: 100%;
padding-right: 0;
}
}
.setting-info {
flex: 1;
max-width: 65%;
padding-right: 24px;
label {
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-lg);
font-weight: 500;
color: var(--td-text-color-primary);
display: block;
margin-bottom: 4px;
}
.desc {
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-md);
color: var(--td-text-color-secondary);
margin: 0;
line-height: 1.5;
}
}
.setting-control {
flex-shrink: 0;
min-width: 280px;
display: flex;
justify-content: flex-end;
align-items: center;
}
.required {
color: var(--td-error-color);
margin-left: 2px;
font-weight: 500;
}
}
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
.kb-profile-card {
margin-top: 8px;
padding: 12px 14px;
border: 1px solid var(--td-component-stroke);
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
border-radius: var(--app-radius-md);
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
background: var(--td-bg-color-secondarycontainer);
.kb-profile-gist {
margin: 0 0 8px;
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-base);
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
line-height: 1.6;
color: var(--td-text-color-primary);
}
.kb-profile-topics {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 8px;
}
.kb-profile-subtitle {
margin: 0 0 4px;
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-sm);
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
color: var(--td-text-color-secondary);
}
.kb-profile-questions ul {
margin: 0 0 8px;
padding-left: 18px;
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-md);
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
line-height: 1.6;
color: var(--td-text-color-primary);
}
.kb-profile-empty {
margin: 0 0 8px;
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-md);
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
color: var(--td-text-color-placeholder);
}
.kb-profile-error {
margin: 0 0 8px;
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-sm);
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
color: var(--td-error-color);
}
.kb-profile-meta {
margin: 0 0 8px;
refactor(frontend): style consistency pass — shared shells, tokens, unified confirmations (#3376) * refactor(frontend): batch 1 of style consistency cleanup - theme.css: alias --td-font-family-mono to --app-font-family-mono so the 29 monospace call sites follow the user's code-font setting - replace 115 hardcoded rgba(7,192,95,x) brand tints with color-mix(in srgb, var(--td-brand-color) N%, transparent) so they track the dark-mode brand color - strip 358 dead var(--td-*, fallback) fallbacks (tokens are guaranteed by theme.css); keep the 3 undefined tokens untouched - menu.vue: drop 9 unreferenced style blocks; remove TencentSans font file and its global import - AgentStreamDisplay: drop 6 unused keyframes; move the teleported wiki drawer styles into components/css/wiki-graph-drawer.less imported by both chat and WikiBrowser so styling no longer depends on load order - creatChat: remove four !important fixed-width media queries; chat root no longer forces font-size: 20px - list pages: create buttons use native theme="primary" (drops the purple gradient on AgentList); header-action-btn no longer needs !important - add styleGuard.test.mjs ratchet test (brand rgba, legacy blue, token fallbacks, z-index !important, raster icons) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): unify destructive confirmations on useConfirmDelete - useConfirmDelete now uses the danger dialog theme with a red confirm button; it is the single entry point for delete/leave confirmations - AgentList, KnowledgeBaseList and OrganizationList drop their hand-rolled del-*-dialog (span-as-button, circle.png) in favour of useConfirmDelete; circle.png asset removed - FAQ single-entry delete gains a confirmation (it deleted immediately); new knowledgeEditor.faq.confirmDelete key in all five locales - VectorStore/StorageBackend delete dialogs and the generated-question popconfirm use the danger theme like the rest of the app - style guard raster-icon baseline lowered to 10 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat(frontend): shared modal shell with Esc, overlay close and unsaved guard Add composables/useModalShell and wire it into the four full-screen settings-style modals (Settings, AgentEditorModal, OrganizationSettingsModal, KnowledgeBaseEditorModal): - Esc closes the modal everywhere (previously only Settings); it defers to any open TDesign dialog/drawer/popup and to the agent editor's own placeholder popups - overlay click closes everywhere (Settings gains it) - editors snapshot their form after load/save; closing with unsaved changes now asks "有未保存的更改 / 放弃更改 / 继续编辑" instead of silently discarding - new common.unsavedChanges.* keys in all five locales Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): mark instant-effect sections in the knowledge base editor Share, data source and activity sections apply changes immediately, but the editor footer still showed Cancel / Save, so users either re-saved or assumed Cancel would undo. Those sections now show an "applies immediately" note with a single Close button; other sections keep the Cancel / Save footer. New knowledgeEditor.footer.instantEffect key in all five locales. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): consistent success wording and confirm labels (zh-CN) - toasts use the "已X" form everywhere: 25 zh-CN values such as 保存成功 / 删除成功 / 智能体创建成功 become 已保存 / 已删除 / 已创建智能体; common.copySuccess now reads the same as common.copied - confirm buttons in dialogs and popconfirms use the bare verb (删除 / 重置 / 移除 / 应用 ...) instead of 确认X; dialog titles keep 确认删除 - GeneralSettings no longer pops a bare "成功" toast after theme / font / font-size changes, which are self-evident and applied instantly Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): extract SettingsModalShell for the four settings-style modals Settings, AgentEditorModal, OrganizationSettingsModal and KnowledgeBaseEditorModal each carried a copy of the same overlay / panel / sidebar-nav / footer markup and ~20 CSS blocks, already drifting (1000/1080/1100px widths, three shadows, different nav paddings). components/SettingsModalShell.vue now owns that chrome: one 1080x780 panel, grouped nav with badges, optional loading overlay, footer with a note slot and an actions slot. Consumers keep only their content and wire `@close` to their useModalShell.requestClose. Settings keeps its sub-menu nav through the `nav` slot; OrganizationSettingsModal keeps its image icon through the `nav-icon` slot. Net: -1025 lines across the four modals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared resource-card mixins and EmptyState for list pages KnowledgeBaseList, AgentList and OrganizationList each re-declared the same 136px card (border, radius, shadow, hover, header/title/description/ bottom, more-button reveal, feature badges) with small drifts, plus a copy of the empty-state block using the upload illustration for every kind of emptiness. - components/css/resource-card.less: .resource-card(), .resource-card-grid() and .resource-feature-badge() mixins; the pages keep only their own variants (type gradients, favourite star, decoration). More-buttons stay visible on touch devices. - components/EmptyState.vue: icon / title / description / actions; the 11 empty states now use a matching TDesign icon instead of upload.svg - badge accent colours move from hard-coded old-blue / material orange / pink / slate rgba to color-mix over theme tokens (new --app-accent-purple in theme.css); style guard legacy-blue baseline drops from 40 to 18 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): shared settings-section mixins for header, row, info, control 25 settings/system/integration pages each re-declared .section-header, .setting-row, .setting-info and .setting-control with five different header margins (18-32px), three description sizes and assorted paddings. components/css/settings-section.less now provides .settings-section-header() / .setting-row() / .setting-info() / .setting-control() / .setting-save-state(); pages keep only their deliberate deviations (e.g. Ollama's column control, TenantInfo's fixed label column). PlatformAPIKeys' style block switches to less so it can use the mixins. Net -570 lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): provider-card mixins, dark-safe vendor badges, one spin keyframe - components/css/provider-card.less: .provider-card() / -interactive() / -add() / -badge() / -badge-color() / -body() / -header() / -title() / -subtitle() / -more() shared by the model, vector store, web search, storage, parser and sandbox settings cards; MCP and skill cards reuse the 26px badge variant - vendor badge colours are now `.provider-card-badge-color(#hex)`: the foreground is mixed 75/25 with the text colour so it stays readable in dark mode, the background is the same colour at 12% alpha - 18 copies of a rotate-360 keyframe (steer-spin, chat-header-spin, sandbox-terminal-spin, ...) collapse into a global `wk-spin` in theme.css; 23 files updated, one source test adjusted Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): use TDesign password toggle for API keys; align chat toolbar buttons - ModelEditorDialog: the API key field is a plain t-input type="password" and relies on TDesign's built-in show/hide eye instead of a hand-rolled suffix toggle, matching every other secret field in the app - chat answer toolbar buttons are 28px with 6px radius, the same size as the user-message actions and the input control bar Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(frontend): app design tokens, tokenized literals, global TDesign overrides theme.css gains an app-level token set derived from the de-facto scale already used in the codebase, so values do not change: --app-radius-{xs,sm,md,lg,xl,pill} (4/6/8/10/12/999px) --app-text-{2xs..4xl} (10..24px) --app-space-{1..10} (4px grid) --app-motion-{instant,fast,base,slow} (120/150/200/300ms) --z-{sticky,dropdown,modal,drawer,popover,toast} A codemod mapped 675 border-radius, 1904 font-size and 551 transition duration literals in 191 files onto those tokens (value-preserving; five source-text tests now accept either form). assets/theme/tdesign-overrides.less holds global-intent TDesign overrides; its `.wk-popover` skin replaces six per-file copies of the blurred popover panel (TenantMembers x2, UserProfile, OrganizationSettingsModal, systemAdminDialog.less, share-to-space-panel.overlay.less) without !important. styleGuard ratchets now also cover radius / font-size / motion literals, `transition: all`, total `!important` and z-index !important. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(frontend): keep symmetric side insets for the chat column on narrow viewports .chat had padding 0 0 20px 20px so the scrollbar could sit on the content edge, but that also left the message list and input box flush against the right edge whenever the viewport was narrower than 960px + sidebar. The inset now lives on .msg_list and .input-container (--chat-content-inset, 20px each side, max-width 960px + insets); the scroll container still spans the full column so the scrollbar stays on the edge. Wide layouts are unchanged (960px content, centered). * chore(frontend): strip trailing whitespace flagged by pre-push * test(frontend): accept tokenized font-size and shell-rendered loading overlay Two source-text assertions only ran in CI (Node 24 discovers .test.ts, local Node 20 does not): - ChatQuestionMinimap: the 13px preview font is now var(--app-text-md) - modelUsageDetails: the editors' loading overlay is rendered by SettingsModalShell via :loading instead of an inline v-if Both regexes now accept either form. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 15:11:08 +00:00
font-size: var(--app-text-sm);
feat(knowledge): derive knowledge base descriptions from document profiles (#3370) * feat(knowledge): derive knowledge base descriptions from document profiles Knowledge bases only had a hand-written description, which most users leave empty, so agents bound to several knowledge bases had nothing to route on and searched all of them. This adds a generated description that is derived from per-document data instead of maintained by a model. Document profile: the summary call now returns JSON with a 2-3 sentence summary plus a gist, 3-5 topic keywords, a document type and one typical question (knowledges.profile). Input is capped at 8k chars and output at 1024 tokens; plain-text replies from custom templates still work and simply carry no profile. The summary chunk embeds the gist and short summary. Knowledge base aggregate: a database-only fold over those rows (counts per file type, tag, normalized topic and doc type; stratified samples of titles and questions; a hash of the inputs). Deleting, moving or re-parsing a document changes nothing but the rows, so the next rebuild is exact without any model judgement. Description text: one small model call over the aggregate yields a gist, merged topics and typical questions (knowledge_bases. generated_profile). The call is skipped when the aggregate hash is unchanged; failures keep the previous text and record the error; an empty knowledge base clears it. The manual description is never touched, and the agent runtime context renders both so the model can pass knowledge_base_ids instead of fanning out. Refreshes are requested from summary task exit, post-process completion, deletion, cross-KB moves and enabling the option, debounced per knowledge base in 30 s windows via kb:profile on the summary queue. POST /knowledge-bases/:id/profile/generate regenerates synchronously. profile_config (enabled, model_id, custom_instructions) opts a document knowledge base in; the settings dialog shows the generated card with regenerate and adopt-as-description actions in five locales. Search results now log hits per chunk type so the value of indexing summary chunks can be measured. Migrations 000101 (PostgreSQL) and 000021 (SQLite) add the columns; the SQLite schema test expects the new version and columns. * fix(knowledge): keep generated descriptions out of duplicates and refresh clones DuplicateKnowledgeBase copies the source row through JSON, which carried generated_profile onto a knowledge base that has no documents yet, so an empty duplicate advertised the source's topics. The duplicate now starts without a generated description and keeps profile_config so it derives its own once documents arrive. CopyKnowledgeBase builds the target field by field and skipped profile_config, and the clone task never asked for a description after copying the documents, so a clone stayed undescribed until its next upload. The target now carries a copy of profile_config and both clone paths request a refresh on completion. * fix(knowledge): refresh the loaded clone target and carry document profiles ProcessKBClone requested the description refresh with the reservation stub it builds before CopyKnowledgeBase runs. For the main create path that stub has neither a type nor profile_config, so the refresh helper rejected it and nothing was enqueued. The refresh now uses the loaded target returned by CopyKnowledgeBase. cloneKnowledge copied the summary text but not the structured profile, so even a scheduled refresh would have aggregated titles without topics until every clone was re-summarized. Cloned documents now carry an independent copy of the profile.
2026-09-17 14:21:55 +00:00
color: var(--td-text-color-placeholder);
}
.kb-profile-actions {
display: flex;
gap: 8px;
align-items: center;
}
}
</style>