feat: mention 支持 workspace 的文件
在保留附件 mention 的同时,将共享 `workspace` 文件纳入候选范围;并将 `@` 空查询时的候选列表改为空,仅在继续输入后再执行筛选,避免工作区文件过多时直接铺满下拉面板
This commit is contained in:
parent
3f1ec778a4
commit
0d1e26cf7b
@ -57,6 +57,7 @@
|
|||||||
|
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
|
- 优化 Agent 输入框 mention 行为:在保留附件 mention 的同时,将共享 `workspace` 文件纳入候选范围;并将 `@` 空查询时的候选列表改为空,仅在继续输入后再执行筛选,避免工作区文件过多时直接铺满下拉面板
|
||||||
- 为前端工作台文件树补齐文件删除能力:`/api/viewer/filesystem/file` 新增删除接口,`AgentPanel` 文件节点新增删除按钮与确认交互,删除后会同步刷新树与预览状态
|
- 为前端工作台文件树补齐文件删除能力:`/api/viewer/filesystem/file` 新增删除接口,`AgentPanel` 文件节点新增删除按钮与确认交互,删除后会同步刷新树与预览状态
|
||||||
- 调整前端工作台文件预览交互:恢复默认侧边/弹窗预览,并新增显式“全屏预览”入口;全屏模式下由预览内容直接覆盖整页,仅保留右上角悬浮关闭按钮;
|
- 调整前端工作台文件预览交互:恢复默认侧边/弹窗预览,并新增显式“全屏预览”入口;全屏模式下由预览内容直接覆盖整页,仅保留右上角悬浮关闭按钮;
|
||||||
- 统一 Agent Panel 文件预览与消息区交付物预览组件:两处改为复用同一套 `AgentFilePreview` 预览实现,并为交付物预览补齐与工作台一致的“全屏预览”入口
|
- 统一 Agent Panel 文件预览与消息区交付物预览组件:两处改为复用同一套 `AgentFilePreview` 预览实现,并为交付物预览补齐与工作台一致的“全屏预览”入口
|
||||||
|
|||||||
@ -456,6 +456,7 @@ watch(hasAgentStateContent, (newVal, oldVal) => {
|
|||||||
})
|
})
|
||||||
const { mentionConfig } = useAgentMentionConfig({
|
const { mentionConfig } = useAgentMentionConfig({
|
||||||
currentAgentState,
|
currentAgentState,
|
||||||
|
currentThreadFiles,
|
||||||
currentThreadAttachments,
|
currentThreadAttachments,
|
||||||
configurableItems,
|
configurableItems,
|
||||||
agentConfig,
|
agentConfig,
|
||||||
|
|||||||
@ -252,6 +252,7 @@ const updateMentionItems = (query = '') => {
|
|||||||
|
|
||||||
const lowerQuery = query.toLowerCase()
|
const lowerQuery = query.toLowerCase()
|
||||||
const { files = [], knowledgeBases = [], mcps = [], skills = [], subagents = [] } = props.mention
|
const { files = [], knowledgeBases = [], mcps = [], skills = [], subagents = [] } = props.mention
|
||||||
|
const workspacePrefix = '/home/gem/user-data/workspace/'
|
||||||
|
|
||||||
const filterItems = (list) =>
|
const filterItems = (list) =>
|
||||||
list.filter((item) => {
|
list.filter((item) => {
|
||||||
@ -270,6 +271,13 @@ const updateMentionItems = (query = '') => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const filterFileItems = (list) => {
|
||||||
|
if (!query) {
|
||||||
|
return list.filter((item) => !String(item.value || '').startsWith(workspacePrefix))
|
||||||
|
}
|
||||||
|
return filterItems(list)
|
||||||
|
}
|
||||||
|
|
||||||
const fileItems = files.map((f) => {
|
const fileItems = files.map((f) => {
|
||||||
const path = f.path || ''
|
const path = f.path || ''
|
||||||
const fileName = path.split('/').pop() || path
|
const fileName = path.split('/').pop() || path
|
||||||
@ -333,7 +341,7 @@ const updateMentionItems = (query = '') => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
mentionItems.value = {
|
mentionItems.value = {
|
||||||
files: filterItems(fileItems),
|
files: filterFileItems(fileItems),
|
||||||
knowledgeBases: filterItems(knowledgeItems),
|
knowledgeBases: filterItems(knowledgeItems),
|
||||||
mcps: filterItems(mcpItems),
|
mcps: filterItems(mcpItems),
|
||||||
skills: filterItems(skillItems),
|
skills: filterItems(skillItems),
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { computed } from 'vue'
|
|||||||
|
|
||||||
export function useAgentMentionConfig({
|
export function useAgentMentionConfig({
|
||||||
currentAgentState,
|
currentAgentState,
|
||||||
|
currentThreadFiles,
|
||||||
currentThreadAttachments,
|
currentThreadAttachments,
|
||||||
configurableItems,
|
configurableItems,
|
||||||
agentConfig,
|
agentConfig,
|
||||||
@ -13,6 +14,7 @@ export function useAgentMentionConfig({
|
|||||||
const rawFiles = currentAgentState.value?.files || {}
|
const rawFiles = currentAgentState.value?.files || {}
|
||||||
const files = []
|
const files = []
|
||||||
const seenPaths = new Set()
|
const seenPaths = new Set()
|
||||||
|
const workspaceFiles = Array.isArray(currentThreadFiles?.value) ? currentThreadFiles.value : []
|
||||||
|
|
||||||
const pushFile = (entry) => {
|
const pushFile = (entry) => {
|
||||||
const path = entry?.path || ''
|
const path = entry?.path || ''
|
||||||
@ -60,6 +62,18 @@ export function useAgentMentionConfig({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
workspaceFiles.forEach((entry) => {
|
||||||
|
const path = entry?.path || ''
|
||||||
|
if (!path.startsWith('/home/gem/user-data/workspace/') || entry?.is_dir) return
|
||||||
|
pushFile({
|
||||||
|
path,
|
||||||
|
size: entry.size,
|
||||||
|
modified_at: entry.modified_at,
|
||||||
|
artifact_url: entry.artifact_url,
|
||||||
|
file_name: entry.name
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const configItems = configurableItems.value || {}
|
const configItems = configurableItems.value || {}
|
||||||
const currentConfig = agentConfig.value || {}
|
const currentConfig = agentConfig.value || {}
|
||||||
const allowedKbNames = new Set()
|
const allowedKbNames = new Set()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user