fix(ui): 统一资源图标并调整会话分叉标识 (#3430)

* fix(ui): 统一资源空状态和共享筛选图标

* fix(ui): 将会话分叉标识移至右侧菜单位置
main
lyingbug 2026-09-19 20:59:12 +08:00 committed by GitHub
parent e986579731
commit 014f95f139
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 100 additions and 26 deletions

View File

@ -11,7 +11,9 @@
<t-select v-if="mode === 'resource' && spaceOptions.length" class="space-filter"
:value="selectedSpace" :options="spaceOptions" :placeholder="$t('listSpaceSidebar.spaces')"
:aria-label="$t('listSpaceSidebar.spaces')" filterable clearable
@change="(value: unknown) => $emit('update:modelValue', String(value || 'all'))" />
@change="(value: unknown) => $emit('update:modelValue', String(value || 'all'))">
<template #prefixIcon><ResourceIcon type="organization" :size="16" /></template>
</t-select>
</div>
<t-input :model-value="query" class="search-input" :placeholder="$t('menu.search')"
:aria-label="$t('menu.search')" clearable @update:model-value="(value: unknown) => $emit('update:query', String(value ?? ''))">
@ -24,6 +26,7 @@
import { computed, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { useOrganizationStore } from '@/stores/organization'
import ResourceIcon from '@/components/icons/ResourceIcon.vue'
const props = withDefaults(defineProps<{
modelValue: string

View File

@ -15,17 +15,18 @@
</form>
<span v-else class="submenu_title" :class="batchMode ? 'submenu_title--batch' : ''" :title="item.title">
<t-icon v-if="item.is_pinned" name="pin" class="submenu_pin_icon" />
<t-tooltip v-if="item.parent_session_id" content="由其他会话分叉而来">
<t-icon name="git-branch" class="submenu_fork_icon" />
</t-tooltip>
<span ref="titleTextRef" class="submenu_title-text">{{ item.title }}</span>
<span v-if="apiOwnerTag" class="session-owner-tag" :class="`session-owner-tag--${apiOwnerTag.kind}`"
:title="apiOwnerTag.full">{{ apiOwnerTag.label }}</span>
</span>
<span v-if="running" class="session-running-indicator" role="status" :aria-label="t('menu.sessionInProgress')"
:title="t('menu.sessionInProgress')"><span class="session-running-indicator__spinner" aria-hidden="true" /></span>
<div v-if="!batchMode" class="session-row-menu-wrap" @click.stop>
<t-popup v-model:visible="menuOpen" :overlay-class-name="menuOverlayClass" trigger="click" destroy-on-close
<div v-if="!batchMode || item.parent_session_id" class="session-row-menu-wrap"
:class="{ 'session-row-menu-wrap--fork': item.parent_session_id }" @click.stop>
<span v-if="item.parent_session_id" class="session-fork-indicator" role="img" aria-label="由其他会话分叉而来">
<t-icon name="git-branch" class="submenu_fork_icon" />
</span>
<t-popup v-if="!batchMode" v-model:visible="menuOpen" :overlay-class-name="menuOverlayClass" trigger="click" destroy-on-close
placement="bottom-right" @visible-change="onMenuVisibleChange">
<button type="button" class="menu-more-wrap" :aria-label="t('chatHeader.moreActions')" aria-haspopup="menu" :aria-expanded="menuOpen" @click.stop>
<t-icon name="ellipsis" class="menu-more" />
@ -249,6 +250,29 @@ const confirmDangerAction = (): void => {
pointer-events: none;
}
.session-row-menu-wrap--fork {
flex-basis: 24px;
width: 24px;
height: 24px;
opacity: 1;
pointer-events: auto;
.menu-more-wrap { opacity: 0; }
}
.submenu_item_batch .session-row-menu-wrap--fork { pointer-events: none; }
.session-fork-indicator {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
.submenu_fork_icon { font-size: var(--app-text-sm); }
}
.submenu_item:hover,
.submenu_item:focus-within,
.submenu_item--menu-open {
@ -260,6 +284,13 @@ const confirmDangerAction = (): void => {
}
}
.submenu_item:not(.submenu_item_batch) {
&:hover, &:focus-within, &.submenu_item--menu-open {
.session-fork-indicator { opacity: 0; }
.session-row-menu-wrap--fork .menu-more-wrap { opacity: 1; }
}
}
@media (hover: none) {
.session-row-menu-wrap {
flex-basis: 24px;
@ -267,6 +298,10 @@ const confirmDangerAction = (): void => {
opacity: 1;
pointer-events: auto;
}
.submenu_item:not(.submenu_item_batch) {
.session-fork-indicator { display: none; }
.session-row-menu-wrap--fork .menu-more-wrap { opacity: 1; }
}
}
.session-title-edit {

View File

@ -0,0 +1,35 @@
<template>
<span class="resource-icon" aria-hidden="true" :style="iconStyle" />
</template>
<script setup lang="ts">
import { computed } from 'vue'
import knowledgeIcon from '@/assets/img/zhishiku.svg'
import agentIcon from '@/assets/img/agent.svg'
import organizationIcon from '@/assets/img/organization.svg'
const props = withDefaults(defineProps<{
type: 'knowledge' | 'agent' | 'organization'
size?: number
}>(), { size: 20 })
// Reuse the navigation assets while inheriting the surrounding theme color.
const icons = { knowledge: knowledgeIcon, agent: agentIcon, organization: organizationIcon }
const iconStyle = computed(() => ({
width: `${props.size}px`,
height: `${props.size}px`,
maskImage: `url("${icons[props.type]}")`,
}))
</script>
<style scoped>
.resource-icon {
display: inline-block;
flex-shrink: 0;
vertical-align: middle;
background-color: currentColor;
mask-repeat: no-repeat;
mask-position: center;
mask-size: contain;
}
</style>

View File

@ -1493,14 +1493,6 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
flex-shrink: 0;
}
:deep(.submenu_fork_icon) {
color: inherit;
font-size: var(--app-text-sm);
margin-right: 4px;
vertical-align: middle;
flex-shrink: 0;
}
.submenu_source_icon {
width: 14px;
height: 14px;
@ -1629,9 +1621,6 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
color: var(--td-text-color-primary);
}
:deep(.menu-more-wrap) {
opacity: 1;
}
}
&.session-chat-row--active .session-list-row {

View File

@ -583,8 +583,9 @@
</div>
<!-- 空状态:全部(保留创建 CTA) -->
<EmptyState v-if="!keyword.trim() && spaceSelection === 'all' && filteredAgents.length === 0 && !loading" icon="chat-bubble-1" :title="$t('agent.empty.title')"
<EmptyState v-if="!keyword.trim() && spaceSelection === 'all' && filteredAgents.length === 0 && !loading" :title="$t('agent.empty.title')"
:description="$t('agent.empty.description')">
<template #icon><ResourceIcon type="agent" :size="32" /></template>
<t-button v-if="authStore.hasRole('contributor')" theme="primary" class="agent-create-btn"
data-guide="agent-list-create" @click="handleCreateAgent">
<template #icon>
@ -616,8 +617,9 @@
<EmptyState v-if="!keyword.trim() && spaceSelection === 'recents' && filteredAgents.length === 0 && !loading" icon="history" :title="$t('agent.empty.recentsTitle')"
:description="$t('agent.empty.recentsDescription')" />
<!-- 空状态:我的 -->
<EmptyState v-if="!keyword.trim() && spaceSelection === 'mine' && agents.length === 0 && !loading" icon="chat-bubble-1" :title="$t('agent.empty.title')"
<EmptyState v-if="!keyword.trim() && spaceSelection === 'mine' && agents.length === 0 && !loading" :title="$t('agent.empty.title')"
:description="$t('agent.empty.description')">
<template #icon><ResourceIcon type="agent" :size="32" /></template>
<t-button v-if="authStore.hasRole('contributor')" theme="primary" class="agent-create-btn"
@click="handleCreateAgent">
<template #icon>
@ -643,8 +645,10 @@
</t-button>
</EmptyState>
<!-- 空状态:空间下 -->
<EmptyState v-if="!keyword.trim() && spaceSelectionOrgId && !spaceAgentsLoading && spaceAgentsList.length === 0" icon="chat-bubble-1" :title="$t('agent.empty.sharedTitle')"
:description="$t('agent.empty.sharedDescription')" />
<EmptyState v-if="!keyword.trim() && spaceSelectionOrgId && !spaceAgentsLoading && spaceAgentsList.length === 0" :title="$t('agent.empty.sharedTitle')"
:description="$t('agent.empty.sharedDescription')">
<template #icon><ResourceIcon type="agent" :size="32" /></template>
</EmptyState>
</div>
</div>
@ -731,6 +735,7 @@ import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { MessagePlugin, Icon as TIcon } from 'tdesign-vue-next'
import EmptyState from '@/components/EmptyState.vue'
import ResourceIcon from '@/components/icons/ResourceIcon.vue'
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
import { deleteAgent, copyAgent, type CustomAgent } from '@/api/agent'
import { useChatResourcesStore } from '@/stores/chatResources'

View File

@ -586,8 +586,9 @@
</div>
<!-- 全部空状态:保留「新建知识库」CTA,因为是空间没有任何 KB 的真空场景 -->
<EmptyState v-if="!keyword.trim() && spaceSelection === 'all' && filteredKnowledgeBases.length === 0 && !loading" icon="folder-open" :title="$t('knowledgeList.empty.title')"
<EmptyState v-if="!keyword.trim() && spaceSelection === 'all' && filteredKnowledgeBases.length === 0 && !loading" :title="$t('knowledgeList.empty.title')"
:description="$t('knowledgeList.empty.description')">
<template #icon><ResourceIcon type="knowledge" :size="32" /></template>
<t-button v-if="authStore.hasRole('contributor')" theme="primary" class="kb-create-btn"
data-guide="kb-list-create" @click="handleCreateKnowledgeBase">
<template #icon><t-icon name="folder-add" /></template>
@ -605,8 +606,9 @@
:description="$t('knowledgeList.empty.recentsDescription')" />
<!-- 我的知识库空状态 -->
<EmptyState v-if="!keyword.trim() && spaceSelection === 'mine' && kbs.length === 0 && !loading" icon="folder-open" :title="$t('knowledgeList.empty.title')"
<EmptyState v-if="!keyword.trim() && spaceSelection === 'mine' && kbs.length === 0 && !loading" :title="$t('knowledgeList.empty.title')"
:description="$t('knowledgeList.empty.description')">
<template #icon><ResourceIcon type="knowledge" :size="32" /></template>
<t-button v-if="authStore.hasRole('contributor')" theme="primary" class="kb-create-btn"
data-guide="kb-list-create" @click="handleCreateKnowledgeBase">
<template #icon><t-icon name="folder-add" /></template>
@ -615,8 +617,10 @@
</EmptyState>
<!-- 空间下知识库空状态 -->
<EmptyState v-if="!keyword.trim() && spaceSelectionOrgId && !spaceKbsLoading && spaceKbsList.length === 0" icon="folder-open" :title="$t('knowledgeList.empty.sharedTitle')"
:description="$t('knowledgeList.empty.sharedDescription')" />
<EmptyState v-if="!keyword.trim() && spaceSelectionOrgId && !spaceKbsLoading && spaceKbsList.length === 0" :title="$t('knowledgeList.empty.sharedTitle')"
:description="$t('knowledgeList.empty.sharedDescription')">
<template #icon><ResourceIcon type="knowledge" :size="32" /></template>
</EmptyState>
</div>
</div>
@ -702,6 +706,7 @@ import { onMounted, onUnmounted, ref, computed, watch, nextTick } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { MessagePlugin, Icon as TIcon } from 'tdesign-vue-next'
import EmptyState from '@/components/EmptyState.vue'
import ResourceIcon from '@/components/icons/ResourceIcon.vue'
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
import { deleteKnowledgeBase, duplicateKnowledgeBase, togglePinKnowledgeBase } from '@/api/knowledge-base'
import { useChatResourcesStore } from '@/stores/chatResources'

View File

@ -167,8 +167,9 @@
</div>
<!-- 空状态(按筛选显示不同文案) -->
<EmptyState v-if="!keyword.trim() && !loading && filteredOrganizations.length === 0" icon="usergroup" :title="emptyStateTitle"
<EmptyState v-if="!keyword.trim() && !loading && filteredOrganizations.length === 0" :title="emptyStateTitle"
:description="emptyStateDesc">
<template #icon><ResourceIcon type="organization" :size="32" /></template>
<t-tooltip :content="noPermissionTip" placement="top" :disabled="canManageOrg">
<t-button theme="default" variant="outline" class="org-join-btn" :disabled="!canManageOrg"
@click="handleJoinOrganization">
@ -430,6 +431,7 @@ import { ref, reactive, onMounted, onUnmounted, computed, watch, nextTick } from
import { useRoute, useRouter } from 'vue-router'
import { MessagePlugin } from 'tdesign-vue-next'
import EmptyState from '@/components/EmptyState.vue'
import ResourceIcon from '@/components/icons/ResourceIcon.vue'
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
import { useOrganizationStore } from '@/stores/organization'
import { useAuthStore } from '@/stores/auth'