feat: 调整文件搜索交互提示,优化用户体验 #594
This commit is contained in:
parent
2aeb1a86d7
commit
efee3c743a
@ -36,6 +36,7 @@
|
||||
<!-- 0.6.1 的内容请放在这里 -->
|
||||
- 调整 backend Python 工作区依赖边界:将 `backend/package/yuxi` 明确为承载核心运行依赖的业务包,根 `backend/pyproject.toml` 仅保留工作区入口与开发/测试配置,减少依赖职责混淆。
|
||||
- 修复沙盒 `workspace` 隔离粒度:宿主机目录从共享 `saves/threads/shared/workspace` 收敛为用户级 `saves/threads/shared/<user_id>/workspace`,并同步传递 `user_id` 到 sandbox 路径解析、provisioner 挂载与 viewer/chat 测试,保证同用户跨线程共享、不同用户隔离。
|
||||
- 调整输入框 `@` 提及中的文件搜索交互:无查询内容时不再直接展示文件列表,改为提示“输入相关内容以搜索文件”,避免未过滤结果干扰选择。
|
||||
|
||||
|
||||
历史版本发布记录已迁移到 [版本变更记录](./changelog.md)。
|
||||
|
||||
@ -46,16 +46,21 @@
|
||||
>
|
||||
<div class="mention-popup">
|
||||
<!-- 文件列表 -->
|
||||
<div v-if="mentionItems.files.length > 0" class="mention-group">
|
||||
<div v-if="mentionItems.files.length > 0 || showFileSearchPrompt" class="mention-group">
|
||||
<div class="mention-group-title">文件</div>
|
||||
<div
|
||||
v-for="(item, index) in mentionItems.files"
|
||||
:key="'file-' + item.value"
|
||||
:class="['mention-item', { active: isItemSelected('file', index) }]"
|
||||
@click="insertMention(item)"
|
||||
>
|
||||
{{ item.label }}
|
||||
<div v-if="showFileSearchPrompt" class="mention-search-placeholder">
|
||||
输入相关内容以搜索文件
|
||||
</div>
|
||||
<template v-else>
|
||||
<div
|
||||
v-for="(item, index) in mentionItems.files"
|
||||
:key="'file-' + item.value"
|
||||
:class="['mention-item', { active: isItemSelected('file', index) }]"
|
||||
@click="insertMention(item)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- 知识库列表 -->
|
||||
@ -252,7 +257,6 @@ const updateMentionItems = (query = '') => {
|
||||
|
||||
const lowerQuery = query.toLowerCase()
|
||||
const { files = [], knowledgeBases = [], mcps = [], skills = [], subagents = [] } = props.mention
|
||||
const workspacePrefix = '/home/gem/user-data/workspace/'
|
||||
|
||||
const filterItems = (list) =>
|
||||
list.filter((item) => {
|
||||
@ -273,7 +277,7 @@ const updateMentionItems = (query = '') => {
|
||||
|
||||
const filterFileItems = (list) => {
|
||||
if (!query) {
|
||||
return list.filter((item) => !String(item.value || '').startsWith(workspacePrefix))
|
||||
return []
|
||||
}
|
||||
return filterItems(list)
|
||||
}
|
||||
@ -372,9 +376,14 @@ const isItemSelected = (type, index) => {
|
||||
}
|
||||
|
||||
// 是否有任何候选项
|
||||
const showFileSearchPrompt = computed(() => {
|
||||
return Boolean(props.mention?.files?.length) && !mentionQuery.value
|
||||
})
|
||||
|
||||
const hasAnyItems = computed(() => {
|
||||
const items = mentionItems.value
|
||||
return (
|
||||
showFileSearchPrompt.value ||
|
||||
items.files.length > 0 ||
|
||||
items.knowledgeBases.length > 0 ||
|
||||
items.mcps.length > 0 ||
|
||||
@ -883,5 +892,11 @@ defineExpose({
|
||||
color: var(--gray-400);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.mention-search-placeholder {
|
||||
padding: 4px 8px;
|
||||
color: var(--gray-400);
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user