From 1842c8da85fe0e34cea60039dfc7d54b26e8bb0f Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Wed, 3 Jun 2026 19:50:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=9F=E4=B8=80=20Mention=20?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=B8=B2=E6=9F=93=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- REFACTOR.md | 4 +- web/src/components/MessageInputComponent.vue | 51 ++++++++++++------- .../components/common/MentionTextRenderer.vue | 40 ++++----------- web/src/utils/mention_icon_utils.js | 27 ++++++++++ 4 files changed, 70 insertions(+), 52 deletions(-) create mode 100644 web/src/utils/mention_icon_utils.js diff --git a/REFACTOR.md b/REFACTOR.md index 047aa220..468ea6ac 100644 --- a/REFACTOR.md +++ b/REFACTOR.md @@ -15,9 +15,7 @@ - [x] 移除 lightrag - [x] 新增图谱构建,支持自定义 Schema、支持自定义并发数,知识库与向量检索解耦 - [x] 知识图谱抽取要求支持并发处理 - - -## 权限部分 +- [ ] UV 的版本 - [x] Agent 的 user_id 使用的有歧义,从数据库表到代码中都修改为统一使用 yuxi_id 来代替 - [ ] 权限新增一个 guest 的预设字段,暂无任何权限 - [ ] rename database table name, such as skills -> agent_skills, subagents -> agent_subagents, mcp, tool_call, 等等 diff --git a/web/src/components/MessageInputComponent.vue b/web/src/components/MessageInputComponent.vue index e46df558..1ce1b37c 100644 --- a/web/src/components/MessageInputComponent.vue +++ b/web/src/components/MessageInputComponent.vue @@ -269,11 +269,27 @@ diff --git a/web/src/utils/mention_icon_utils.js b/web/src/utils/mention_icon_utils.js new file mode 100644 index 00000000..c2447d0a --- /dev/null +++ b/web/src/utils/mention_icon_utils.js @@ -0,0 +1,27 @@ +import { FolderFilled } from '@ant-design/icons-vue' +import { BookMarked, BookOpen, Bot, Plug } from 'lucide-vue-next' +import { getFileIcon, getFileIconColor } from '@/utils/file_utils' + +export const MENTION_ICON_SIZE = 15 +export const MENTION_ICON_STROKE_WIDTH = 2.2 + +const MENTION_TYPE_ICON_COMPONENTS = { + knowledge: BookOpen, + skill: BookMarked, + mcp: Plug, + subagent: Bot +} + +export const getMentionIconComponent = (type, value = '') => { + if (type === 'file') { + return String(value || '').endsWith('/') ? FolderFilled : getFileIcon(value) + } + return MENTION_TYPE_ICON_COMPONENTS[type] || Plug +} + +export const getMentionIconStyle = (type, value = '') => { + if (type !== 'file') return null + return { + color: String(value || '').endsWith('/') ? '#ffa940' : getFileIconColor(value) + } +}