Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
refactor: unify dropdown menu styles across components
wizardchenf7ec47306c74
diff --git a/docs/superpowers/plans/2026-03-16-manual-knowledge-download.md b/docs/superpowers/plans/2026-03-16-manual-knowledge-download.mddeleted file mode 100644index 4539a23b7..000000000--- a/docs/superpowers/plans/2026-03-16-manual-knowledge-download.md+++ /dev/null@@ -1,241 +0,0 @@-# Manual Knowledge Download Implementation Plan--> **For agentic workers:** REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (`- [ ]`) syntax for tracking.--**Goal:** Allow users to download `manual` type knowledge items as `.md` files via the existing download endpoint.--**Architecture:** Add an early-return branch in `GetKnowledgeFile` that, for manual knowledge, reads `Metadata.content` from the database record and streams it as a `.md` file — no new routes or handlers needed. The frontend adds a download button to the manual UI block and fixes the `link.download` attribute to include the `.md` extension.--**Tech Stack:** Go 1.24 (Gin, GORM), Vue 3 + TypeScript (TDesign UI, Pinia)--**Spec:** `docs/superpowers/specs/2026-03-16-manual-knowledge-download-design.md`-------## Files Changed--| Action | Path | What changes |-|--------|------|--------------|-| Modify | `internal/application/service/knowledge.go` | Add manual branch in `GetKnowledgeFile` (lines 2408–2425) |-| Modify | `frontend/src/components/doc-content.vue` | Add download button to manual block (line 694–700); fix `link.download` in `downloadFile()` (line 630) |--No new files are created.-------## Chunk 1: Backend — GetKnowledgeFile manual branch--### Task 1: Add manual type support to GetKnowledgeFile--**Files:**-- Modify: `internal/application/service/knowledge.go:2408-2425`--- [ ] **Step 1: Verify the current state of GetKnowledgeFile**-- Open `internal/application/service/knowledge.go` and confirm the method looks like this (lines 2408–2425):-- ```go- // GetKnowledgeFile retrieves the physical file associated with a knowledge entry- func (s *knowledgeService) GetKnowledgeFile(ctx context.Context, id string) (io.ReadCloser, string, error) {- // Get knowledge record- tenantID := ctx.Value(types.TenantIDContextKey).(uint64)- knowledge, err := s.repo.GetKnowledgeByID(ctx, tenantID, id)- if err != nil {- return nil, "", err- }-- // Resolve KB-level file service with FilePath fallback protection- kb, _ := s.kbService.GetKnowledgeBaseByID(ctx, knowledge.KnowledgeBaseID)- file, err := s.resolveFileServiceForPath(ctx, kb, knowledge.FilePath).GetFile(ctx, knowledge.FilePath)- if err != nil {- return nil, "", err- }-- return file, knowledge.FileName, nil- }- ```--- [ ] **Step 2: Add the manual branch**-- Replace the body of `GetKnowledgeFile` so it reads:-- ```go- // GetKnowledgeFile retrieves the physical file associated with a knowledge entry- func (s *knowledgeService) GetKnowledgeFile(ctx context.Context, id string) (io.ReadCloser, string, error) {- // Get knowledge record- tenantID := ctx.Value(types.TenantIDContextKey).(uint64)- knowledge, err := s.repo.GetKnowledgeByID(ctx, tenantID, id)- if err != nil {- return nil, "", err- }-- // Manual knowledge stores content in Metadata — stream it directly as a .md file.- if knowledge.IsManual() {- meta, err := knowledge.ManualMetadata()- if err != nil {- return nil, "", err- }- // ManualMetadata returns (nil, nil) when Metadata column is empty; treat as empty content.- content := ""- if meta != nil {- content = meta.Content- }- // Sanitize title: strip characters that are invalid or dangerous in HTTP headers / filenames.- safeName := strings.NewReplacer(- "\n", "", "\r", "", "/", "-", "\\", "-", "\"", "'",- ).Replace(knowledge.Title)- filename := safeName + ".md"- return io.NopCloser(strings.NewReader(content)), filename, nil- }-- // Resolve KB-level file service with FilePath fallback protection- kb, _ := s.kbService.GetKnowledgeBaseByID(ctx, knowledge.KnowledgeBaseID)- file, err := s.resolveFileServiceForPath(ctx, kb, knowledge.FilePath).GetFile(ctx, knowledge.FilePath)- if err != nil {- return nil, "", err- }-- return file, knowledge.FileName, nil- }- ```-- The `strings` package is already imported in this file. `io` is also already imported.--- [ ] **Step 3: Verify imports are present**-- Confirm that `"io"` and `"strings"` are already in the import block at the top of `internal/application/service/knowledge.go`. They are — do **not** add duplicate imports.--- [ ] **Step 4: Verify the build compiles**-- Run from the repo root:-- ```bash- go build ./internal/application/service/...- ```-- Expected: exits 0, no output.--- [ ] **Step 5: Run the Go test suite**-- ```bash- go test -v ./...- ```-- Expected: all existing tests pass (there are no tests for `GetKnowledgeFile` yet — that's fine, the suite should be green overall).--- [ ] **Step 6: Commit**-- ```bash- git add internal/application/service/knowledge.go- git commit -m "feat: support manual knowledge download in GetKnowledgeFile"- ```-------## Chunk 2: Frontend — download button + filename fix--### Task 2: Add download button to manual knowledge UI block--**Files:**-- Modify: `frontend/src/components/doc-content.vue:694-700`--- [ ] **Step 1: Locate the manual block in the template**-- In `frontend/src/components/doc-content.vue`, find lines 694–700:-- ```vue- <!-- 手动创建类型专属区域 -->- <div v-else-if="details.type === 'manual'" class="manual_box">- <span class="label">{{ $t('knowledgeBase.documentTitle') }}</span>- <div class="manual_title_box">- <span class="manual_title">{{ details.title }}</span>- </div>- </div>- ```--- [ ] **Step 2: Add the download button**-- Replace those lines with:-- ```vue- <!-- 手动创建类型专属区域 -->- <div v-else-if="details.type === 'manual'" class="manual_box">- <span class="label">{{ $t('knowledgeBase.documentTitle') }}</span>- <div class="manual_title_box">- <span class="manual_title">{{ details.title }}</span>- </div>- <div class="icon_box" @click="downloadFile()">- <img class="download_box" src="@/assets/img/download.svg" alt="">- </div>- </div>- ```-- The `.icon_box` and `.download_box` CSS classes are already defined in this component (used by the `file` type block above).--- [ ] **Step 3: Fix the link.download attribute and a pre-existing removeChild bug in downloadFile()**-- In the same file, locate `downloadFile()` at lines 619–641.-- **Fix 1 — filename extension (line 630).** The current line is:-- ```ts- link.setAttribute("download", props.details.title);- ```-- Replace it with:-- ```ts- link.setAttribute("download", props.details.type === 'manual' ? props.details.title + '.md' : props.details.title);- ```-- **Fix 2 — pre-existing removeChild bug (line 633).** The link is created but never appended to `document.body`, so `document.body.removeChild(link)` throws a DOM exception at runtime. While fixing this is strictly out of scope, you will be touching this function anyway, so add the missing `appendChild` call right before `link.click()`:-- Before `link.click()`, add:- ```ts- document.body.appendChild(link);- ```-- The full corrected block (lines 627–635) should read:-- ```ts- const link = document.createElement("a");- link.style.display = "none";- link.setAttribute("href", url.value);- link.setAttribute("download", props.details.type === 'manual' ? props.details.title + '.md' : props.details.title);- document.body.appendChild(link);- link.click();- nextTick(() => {- document.body.removeChild(link);- URL.revokeObjectURL(url.value);- })- ```--- [ ] **Step 4: Run TypeScript type check**-- ```bash- cd frontend && npm run type-check- ```-- Expected: exits 0, no type errors.--- [ ] **Step 5: Commit**-- ```bash- git add frontend/src/components/doc-content.vue- git commit -m "feat: add download button for manual knowledge in doc-content"- ```-------## Manual Smoke Test (after both tasks)--Start the dev server and verify end-to-end:--1. Open a knowledge base that contains a `manual` type knowledge item.-2. Navigate to the knowledge detail page — confirm the download icon is visible (same icon as file type).-3. Click the download icon.-4. Verify the browser downloads a file named `{title}.md`.-5. Open the file and confirm the contents match the Markdown content in the editor.-6. Edge cases to spot-check:- - Knowledge item with empty content → downloads an empty `.md` file (not an error).- - Knowledge item whose title contains `/` or `"` → filename has `-` or `'` substituted respectively.diff --git a/docs/superpowers/specs/2026-03-16-manual-knowledge-download-design.md b/docs/superpowers/specs/2026-03-16-manual-knowledge-download-design.mddeleted file mode 100644index c11ed42e8..000000000--- a/docs/superpowers/specs/2026-03-16-manual-knowledge-download-design.md+++ /dev/null@@ -1,132 +0,0 @@-# Manual Knowledge Download — Design Spec--**Date:** 2026-03-16-**Status:** Approved-------## Background--WeKnora supports multiple knowledge types. The `manual` type stores content as Markdown in the database `Metadata.content` field — there is no physical file on disk or in object storage. The existing download endpoint (`GET /api/v1/knowledge/:id/download`) only works for `file` type knowledge; calling it for `manual` type would silently fail with an internal error because `FilePath` is empty.--The frontend `doc-content.vue` component already omits the download button for `manual` type knowledge. This spec describes how to add proper download support.-------## Goal--Allow users to download `manual` type knowledge as a `.md` file whose content is the Markdown stored in `Metadata.content` and whose filename is `{title}.md`.-------## Architecture--### Backend — `internal/application/service/knowledge.go`--**Method:** `GetKnowledgeFile(ctx, id) (io.ReadCloser, string, error)`--Add an early-return branch before the existing file-service lookup:--```go-if knowledge.IsManual() {- meta, err := knowledge.ManualMetadata()- if err != nil {- return nil, "", err- }- // ManualMetadata returns (nil, nil) when Metadata column is empty;- // treat as empty content rather than an error.- content := ""- if meta != nil {- content = meta.Content- }- // Sanitize title for use as a filename: strip newlines and path separators.- safeName := strings.NewReplacer(- "\n", "", "\r", "", "/", "-", "\\", "-", "\"", "'",- ).Replace(knowledge.Title)- filename := safeName + ".md"- return io.NopCloser(strings.NewReader(content)), filename, nil-}-```--- No new routes, handlers, or services required.-- All existing permission checks, logging, and error middleware remain intact.-- The handler sets `Content-Disposition: attachment; filename="{safeName}.md"` via the existing streaming logic.--#### Non-ASCII filenames in `Content-Disposition`--The existing handler writes the filename unquoted and without RFC 5987 encoding (`filename*=UTF-8''...`). This is a **known limitation inherited from the existing file-type download path** and is out of scope for this change. Most modern browsers (Chrome, Edge, Firefox) tolerate unquoted UTF-8 values in practice. A follow-up issue should address RFC 5987 encoding for all download types.--### Frontend — `frontend/src/components/doc-content.vue`--Two changes are required:--**1. Add download button to the `manual` UI block:**--```vue-<div v-else-if="details.type === 'manual'" class="manual_box">- <span class="label">{{ $t('knowledgeBase.documentTitle') }}</span>- <div class="manual_title_box">- <span class="manual_title">{{ details.title }}</span>- </div>- <!-- NEW: download button, same styling as file type -->- <div class="icon_box" @click="downloadFile()">- <img class="download_box" src="@/assets/img/download.svg" alt="">- </div>-</div>-```--**2. Fix `link.download` attribute in `downloadFile()` for manual type:**--The existing `downloadFile()` function sets `link.setAttribute("download", props.details.title)` without an extension. Browsers use the `download` attribute — not `Content-Disposition` — as the saved filename when `URL.createObjectURL` is used. For `manual` type, append `.md`:--```ts-const filename = details.value.type === 'manual'- ? details.value.title + '.md'- : details.value.title-link.setAttribute('download', filename)-```--`downloadFile()` otherwise calls `downKnowledgeDetails(id)` → `GET /api/v1/knowledge/:id/download` unchanged.-------## Data Flow--```-User clicks download- → downloadFile() [frontend, sets link.download = "{title}.md" for manual type]- → GET /api/v1/knowledge/:id/download- → DownloadKnowledgeFile handler [validates access]- → GetKnowledgeFile service- → if manual: sanitize title, read Metadata.content (empty string if nil)- → return (ReadCloser, "{safeName}.md", nil)- → handler streams response with Content-Disposition header- → browser saves "{title}.md"-```-------## Side Effects--`PreviewKnowledgeFile` also calls `GetKnowledgeFile` internally. After this change, preview requests for `manual` items will also succeed (returning the Markdown content with `text/markdown` MIME type via the existing `mimeTypeByExt(".md")` lookup). This is a desirable side effect and requires no additional changes.-------## Error Handling--| Scenario | Behaviour |-|----------|-----------|-| `ManualMetadata()` parse error | Returns internal server error (existing error middleware handles it) |-| `ManualMetadata()` returns `nil` (empty Metadata column) | Treated as empty content; returns a valid empty `.md` file |-| Empty content (`""`) | Returns a valid empty `.md` file — not an error |-| Non-existent knowledge ID | Existing 404 handling unchanged |-| Insufficient permissions | Existing auth middleware unchanged |-------## Out of Scope--- RFC 5987 encoding for non-ASCII `Content-Disposition` filenames (affects all download types, tracked separately)-- HTML / PDF / plain-text export formats-- Batch download of multiple knowledge items-- Version history downloaddiff --git a/frontend/src/assets/dropdown-menu.less b/frontend/src/assets/dropdown-menu.lessnew file mode 100644index 000000000..e9ae0def3--- /dev/null+++ b/frontend/src/assets/dropdown-menu.less@@ -0,0 +1,322 @@+/**+ * 全局统一下拉菜单样式+ *+ * 适用于所有场景的 popup/dropdown 菜单,包括:+ * - 卡片操作菜单(知识库、智能体、组织)+ * - 文档操作菜单+ * - 对话会话菜单+ * - 上传操作菜单+ *+ * 使用方式:+ * 1. <t-popup> + .popup-menu 自定义内容模式: overlayClassName="card-more-popup"+ * 2. <t-dropdown> TDesign 下拉模式: 自动匹配全局样式+ */++/* 弹出动画 */+@keyframes dropdownSlideIn {+ from {+ opacity: 0;+ transform: translateY(-6px) scale(0.98);+ }+ to {+ opacity: 1;+ transform: translateY(0) scale(1);+ }+}++@keyframes dropdownSlideInUp {+ from {+ opacity: 0;+ transform: translateY(6px) scale(0.98);+ }+ to {+ opacity: 1;+ transform: translateY(0) scale(1);+ }+}++/* ============================================+ 一、Popup 容器统一样式(<t-popup> 模式)+ ============================================ */+.card-more-popup {+ z-index: 99 !important;++ .t-popup__content {+ padding: 4px !important;+ margin-top: 4px !important;+ min-width: 148px;+ border-radius: 10px !important;+ background: var(--td-bg-color-container) !important;+ border: 0.5px solid var(--td-component-stroke) !important;+ box-shadow:+ 0 0 0 0.5px rgba(0, 0, 0, 0.03),+ 0 2px 4px rgba(0, 0, 0, 0.04),+ 0 8px 24px rgba(0, 0, 0, 0.1) !important;+ backdrop-filter: blur(20px) saturate(180%) !important;+ -webkit-backdrop-filter: blur(20px) saturate(180%) !important;+ animation: dropdownSlideIn 0.18s cubic-bezier(0.2, 0, 0, 1) both;+ overflow: hidden;+ }+}++/* ============================================+ 二、自定义菜单项统一样式(.popup-menu 模式)+ ============================================ */+.popup-menu {+ display: flex;+ flex-direction: column;+ gap: 1px;+}++.popup-menu-item {+ display: flex;+ align-items: center;+ gap: 10px;+ padding: 8px 12px;+ cursor: pointer;+ transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);+ color: var(--td-text-color-primary);+ font-size: 14px;+ font-weight: 400;+ line-height: 20px;+ border-radius: 6px;+ position: relative;++ .menu-icon {+ font-size: 16px;+ flex-shrink: 0;+ color: var(--td-text-color-secondary);+ transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);+ }++ &:hover {+ background: var(--td-bg-color-container-hover);+ color: var(--td-text-color-primary);++ .menu-icon {+ color: var(--td-text-color-primary);+ }+ }++ &:active {+ background: var(--td-bg-color-container-active);+ transform: scale(0.98);+ }++ &.delete,+ &.danger {+ color: var(--td-error-color-6);+ margin-top: 4px;+ position: relative;++ &::before {+ content: '';+ position: absolute;+ top: -3px;+ left: 8px;+ right: 8px;+ height: 1px;+ background: var(--td-component-stroke);+ }++ .menu-icon {+ color: var(--td-error-color-6);+ }++ &:hover {+ background: var(--td-error-color-1);+ color: var(--td-error-color-6);++ .menu-icon {+ color: var(--td-error-color-6);+ }+ }++ &:active {+ background: var(--td-error-color-2);+ }+ }+}++/* ============================================+ 三、文档操作菜单统一样式(.card-more 容器)+ ============================================ */+.card-more {+ z-index: 99 !important;++ .t-popup__content {+ padding: 4px !important;+ margin-top: 4px !important;+ min-width: 148px;+ width: auto;+ border-radius: 10px !important;+ background: var(--td-bg-color-container) !important;+ border: 0.5px solid var(--td-component-stroke) !important;+ box-shadow:+ 0 0 0 0.5px rgba(0, 0, 0, 0.03),+ 0 2px 4px rgba(0, 0, 0, 0.04),+ 0 8px 24px rgba(0, 0, 0, 0.1) !important;+ backdrop-filter: blur(20px) saturate(180%) !important;+ -webkit-backdrop-filter: blur(20px) saturate(180%) !important;+ color: var(--td-text-color-primary);+ animation: dropdownSlideIn 0.18s cubic-bezier(0.2, 0, 0, 1) both;+ overflow: hidden;+ }+}++/* ============================================+ 四、TDesign Dropdown 统一样式+ 适用于 <t-dropdown> 组件(挂载到 body 上)+ ============================================ */+.t-popup__content {+ .t-dropdown__menu {+ background: var(--td-bg-color-container);+ border: 0.5px solid var(--td-component-stroke);+ box-shadow:+ 0 0 0 0.5px rgba(0, 0, 0, 0.03),+ 0 2px 4px rgba(0, 0, 0, 0.04),+ 0 8px 24px rgba(0, 0, 0, 0.1);+ backdrop-filter: blur(20px) saturate(180%);+ -webkit-backdrop-filter: blur(20px) saturate(180%);+ padding: 4px;+ min-width: 148px;+ animation: dropdownSlideIn 0.18s cubic-bezier(0.2, 0, 0, 1) both;+ overflow: hidden;+ }++ .t-dropdown__item {+ padding: 8px 12px;+ border-radius: 6px;+ margin: 1px 0;+ transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);+ font-size: 14px;+ color: var(--td-text-color-primary);+ cursor: pointer;+ min-width: auto !important;+ max-width: 100% !important;+ display: flex !important;+ align-items: center;+ width: 100%;+ position: relative;++ &:hover {+ background: var(--td-bg-color-container-hover);+ color: var(--td-text-color-primary);+ }++ &:active {+ background: var(--td-bg-color-container-active);+ transform: scale(0.98);+ }++ .t-dropdown__item-icon {+ flex-shrink: 0;+ margin-right: 8px;+ color: var(--td-text-color-secondary);+ display: flex;+ align-items: center;+ transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);++ .t-icon {+ font-size: 16px;+ }+ }++ &:hover .t-dropdown__item-icon {+ color: var(--td-text-color-primary);+ }++ .t-dropdown__item-text {+ color: inherit !important;+ font-size: 14px !important;+ line-height: 20px !important;+ white-space: nowrap !important;+ overflow: hidden !important;+ text-overflow: ellipsis !important;+ flex: 1;+ min-width: 0;+ display: block;+ }++ /* TDesign error 主题项(删除操作) */+ &.t-dropdown__item--theme-error {+ color: var(--td-error-color-6) !important;+ margin-top: 4px;+ position: relative;++ &::before {+ content: '';+ position: absolute;+ top: -3px;+ left: 8px;+ right: 8px;+ height: 1px;+ background: var(--td-component-stroke);+ }++ .t-dropdown__item-icon {+ color: var(--td-error-color-6);+ }++ &:hover {+ background: var(--td-error-color-1);+ color: var(--td-error-color-6) !important;++ .t-dropdown__item-icon {+ color: var(--td-error-color-6);+ }+ }++ &:active {+ background: var(--td-error-color-2);+ }+ }+ }+}++/* tag 更多弹窗 */+.tag-more-popup {+ z-index: 99 !important;++ .t-popup__content {+ padding: 4px !important;+ margin-top: 4px !important;+ min-width: 120px;+ border-radius: 10px !important;+ background: var(--td-bg-color-container) !important;+ border: 0.5px solid var(--td-component-stroke) !important;+ box-shadow:+ 0 0 0 0.5px rgba(0, 0, 0, 0.03),+ 0 2px 4px rgba(0, 0, 0, 0.04),+ 0 8px 24px rgba(0, 0, 0, 0.1) !important;+ backdrop-filter: blur(20px) saturate(180%) !important;+ -webkit-backdrop-filter: blur(20px) saturate(180%) !important;+ animation: dropdownSlideIn 0.18s cubic-bezier(0.2, 0, 0, 1) both;+ overflow: hidden;+ }+}++/* ============================================+ 五、暗色模式增强+ ============================================ */+:root[theme-mode="dark"] {+ .card-more-popup .t-popup__content,+ .card-more .t-popup__content,+ .tag-more-popup .t-popup__content {+ background: rgba(36, 36, 36, 0.85) !important;+ border-color: rgba(255, 255, 255, 0.08) !important;+ box-shadow:+ 0 0 0 0.5px rgba(255, 255, 255, 0.05),+ 0 2px 4px rgba(0, 0, 0, 0.12),+ 0 8px 32px rgba(0, 0, 0, 0.28) !important;+ }++ .t-popup__content .t-dropdown__menu {+ background: rgba(36, 36, 36, 0.85);+ border-color: rgba(255, 255, 255, 0.08);+ box-shadow:+ 0 0 0 0.5px rgba(255, 255, 255, 0.05),+ 0 2px 4px rgba(0, 0, 0, 0.12),+ 0 8px 32px rgba(0, 0, 0, 0.28);+ }+}diff --git a/frontend/src/components/menu.vue b/frontend/src/components/menu.vueindex a4063f0b6..5c3220a11 100644--- a/frontend/src/components/menu.vue+++ b/frontend/src/components/menu.vue@@ -77,7 +77,7 @@{{ subitem.title }}</span><t-dropdown v-if="!batchMode"- :options="[{ content: t('menu.clearMessages'), value: 'clearMessages' }, { content: t('upload.deleteRecord'), value: 'delete' }, { content: t('menu.batchManage'), value: 'batchManage' }]"+ :options="[{ content: t('menu.clearMessages'), value: 'clearMessages', prefixIcon: () => h(TIcon, { name: 'clear', size: '16px' }) }, { content: t('menu.batchManage'), value: 'batchManage', prefixIcon: () => h(TIcon, { name: 'queue', size: '16px' }) }, { content: t('upload.deleteRecord'), value: 'delete', theme: 'error', prefixIcon: () => h(TIcon, { name: 'delete', size: '16px' }) }]"@click="handleSessionMenuClick($event, subitem.originalIndex, subitem)"placement="bottom-right"trigger="click">@@ -124,7 +124,7 @@<script setup lang="ts">import { storeToRefs } from 'pinia';-import { onMounted, watch, computed, ref } from 'vue';+import { onMounted, watch, computed, ref, h } from 'vue';import { useRoute, useRouter } from 'vue-router';import { getSessionsList, delSession, batchDelSessions, deleteAllSessions, clearSessionMessages } from "@/api/chat/index";import { getKnowledgeBaseById } from '@/api/knowledge-base';@@ -133,7 +133,7 @@ import { useMenuStore } from '@/stores/menu';import { useAuthStore } from '@/stores/auth';import { useOrganizationStore } from '@/stores/organization';import { useUIStore } from '@/stores/ui';-import { MessagePlugin, DialogPlugin } from "tdesign-vue-next";+import { MessagePlugin, DialogPlugin, Icon as TIcon } from "tdesign-vue-next";import UserMenu from '@/components/UserMenu.vue';import TenantSelector from '@/components/TenantSelector.vue';import { useI18n } from 'vue-i18n';@@ -1057,7 +1057,7 @@ const onDragHandleMouseDown = (e: MouseEvent) => {&:hover {background: var(--td-bg-color-container-hover);color: var(--td-text-color-primary);- border-radius: 3px;+ border-radius: 8px;.menu-more {color: var(--td-text-color-primary);@@ -1077,7 +1077,7 @@ const onDragHandleMouseDown = (e: MouseEvent) => {.submenu_item_active {background: var(--td-brand-color-light) !important;color: var(--td-brand-color) !important;- border-radius: 3px;+ border-radius: 8px;.menu-more {color: var(--td-brand-color) !important;@@ -1100,7 +1100,7 @@ const onDragHandleMouseDown = (e: MouseEvent) => {.submenu_item_selected {background: rgba(7, 192, 95, 0.05) !important;- border-radius: 3px;+ border-radius: 8px;}.batch-checkbox {@@ -1280,45 +1280,7 @@ html[theme-mode="dark"] .aside_box .menu_item_active .menu_icon img.icon {opacity: 1;}-// 上传操作下拉菜单样式 - 全局样式(因为 TDesign 的下拉菜单挂载到 body 上)-// 使用更具体的选择器来匹配上传操作下拉菜单-.t-popup[data-popper-placement^="right"] {- .t-popup__content {- .t-dropdown__menu {- background: var(--td-bg-color-container) !important;- border: 1px solid var(--td-component-stroke) !important;- border-radius: 6px !important;- box-shadow: var(--td-shadow-2) !important;- padding: 4px !important;- min-width: 100px !important;- }-- .t-dropdown__item {- padding: 8px 12px !important;- border-radius: 4px !important;- margin: 2px 0 !important;- transition: all 0.2s ease !important;- font-size: 14px !important;- color: var(--td-text-color-primary) !important;- min-width: auto !important;- max-width: none !important;- width: auto !important;- cursor: pointer !important;-- &:hover {- background: var(--td-bg-color-container-hover) !important;- color: var(--td-brand-color) !important;- }-- .t-dropdown__item-text {- color: inherit !important;- font-size: 14px !important;- line-height: 20px !important;- white-space: nowrap !important;- }- }- }-}+// 下拉菜单样式已统一至 @/assets/dropdown-menu.less// 退出登录确认框样式:deep(.t-popconfirm) {diff --git a/frontend/src/main.ts b/frontend/src/main.tsindex a0f610af0..6065d079f 100644--- a/frontend/src/main.ts+++ b/frontend/src/main.ts@@ -7,6 +7,7 @@ import TDesign from "tdesign-vue-next";// 引入组件库的少量全局样式变量import "tdesign-vue-next/es/style/index.css";import "@/assets/theme/theme.css";+import "@/assets/dropdown-menu.less";import i18n from "./i18n";import { initTheme } from "@/composables/useTheme";diff --git a/frontend/src/views/agent/AgentList.vue b/frontend/src/views/agent/AgentList.vueindex 4a29aface..0c95da4e1 100644--- a/frontend/src/views/agent/AgentList.vue+++ b/frontend/src/views/agent/AgentList.vue@@ -1698,66 +1698,7 @@ defineExpose({</style><style lang="less">-// 更多操作弹窗样式-.card-more-popup {- z-index: 99 !important;-- .t-popup__content {- padding: 6px 0 !important;- margin-top: 6px !important;- min-width: 140px;- border-radius: 6px !important;- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1) !important;- border: 1px solid var(--td-component-stroke) !important;- }-}--.popup-menu {- display: flex;- flex-direction: column;-}--.popup-menu-item {- display: flex;- align-items: center;- gap: 10px;- padding: 10px 16px;- cursor: pointer;- transition: all 0.2s ease;- color: var(--td-text-color-primary);- font-family: "PingFang SC";- font-size: 14px;- font-weight: 400;- line-height: 20px;-- .menu-icon {- font-size: 16px;- flex-shrink: 0;- color: var(--td-text-color-placeholder);- transition: color 0.2s ease;- }-- &:hover {- background: var(--td-bg-color-container-hover);-- .menu-icon {- color: var(--td-text-color-primary);- }- }-- &.delete {- color: var(--td-text-color-primary);-- &:hover {- background: var(--td-error-color-light);- color: var(--td-error-color);-- .menu-icon {- color: var(--td-error-color);- }- }- }-}+/* 下拉菜单样式已统一至 @/assets/dropdown-menu.less */// 共享智能体详情侧边栏.shared-detail-drawer-overlay {diff --git a/frontend/src/views/knowledge/KnowledgeBase.vue b/frontend/src/views/knowledge/KnowledgeBase.vueindex 548bced0b..7a908e4c7 100644--- a/frontend/src/views/knowledge/KnowledgeBase.vue+++ b/frontend/src/views/knowledge/KnowledgeBase.vue@@ -1997,87 +1997,7 @@ async function createNewSession(value: string): Promise<void> {/></template><style>-.card-more {- z-index: 99 !important;-}--.card-more .t-popup__content {- min-width: 180px;- width: auto;- padding: 6px 0;- margin-top: 4px !important;- color: var(--td-text-color-primary);-}-.card-more .t-popup__content:hover {- color: inherit !important;-}--.tag-more-popup {- z-index: 99 !important;-- .t-popup__content {- padding: 4px 0 !important;- margin-top: 4px !important;- min-width: 120px;- }-}--/* 面包屑下拉菜单优化 */-.t-popup__content {- .t-dropdown__menu {- background: var(--td-bg-color-container);- border: 1px solid var(--td-component-stroke);- border-radius: 10px;- box-shadow: 0 6px 28px rgba(15, 23, 42, 0.08);- padding: 6px;- min-width: 200px;- max-width: 240px;- }-- .t-dropdown__item {- padding: 8px 12px;- border-radius: 6px;- margin: 2px 0;- transition: all 0.12s ease;- font-size: 13px;- color: var(--td-text-color-primary);- cursor: pointer;- min-width: auto !important;- max-width: 100% !important;- display: flex !important;- align-items: center;- width: 100%;-- &:hover {- background: var(--td-bg-color-container);- color: var(--td-success-color);- }-- .t-dropdown__item-icon {- flex-shrink: 0;- margin-right: 8px;- color: inherit;- display: flex;- align-items: center;-- .t-icon {- font-size: 16px;- }- }-- .t-dropdown__item-text {- color: inherit !important;- font-size: 13px !important;- line-height: 1.5 !important;- white-space: nowrap !important;- overflow: hidden !important;- text-overflow: ellipsis !important;- flex: 1;- min-width: 0;- display: block;- }- }-}+/* 下拉菜单容器样式已统一至 @/assets/dropdown-menu.less */</style><style scoped lang="less">.knowledge-layout {@@ -2995,26 +2915,71 @@ async function createNewSession(value: string): Promise<void> {display: flex;flex-direction: column;min-width: 140px;+ gap: 1px;}.card-menu-item {display: flex;align-items: center;- gap: 8px;+ gap: 10px;padding: 8px 12px;cursor: pointer;color: var(--td-text-color-primary);+ transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);+ border-radius: 6px;+ font-size: 14px;+ line-height: 20px;&:hover {- background: var(--td-bg-color-secondarycontainer);+ background: var(--td-bg-color-container-hover);+ }++ &:active {+ background: var(--td-bg-color-container-active);+ transform: scale(0.98);}.icon {font-size: 16px;+ color: var(--td-text-color-secondary);+ transition: all 0.15s cubic-bezier(0.2, 0, 0, 1);+ }++ &:hover .icon {+ color: var(--td-text-color-primary);}&.danger {- color: var(--td-error-color);+ color: var(--td-error-color-6);+ margin-top: 4px;+ position: relative;++ &::before {+ content: '';+ position: absolute;+ top: -3px;+ left: 8px;+ right: 8px;+ height: 1px;+ background: var(--td-component-stroke);+ }++ .icon {+ color: var(--td-error-color-6);+ }++ &:hover {+ background: var(--td-error-color-1);+ color: var(--td-error-color-6);++ .icon {+ color: var(--td-error-color-6);+ }+ }++ &:active {+ background: var(--td-error-color-2);+ }}}diff --git a/frontend/src/views/knowledge/KnowledgeBaseList.vue b/frontend/src/views/knowledge/KnowledgeBaseList.vueindex 650b37625..424cd10e9 100644--- a/frontend/src/views/knowledge/KnowledgeBaseList.vue+++ b/frontend/src/views/knowledge/KnowledgeBaseList.vue@@ -2160,66 +2160,7 @@ const handleUploadFinishedEvent = (event: Event) => {</style><style lang="less">-// 更多操作弹窗样式-.card-more-popup {- z-index: 99 !important;-- .t-popup__content {- padding: 6px 0 !important;- margin-top: 6px !important;- min-width: 140px;- border-radius: 6px !important;- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1) !important;- border: 1px solid var(--td-component-stroke) !important;- }-}--.popup-menu {- display: flex;- flex-direction: column;-}--.popup-menu-item {- display: flex;- align-items: center;- gap: 10px;- padding: 10px 16px;- cursor: pointer;- transition: all 0.2s ease;- color: var(--td-text-color-primary);- font-family: "PingFang SC";- font-size: 14px;- font-weight: 400;- line-height: 20px;-- .menu-icon {- font-size: 16px;- flex-shrink: 0;- color: var(--td-text-color-placeholder);- transition: color 0.2s ease;- }-- &:hover {- background: var(--td-bg-color-container-hover);-- .menu-icon {- color: var(--td-text-color-primary);- }- }-- &.delete {- color: var(--td-text-color-primary);-- &:hover {- background: var(--td-error-color-light);- color: var(--td-error-color);-- .menu-icon {- color: var(--td-error-color);- }- }- }-}+/* 下拉菜单样式已统一至 @/assets/dropdown-menu.less */// 共享知识库卡片:详情触发(替代三点,用「查看详情」链接样式).shared-detail-trigger {diff --git a/frontend/src/views/knowledge/components/FAQEntryManager.vue b/frontend/src/views/knowledge/components/FAQEntryManager.vueindex cb1721629..64545a0c5 100644--- a/frontend/src/views/knowledge/components/FAQEntryManager.vue+++ b/frontend/src/views/knowledge/components/FAQEntryManager.vue@@ -415,7 +415,7 @@<t-popupv-if="canManage"v-model="entry.showMore"- overlayClassName="faq-card-popup"+ overlayClassName="card-more-popup"trigger="click"destroy-on-closeplacement="bottom-right"@@ -425,12 +425,12 @@<img class="more-icon" src="@/assets/img/more.png" alt="" /></div><template #content>- <div class="card-menu" @click.stop>- <div class="card-menu-item" @click.stop="handleMenuEdit(entry)">+ <div class="popup-menu" @click.stop>+ <div class="popup-menu-item" @click.stop="handleMenuEdit(entry)"><t-icon class="menu-icon" name="edit" /><span>{{ $t('common.edit') }}</span></div>- <div class="card-menu-item danger" @click.stop="handleMenuDelete(entry)">+ <div class="popup-menu-item delete" @click.stop="handleMenuDelete(entry)"><t-icon class="menu-icon" name="delete" /><span>{{ $t('common.delete') }}</span></div>@@ -3241,72 +3241,7 @@ watch(() => entries.value.map(e => ({</script><style lang="less">-.tag-more-popup {- z-index: 99 !important;-- .t-popup__content {- padding: 4px 0 !important;- margin-top: 4px !important;- min-width: 120px;- }-}--/* 面包屑下拉菜单优化 */-.t-popup__content {- .t-dropdown__menu {- background: var(--td-bg-color-container);- border: 1px solid var(--td-component-stroke);- border-radius: 10px;- box-shadow: 0 6px 28px rgba(15, 23, 42, 0.08);- padding: 6px;- min-width: 150px;- max-width: 200px;- }-- .t-dropdown__item {- padding: 8px 12px;- border-radius: 6px;- margin: 2px 0;- transition: all 0.12s ease;- font-size: 13px;- color: var(--td-text-color-primary);- cursor: pointer;- min-width: auto !important;- max-width: 100% !important;- display: flex !important;- align-items: center;- width: 100%;-- &:hover {- background: var(--td-bg-color-container);- color: var(--td-success-color);- }-- .t-dropdown__item-icon {- flex-shrink: 0;- margin-right: 8px;- color: inherit;- display: flex;- align-items: center;-- .t-icon {- font-size: 16px;- }- }-- .t-dropdown__item-text {- color: inherit !important;- font-size: 13px !important;- line-height: 1.5 !important;- white-space: nowrap !important;- overflow: hidden !important;- text-overflow: ellipsis !important;- flex: 1;- min-width: 0;- display: block;- }- }-}+/* 下拉菜单样式已统一至 @/assets/dropdown-menu.less */</style><style scoped lang="less">.faq-manager {@@ -4477,46 +4412,7 @@ watch(() => entries.value.map(e => ({}}-.card-menu {- display: flex;- flex-direction: column;-}--.card-menu-item {- display: flex;- align-items: center;- padding: 8px 16px;- cursor: pointer;- transition: all 0.2s ease;- color: var(--td-text-color-primary);- font-family: "PingFang SC";- font-size: 14px;- font-weight: 400;-- .menu-icon {- margin-right: 8px;- font-size: 16px;- flex-shrink: 0;- }-- &:hover {- background: var(--td-bg-color-secondarycontainer);- color: var(--td-text-color-primary);- }-- &.danger {- color: var(--td-text-color-primary);-- &:hover {- background: var(--td-error-color-light);- color: var(--td-error-color);-- .menu-icon {- color: var(--td-error-color);- }- }- }-}+/* card-menu 样式已统一至 @/assets/dropdown-menu.less,使用 .popup-menu 类 */.faq-question {flex: 1;@@ -5147,16 +5043,7 @@ watch(() => entries.value.map(e => ({// 响应式布局由 JavaScript 动态计算,这里不需要媒体查询-// 卡片菜单弹窗样式-:deep(.faq-card-popup) {- z-index: 99 !important;-- .t-popup__content {- padding: 4px 0 !important;- margin-top: 4px !important;- min-width: 120px;- }-}+// 卡片菜单弹窗样式已统一至 @/assets/dropdown-menu.less// FAQ 编辑器抽屉样式:deep(.faq-editor-drawer) {diff --git a/frontend/src/views/organization/OrganizationList.vue b/frontend/src/views/organization/OrganizationList.vueindex f065be091..49ac02249 100644--- a/frontend/src/views/organization/OrganizationList.vue+++ b/frontend/src/views/organization/OrganizationList.vue@@ -1903,66 +1903,7 @@ onUnmounted(() => {</style><style lang="less">-// 更多操作弹窗样式-.card-more-popup {- z-index: 99 !important;-- .t-popup__content {- padding: 6px 0 !important;- margin-top: 6px !important;- min-width: 140px;- border-radius: 6px !important;- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1) !important;- border: 1px solid var(--td-component-stroke) !important;- }-}--.popup-menu {- display: flex;- flex-direction: column;-}--.popup-menu-item {- display: flex;- align-items: center;- gap: 10px;- padding: 10px 16px;- cursor: pointer;- transition: all 0.2s ease;- color: var(--td-text-color-primary);- font-family: "PingFang SC";- font-size: 14px;- font-weight: 400;- line-height: 20px;-- .menu-icon {- font-size: 16px;- flex-shrink: 0;- color: var(--td-text-color-placeholder);- transition: color 0.2s ease;- }-- &:hover {- background: var(--td-bg-color-container-hover);-- .menu-icon {- color: var(--td-text-color-primary);- }- }-- &.delete {- color: var(--td-text-color-primary);-- &:hover {- background: var(--td-error-color-light);- color: var(--td-error-color);-- .menu-icon {- color: var(--td-error-color);- }- }- }-}+/* 下拉菜单样式已统一至 @/assets/dropdown-menu.less */// 创建对话框样式优化.create-org-dialog,diff --git a/frontend/src/views/settings/ModelSettings.vue b/frontend/src/views/settings/ModelSettings.vueindex b03cb21c0..a62a9c8a6 100644--- a/frontend/src/views/settings/ModelSettings.vue+++ b/frontend/src/views/settings/ModelSettings.vue@@ -845,49 +845,5 @@ onMounted(() => {}}-// Dropdown 菜单样式优化-:deep(.t-popup__content) {- .t-dropdown__menu {- background: var(--td-bg-color-container);- border: 1px solid var(--td-component-stroke);- border-radius: 8px;- box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);- padding: 4px;- min-width: 140px;- }-- .t-dropdown__item {- padding: 8px 12px;- border-radius: 4px;- margin: 2px 0;- font-size: 13px;- color: var(--td-text-color-primary);- transition: all 0.15s ease;- cursor: pointer;-- &:hover {- background: var(--td-bg-color-secondarycontainer);- color: var(--td-brand-color);- }-- &:active {- background: var(--td-success-color-light);- }-- // 删除按钮特殊样式 - 覆盖默认 hover 样式- &.t-dropdown__item--theme-error {- color: var(--td-error-color);-- &:hover {- background: var(--td-error-color-light);- color: var(--td-error-color) !important; // 使用 !important 确保覆盖默认样式- }-- &:active {- background: var(--td-error-color-light);- color: var(--td-error-color);- }- }- }-}+// Dropdown 菜单样式已统一至 @/assets/dropdown-menu.less</style>