parent
e986579731
commit
014f95f139
|
|
@ -11,7 +11,9 @@
|
||||||
<t-select v-if="mode === 'resource' && spaceOptions.length" class="space-filter"
|
<t-select v-if="mode === 'resource' && spaceOptions.length" class="space-filter"
|
||||||
:value="selectedSpace" :options="spaceOptions" :placeholder="$t('listSpaceSidebar.spaces')"
|
:value="selectedSpace" :options="spaceOptions" :placeholder="$t('listSpaceSidebar.spaces')"
|
||||||
:aria-label="$t('listSpaceSidebar.spaces')" filterable clearable
|
: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>
|
</div>
|
||||||
<t-input :model-value="query" class="search-input" :placeholder="$t('menu.search')"
|
<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 ?? ''))">
|
: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 { computed, onMounted } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useOrganizationStore } from '@/stores/organization'
|
import { useOrganizationStore } from '@/stores/organization'
|
||||||
|
import ResourceIcon from '@/components/icons/ResourceIcon.vue'
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
modelValue: string
|
modelValue: string
|
||||||
|
|
|
||||||
|
|
@ -15,17 +15,18 @@
|
||||||
</form>
|
</form>
|
||||||
<span v-else class="submenu_title" :class="batchMode ? 'submenu_title--batch' : ''" :title="item.title">
|
<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-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 ref="titleTextRef" class="submenu_title-text">{{ item.title }}</span>
|
||||||
<span v-if="apiOwnerTag" class="session-owner-tag" :class="`session-owner-tag--${apiOwnerTag.kind}`"
|
<span v-if="apiOwnerTag" class="session-owner-tag" :class="`session-owner-tag--${apiOwnerTag.kind}`"
|
||||||
:title="apiOwnerTag.full">{{ apiOwnerTag.label }}</span>
|
:title="apiOwnerTag.full">{{ apiOwnerTag.label }}</span>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="running" class="session-running-indicator" role="status" :aria-label="t('menu.sessionInProgress')"
|
<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>
|
: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>
|
<div v-if="!batchMode || item.parent_session_id" class="session-row-menu-wrap"
|
||||||
<t-popup v-model:visible="menuOpen" :overlay-class-name="menuOverlayClass" trigger="click" destroy-on-close
|
: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">
|
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>
|
<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" />
|
<t-icon name="ellipsis" class="menu-more" />
|
||||||
|
|
@ -249,6 +250,29 @@ const confirmDangerAction = (): void => {
|
||||||
pointer-events: none;
|
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:hover,
|
||||||
.submenu_item:focus-within,
|
.submenu_item:focus-within,
|
||||||
.submenu_item--menu-open {
|
.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) {
|
@media (hover: none) {
|
||||||
.session-row-menu-wrap {
|
.session-row-menu-wrap {
|
||||||
flex-basis: 24px;
|
flex-basis: 24px;
|
||||||
|
|
@ -267,6 +298,10 @@ const confirmDangerAction = (): void => {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
pointer-events: auto;
|
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 {
|
.session-title-edit {
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -1493,14 +1493,6 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
|
||||||
flex-shrink: 0;
|
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 {
|
.submenu_source_icon {
|
||||||
width: 14px;
|
width: 14px;
|
||||||
height: 14px;
|
height: 14px;
|
||||||
|
|
@ -1629,9 +1621,6 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
|
||||||
color: var(--td-text-color-primary);
|
color: var(--td-text-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.menu-more-wrap) {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.session-chat-row--active .session-list-row {
|
&.session-chat-row--active .session-list-row {
|
||||||
|
|
|
||||||
|
|
@ -583,8 +583,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 空状态:全部(保留创建 CTA) -->
|
<!-- 空状态:全部(保留创建 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')">
|
: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"
|
<t-button v-if="authStore.hasRole('contributor')" theme="primary" class="agent-create-btn"
|
||||||
data-guide="agent-list-create" @click="handleCreateAgent">
|
data-guide="agent-list-create" @click="handleCreateAgent">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
|
|
@ -616,8 +617,9 @@
|
||||||
<EmptyState v-if="!keyword.trim() && spaceSelection === 'recents' && filteredAgents.length === 0 && !loading" icon="history" :title="$t('agent.empty.recentsTitle')"
|
<EmptyState v-if="!keyword.trim() && spaceSelection === 'recents' && filteredAgents.length === 0 && !loading" icon="history" :title="$t('agent.empty.recentsTitle')"
|
||||||
:description="$t('agent.empty.recentsDescription')" />
|
: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')">
|
: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"
|
<t-button v-if="authStore.hasRole('contributor')" theme="primary" class="agent-create-btn"
|
||||||
@click="handleCreateAgent">
|
@click="handleCreateAgent">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
|
|
@ -643,8 +645,10 @@
|
||||||
</t-button>
|
</t-button>
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
<!-- 空状态:空间下 -->
|
<!-- 空状态:空间下 -->
|
||||||
<EmptyState v-if="!keyword.trim() && spaceSelectionOrgId && !spaceAgentsLoading && spaceAgentsList.length === 0" icon="chat-bubble-1" :title="$t('agent.empty.sharedTitle')"
|
<EmptyState v-if="!keyword.trim() && spaceSelectionOrgId && !spaceAgentsLoading && spaceAgentsList.length === 0" :title="$t('agent.empty.sharedTitle')"
|
||||||
:description="$t('agent.empty.sharedDescription')" />
|
:description="$t('agent.empty.sharedDescription')">
|
||||||
|
<template #icon><ResourceIcon type="agent" :size="32" /></template>
|
||||||
|
</EmptyState>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -731,6 +735,7 @@ import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { MessagePlugin, Icon as TIcon } from 'tdesign-vue-next'
|
import { MessagePlugin, Icon as TIcon } from 'tdesign-vue-next'
|
||||||
import EmptyState from '@/components/EmptyState.vue'
|
import EmptyState from '@/components/EmptyState.vue'
|
||||||
|
import ResourceIcon from '@/components/icons/ResourceIcon.vue'
|
||||||
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
|
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
|
||||||
import { deleteAgent, copyAgent, type CustomAgent } from '@/api/agent'
|
import { deleteAgent, copyAgent, type CustomAgent } from '@/api/agent'
|
||||||
import { useChatResourcesStore } from '@/stores/chatResources'
|
import { useChatResourcesStore } from '@/stores/chatResources'
|
||||||
|
|
|
||||||
|
|
@ -586,8 +586,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 全部空状态:保留「新建知识库」CTA,因为是空间没有任何 KB 的真空场景 -->
|
<!-- 全部空状态:保留「新建知识库」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')">
|
: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"
|
<t-button v-if="authStore.hasRole('contributor')" theme="primary" class="kb-create-btn"
|
||||||
data-guide="kb-list-create" @click="handleCreateKnowledgeBase">
|
data-guide="kb-list-create" @click="handleCreateKnowledgeBase">
|
||||||
<template #icon><t-icon name="folder-add" /></template>
|
<template #icon><t-icon name="folder-add" /></template>
|
||||||
|
|
@ -605,8 +606,9 @@
|
||||||
:description="$t('knowledgeList.empty.recentsDescription')" />
|
: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')">
|
: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"
|
<t-button v-if="authStore.hasRole('contributor')" theme="primary" class="kb-create-btn"
|
||||||
data-guide="kb-list-create" @click="handleCreateKnowledgeBase">
|
data-guide="kb-list-create" @click="handleCreateKnowledgeBase">
|
||||||
<template #icon><t-icon name="folder-add" /></template>
|
<template #icon><t-icon name="folder-add" /></template>
|
||||||
|
|
@ -615,8 +617,10 @@
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
|
|
||||||
<!-- 空间下知识库空状态 -->
|
<!-- 空间下知识库空状态 -->
|
||||||
<EmptyState v-if="!keyword.trim() && spaceSelectionOrgId && !spaceKbsLoading && spaceKbsList.length === 0" icon="folder-open" :title="$t('knowledgeList.empty.sharedTitle')"
|
<EmptyState v-if="!keyword.trim() && spaceSelectionOrgId && !spaceKbsLoading && spaceKbsList.length === 0" :title="$t('knowledgeList.empty.sharedTitle')"
|
||||||
:description="$t('knowledgeList.empty.sharedDescription')" />
|
:description="$t('knowledgeList.empty.sharedDescription')">
|
||||||
|
<template #icon><ResourceIcon type="knowledge" :size="32" /></template>
|
||||||
|
</EmptyState>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -702,6 +706,7 @@ import { onMounted, onUnmounted, ref, computed, watch, nextTick } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import { MessagePlugin, Icon as TIcon } from 'tdesign-vue-next'
|
import { MessagePlugin, Icon as TIcon } from 'tdesign-vue-next'
|
||||||
import EmptyState from '@/components/EmptyState.vue'
|
import EmptyState from '@/components/EmptyState.vue'
|
||||||
|
import ResourceIcon from '@/components/icons/ResourceIcon.vue'
|
||||||
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
|
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
|
||||||
import { deleteKnowledgeBase, duplicateKnowledgeBase, togglePinKnowledgeBase } from '@/api/knowledge-base'
|
import { deleteKnowledgeBase, duplicateKnowledgeBase, togglePinKnowledgeBase } from '@/api/knowledge-base'
|
||||||
import { useChatResourcesStore } from '@/stores/chatResources'
|
import { useChatResourcesStore } from '@/stores/chatResources'
|
||||||
|
|
|
||||||
|
|
@ -167,8 +167,9 @@
|
||||||
</div>
|
</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">
|
:description="emptyStateDesc">
|
||||||
|
<template #icon><ResourceIcon type="organization" :size="32" /></template>
|
||||||
<t-tooltip :content="noPermissionTip" placement="top" :disabled="canManageOrg">
|
<t-tooltip :content="noPermissionTip" placement="top" :disabled="canManageOrg">
|
||||||
<t-button theme="default" variant="outline" class="org-join-btn" :disabled="!canManageOrg"
|
<t-button theme="default" variant="outline" class="org-join-btn" :disabled="!canManageOrg"
|
||||||
@click="handleJoinOrganization">
|
@click="handleJoinOrganization">
|
||||||
|
|
@ -430,6 +431,7 @@ import { ref, reactive, onMounted, onUnmounted, computed, watch, nextTick } from
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { MessagePlugin } from 'tdesign-vue-next'
|
import { MessagePlugin } from 'tdesign-vue-next'
|
||||||
import EmptyState from '@/components/EmptyState.vue'
|
import EmptyState from '@/components/EmptyState.vue'
|
||||||
|
import ResourceIcon from '@/components/icons/ResourceIcon.vue'
|
||||||
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
|
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
|
||||||
import { useOrganizationStore } from '@/stores/organization'
|
import { useOrganizationStore } from '@/stores/organization'
|
||||||
import { useAuthStore } from '@/stores/auth'
|
import { useAuthStore } from '@/stores/auth'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue