diff --git a/backend/package/yuxi/agents/toolkits/buildin/install_skill.py b/backend/package/yuxi/agents/toolkits/buildin/install_skill.py index 18306409..60aebe61 100644 --- a/backend/package/yuxi/agents/toolkits/buildin/install_skill.py +++ b/backend/package/yuxi/agents/toolkits/buildin/install_skill.py @@ -16,7 +16,6 @@ from yuxi.repositories.user_repository import UserRepository from yuxi.storage.postgres.manager import pg_manager from yuxi.utils.logging_config import logger - ADMIN_ROLES = {"admin", "superadmin"} SANDBOX_PATH_HINT = ( "请使用 /home/gem/user-data/workspace/...、/home/gem/user-data/uploads/... 或 /home/gem/user-data/outputs/..." diff --git a/backend/package/yuxi/services/conversation_service.py b/backend/package/yuxi/services/conversation_service.py index b24c16b9..8cf7c928 100644 --- a/backend/package/yuxi/services/conversation_service.py +++ b/backend/package/yuxi/services/conversation_service.py @@ -12,6 +12,7 @@ from yuxi.agents.buildin import agent_manager from yuxi.config import config as app_config from yuxi.plugins.parser import Parser from yuxi.repositories.conversation_repository import ConversationRepository +from yuxi.services.mention_search_service import invalidate_mention_cache from yuxi.services.upload_utils import write_upload_to_path from yuxi.utils.datetime_utils import utc_isoformat from yuxi.utils.logging_config import logger @@ -410,6 +411,8 @@ async def upload_thread_attachment_view( attachments=all_attachments, ) + await invalidate_mention_cache(thread_id) + return serialize_attachment(attachment_record) @@ -474,6 +477,8 @@ async def delete_thread_attachment_view( attachments=all_attachments, ) + await invalidate_mention_cache(thread_id) + return {"message": "附件已删除"} diff --git a/backend/package/yuxi/services/thread_files_service.py b/backend/package/yuxi/services/thread_files_service.py index 44435b95..bb6cad44 100644 --- a/backend/package/yuxi/services/thread_files_service.py +++ b/backend/package/yuxi/services/thread_files_service.py @@ -17,6 +17,7 @@ from yuxi.agents.backends.sandbox import ( ) from yuxi.repositories.conversation_repository import ConversationRepository from yuxi.services.conversation_service import require_user_conversation +from yuxi.services.mention_search_service import invalidate_mention_cache from yuxi.utils.datetime_utils import utc_isoformat_from_timestamp @@ -255,6 +256,8 @@ async def save_thread_artifact_to_workspace_view( with source_path.open("rb") as src, target_path.open("wb") as dst: shutil.copyfileobj(src, dst) + await invalidate_mention_cache(thread_id) + saved_virtual_path = virtual_path_for_thread_file(thread_id, target_path, user_id=user_id) return { "name": target_path.name, diff --git a/web/src/components/AgentChatComponent.vue b/web/src/components/AgentChatComponent.vue index b6b64db2..2c78e1ca 100644 --- a/web/src/components/AgentChatComponent.vue +++ b/web/src/components/AgentChatComponent.vue @@ -431,7 +431,6 @@ const currentTodos = computed(() => { return Array.isArray(todos) ? todos : [] }) - const { mentionConfig } = useAgentMentionConfig({ currentAgentState, currentThreadAttachments, diff --git a/web/src/components/AgentPanel.vue b/web/src/components/AgentPanel.vue index bff2c9b3..fedeac30 100644 --- a/web/src/components/AgentPanel.vue +++ b/web/src/components/AgentPanel.vue @@ -321,7 +321,9 @@ const refreshFileSystem = async () => { (entry) => entry?.is_dir && entry.name === DISPLAY_ROOT_DIRECTORY_NAME ) - dynamicTreeData.value = displayRootEntry ? await loadDirectoryChildren(displayRootEntry.path) : [] + dynamicTreeData.value = displayRootEntry + ? await loadDirectoryChildren(displayRootEntry.path) + : [] expandedKeys.value = [] selectedKeys.value = [] } else { diff --git a/web/src/components/MessageInputComponent.vue b/web/src/components/MessageInputComponent.vue index dd551283..07c2a4e6 100644 --- a/web/src/components/MessageInputComponent.vue +++ b/web/src/components/MessageInputComponent.vue @@ -39,11 +39,7 @@ /> -
+
@@ -259,15 +255,7 @@ const slots = useSlots() // @ 提及功能是否启用 const mentionEnabled = computed(() => { - if (!props.mention) return false - const { files, knowledgeBases, mcps, skills, subagents } = props.mention - return ( - (Array.isArray(files) && files.length > 0) || - (Array.isArray(knowledgeBases) && knowledgeBases.length > 0) || - (Array.isArray(mcps) && mcps.length > 0) || - (Array.isArray(skills) && skills.length > 0) || - (Array.isArray(subagents) && subagents.length > 0) - ) + return !!props.mention }) const mentionTypePrefixMap = { @@ -539,7 +527,6 @@ const hasAnyItems = computed(() => { ) }) - const insertMention = (item) => { if (!inputRef.value) return @@ -1000,7 +987,9 @@ defineExpose({ overflow-y: auto; background: var(--gray-0); border-radius: 8px; - box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.12); + box-shadow: + 0 -4px 16px rgba(0, 0, 0, 0.08), + 0 4px 16px rgba(0, 0, 0, 0.12); border: 1px solid var(--gray-200); .mention-group { diff --git a/web/src/composables/useAgentMentionConfig.js b/web/src/composables/useAgentMentionConfig.js index 6f347dce..71042c82 100644 --- a/web/src/composables/useAgentMentionConfig.js +++ b/web/src/composables/useAgentMentionConfig.js @@ -127,15 +127,6 @@ export function useAgentMentionConfig({ } ) - if ( - !files.length && - !knowledgeBases.length && - !mcps.length && - !skills.length && - !subagents.length - ) - return null - return { files, knowledgeBases,