feat(i18n): update localization files for improved clarity and consistency
Enhanced English, Korean, Russian, and Chinese localization files by adding new section labels such as "Built-in," "Created by me," and "Other members" to improve user understanding. Adjusted existing labels for better clarity and consistency across languages. This update ensures a more intuitive user experience in navigating shared and personal resources. Refs: #1303
This commit is contained in:
@@ -426,7 +426,10 @@ export default {
|
||||
sharedToMe: 'Shared to Me',
|
||||
},
|
||||
sections: {
|
||||
builtin: 'Built-in',
|
||||
mine: 'Created by me',
|
||||
tenantReadonly: 'Workspace · View only',
|
||||
tenantOthers: 'Workspace · Other members',
|
||||
sharedEditable: 'Shared with me · Can edit',
|
||||
sharedReadonly: 'Shared with me · View only',
|
||||
},
|
||||
@@ -1622,8 +1625,9 @@ export default {
|
||||
},
|
||||
sections: {
|
||||
pinned: 'Pinned',
|
||||
others: 'Others',
|
||||
mine: 'Created by me',
|
||||
tenantReadonly: 'Workspace · View only',
|
||||
tenantOthers: 'Workspace · Other members',
|
||||
sharedEditable: 'Shared with me · Can edit',
|
||||
sharedReadonly: 'Shared with me · View only',
|
||||
},
|
||||
|
||||
@@ -1318,7 +1318,10 @@ export default {
|
||||
sharedToMe: "나와 공유됨",
|
||||
},
|
||||
sections: {
|
||||
builtin: "내장",
|
||||
mine: "내가 만듦",
|
||||
tenantReadonly: "워크스페이스 · 읽기 전용",
|
||||
tenantOthers: "워크스페이스 · 다른 멤버",
|
||||
sharedEditable: "공유받음 · 편집 가능",
|
||||
sharedReadonly: "공유받음 · 읽기 전용",
|
||||
},
|
||||
@@ -2286,8 +2289,9 @@ export default {
|
||||
},
|
||||
sections: {
|
||||
pinned: "고정됨",
|
||||
others: "기타",
|
||||
mine: "내가 만듦",
|
||||
tenantReadonly: "워크스페이스 · 읽기 전용",
|
||||
tenantOthers: "워크스페이스 · 다른 멤버",
|
||||
sharedEditable: "공유받음 · 편집 가능",
|
||||
sharedReadonly: "공유받음 · 읽기 전용",
|
||||
},
|
||||
|
||||
@@ -518,7 +518,10 @@ export default {
|
||||
sharedToMe: 'Shared to Me'
|
||||
},
|
||||
sections: {
|
||||
builtin: 'Встроенные',
|
||||
mine: 'Созданные мной',
|
||||
tenantReadonly: 'Рабочая область · Только просмотр',
|
||||
tenantOthers: 'Рабочая область · Другие участники',
|
||||
sharedEditable: 'Доступно мне · Можно редактировать',
|
||||
sharedReadonly: 'Доступно мне · Только просмотр'
|
||||
},
|
||||
@@ -1861,8 +1864,9 @@ export default {
|
||||
},
|
||||
sections: {
|
||||
pinned: 'Закреплённые',
|
||||
others: 'Другие',
|
||||
mine: 'Созданные мной',
|
||||
tenantReadonly: 'Рабочая область · Только просмотр',
|
||||
tenantOthers: 'Рабочая область · Другие участники',
|
||||
sharedEditable: 'Доступно мне · Можно редактировать',
|
||||
sharedReadonly: 'Доступно мне · Только просмотр'
|
||||
},
|
||||
|
||||
@@ -1312,7 +1312,10 @@ export default {
|
||||
sharedToMe: "共享给我",
|
||||
},
|
||||
sections: {
|
||||
builtin: "内置",
|
||||
mine: "我创建的",
|
||||
tenantReadonly: "本空间 · 仅查看",
|
||||
tenantOthers: "本空间 · 其他成员",
|
||||
sharedEditable: "共享给我 · 可编辑",
|
||||
sharedReadonly: "共享给我 · 仅查看",
|
||||
},
|
||||
@@ -2262,8 +2265,9 @@ export default {
|
||||
},
|
||||
sections: {
|
||||
pinned: "置顶",
|
||||
others: "其他",
|
||||
mine: "我创建的",
|
||||
tenantReadonly: "本空间 · 仅查看",
|
||||
tenantOthers: "本空间 · 其他成员",
|
||||
sharedEditable: "共享给我 · 可编辑",
|
||||
sharedReadonly: "共享给我 · 仅查看",
|
||||
},
|
||||
|
||||
@@ -66,24 +66,74 @@
|
||||
class="agent-card-wrap">
|
||||
<template v-for="(agent, index) in filteredAgents"
|
||||
:key="agent.isMine ? agent.id : `shared-${agent.share_id}`">
|
||||
<!-- 本空间 · 仅查看:本租户里我无法编辑的(同事创建 / 内建),
|
||||
仅在「全部」视图、contributor 角色下出现 -->
|
||||
<!-- 内置:始终置顶。filteredAgents 在 all 视图里已经把
|
||||
builtin 排到最前;这里只在第一张 builtin 之前打一次标题。 -->
|
||||
<div v-if="spaceSelection === 'all'
|
||||
&& showShareGroupHeaders
|
||||
&& agent.isMine
|
||||
&& agent.is_builtin
|
||||
&& (index === 0
|
||||
|| !filteredAgents[index - 1].isMine
|
||||
|| !(filteredAgents[index - 1] as AgentWithUI).is_builtin)" class="agent-section-header" role="button"
|
||||
tabindex="0" @click="toggleAgentSection('builtin')"
|
||||
@keydown.enter.prevent="toggleAgentSection('builtin')"
|
||||
@keydown.space.prevent="toggleAgentSection('builtin')">
|
||||
<t-icon name="app" size="14px" />
|
||||
<span>{{ $t('agent.sections.builtin') }}</span>
|
||||
<t-icon class="agent-section-toggle"
|
||||
:name="isAgentSectionCollapsed('builtin') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<!-- 我创建的:当前 agent 是本租户 + 非内置 + 我亲手创建,且前一张
|
||||
要么不存在、要么不是本租户、要么是内置(builtin → mine 过渡)、
|
||||
要么是同事创建。与 KB 列表对齐。 -->
|
||||
<div v-if="spaceSelection === 'all'
|
||||
&& showShareGroupHeaders
|
||||
&& agent.isMine
|
||||
&& !agent.is_builtin
|
||||
&& isMyAgent(agent)
|
||||
&& (index === 0
|
||||
|| !filteredAgents[index - 1].isMine
|
||||
|| (filteredAgents[index - 1] as AgentWithUI).is_builtin
|
||||
|| !isMyAgent(filteredAgents[index - 1] as AgentWithUI))" class="agent-section-header" role="button"
|
||||
tabindex="0" @click="toggleAgentSection('mine')"
|
||||
@keydown.enter.prevent="toggleAgentSection('mine')"
|
||||
@keydown.space.prevent="toggleAgentSection('mine')">
|
||||
<t-icon name="user" size="14px" />
|
||||
<span>{{ $t('agent.sections.mine') }}</span>
|
||||
<t-icon class="agent-section-toggle"
|
||||
:name="isAgentSectionCollapsed('mine') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<!-- 本空间 · 仅查看 / 其他成员:本租户里非内置且非我创建的同事 agent。 -->
|
||||
<div v-if="spaceSelection === 'all'
|
||||
&& showShareGroupHeaders
|
||||
&& agent.isMine
|
||||
&& !agent.is_builtin
|
||||
&& !isMyAgent(agent)
|
||||
&& (index === 0
|
||||
|| !filteredAgents[index - 1].isMine
|
||||
|| isMyAgent(filteredAgents[index - 1] as AgentWithUI))" class="agent-section-header">
|
||||
<span>{{ $t('agent.sections.tenantReadonly') }}</span>
|
||||
|| (filteredAgents[index - 1] as AgentWithUI).is_builtin
|
||||
|| isMyAgent(filteredAgents[index - 1] as AgentWithUI))" class="agent-section-header" role="button"
|
||||
tabindex="0" @click="toggleAgentSection('tenantOthers')"
|
||||
@keydown.enter.prevent="toggleAgentSection('tenantOthers')"
|
||||
@keydown.space.prevent="toggleAgentSection('tenantOthers')">
|
||||
<t-icon :name="tenantSectionIconName" size="14px" />
|
||||
<span>{{ $t(tenantSectionLabelKey) }}</span>
|
||||
<t-icon class="agent-section-toggle"
|
||||
:name="isAgentSectionCollapsed('tenantOthers') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<!-- 共享给我 · 可编辑:仅在「全部」视图过渡处显示分组标题 -->
|
||||
<div v-if="spaceSelection === 'all'
|
||||
&& showShareGroupHeaders
|
||||
&& !agent.isMine
|
||||
&& isSharedAgentEditable((agent as any).permission)
|
||||
&& (index === 0 || filteredAgents[index - 1].isMine)" class="agent-section-header">
|
||||
&& (index === 0 || filteredAgents[index - 1].isMine)" class="agent-section-header" role="button"
|
||||
tabindex="0" @click="toggleAgentSection('sharedEditable')"
|
||||
@keydown.enter.prevent="toggleAgentSection('sharedEditable')"
|
||||
@keydown.space.prevent="toggleAgentSection('sharedEditable')">
|
||||
<t-icon name="share" size="14px" />
|
||||
<span>{{ $t('agent.sections.sharedEditable') }}</span>
|
||||
<t-icon class="agent-section-toggle"
|
||||
:name="isAgentSectionCollapsed('sharedEditable') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<!-- 共享给我 · 仅查看 -->
|
||||
<div v-if="spaceSelection === 'all'
|
||||
@@ -92,20 +142,21 @@
|
||||
&& !isSharedAgentEditable((agent as any).permission)
|
||||
&& (index === 0
|
||||
|| filteredAgents[index - 1].isMine
|
||||
|| isSharedAgentEditable((filteredAgents[index - 1] as any).permission))" class="agent-section-header">
|
||||
|| isSharedAgentEditable((filteredAgents[index - 1] as any).permission))" class="agent-section-header"
|
||||
role="button" tabindex="0" @click="toggleAgentSection('sharedReadonly')"
|
||||
@keydown.enter.prevent="toggleAgentSection('sharedReadonly')"
|
||||
@keydown.space.prevent="toggleAgentSection('sharedReadonly')">
|
||||
<t-icon name="share" size="14px" />
|
||||
<span>{{ $t('agent.sections.sharedReadonly') }}</span>
|
||||
<t-icon class="agent-section-toggle"
|
||||
:name="isAgentSectionCollapsed('sharedReadonly') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<div class="agent-card" :class="{
|
||||
<div v-show="!isAgentRowHidden(agent)" class="agent-card" :class="{
|
||||
'is-builtin': agent.is_builtin,
|
||||
'agent-mode-normal': agent.config?.agent_mode === 'quick-answer',
|
||||
'agent-mode-agent': agent.config?.agent_mode === 'smart-reasoning',
|
||||
'shared-agent-card': !agent.isMine
|
||||
}" @click="handleCardClick(agent)">
|
||||
<!-- 收藏按钮 -->
|
||||
<button type="button" class="agent-favorite-star" :class="{ 'is-favorited': isAgentFavorited(agent.id) }"
|
||||
@click.stop="toggleFavoriteAgent(agent.id, $event)">
|
||||
<t-icon :name="isAgentFavorited(agent.id) ? 'star-filled' : 'star'" size="14px" />
|
||||
</button>
|
||||
<!-- 装饰星星 -->
|
||||
<div class="card-decoration">
|
||||
<svg class="star-icon" width="24" height="24" viewBox="0 0 20 20" fill="none"
|
||||
@@ -123,6 +174,13 @@
|
||||
fill="currentColor" fill-opacity="0.15" />
|
||||
</svg>
|
||||
</div>
|
||||
<!-- 收藏按钮:浮在卡片右上角;.card-header padding-right 已为
|
||||
"更多"按钮腾出空间,避免重叠。 -->
|
||||
<button type="button" class="agent-favorite-star"
|
||||
:class="{ 'is-favorited': isAgentFavorited(agent.id) }"
|
||||
@click.stop="toggleFavoriteAgent(agent.id, $event)">
|
||||
<t-icon :name="isAgentFavorited(agent.id) ? 'star-filled' : 'star'" size="14px" />
|
||||
</button>
|
||||
<div class="card-header">
|
||||
<div class="card-header-left">
|
||||
<div v-if="agent.is_builtin" class="builtin-avatar"
|
||||
@@ -250,22 +308,53 @@
|
||||
<!-- 我的智能体 -->
|
||||
<div v-if="spaceSelection === 'mine' && sortedMineAgents.length > 0" class="agent-card-wrap">
|
||||
<template v-for="(agent, index) in sortedMineAgents" :key="agent.id">
|
||||
<!-- 本空间 · 仅查看:从「我创建」首次过渡到「同事创建 / 内建」 -->
|
||||
<!-- 内置:始终置顶。sortedMineAgents 已按 内置→我→同事 排序。 -->
|
||||
<div v-if="showShareGroupHeaders
|
||||
&& !isMyAgent(agent)
|
||||
&& (index === 0 || isMyAgent(sortedMineAgents[index - 1]))" class="agent-section-header">
|
||||
<span>{{ $t('agent.sections.tenantReadonly') }}</span>
|
||||
&& agent.is_builtin
|
||||
&& (index === 0 || !sortedMineAgents[index - 1].is_builtin)" class="agent-section-header" role="button"
|
||||
tabindex="0" @click="toggleAgentSection('builtin')"
|
||||
@keydown.enter.prevent="toggleAgentSection('builtin')"
|
||||
@keydown.space.prevent="toggleAgentSection('builtin')">
|
||||
<t-icon name="app" size="14px" />
|
||||
<span>{{ $t('agent.sections.builtin') }}</span>
|
||||
<t-icon class="agent-section-toggle"
|
||||
:name="isAgentSectionCollapsed('builtin') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<div class="agent-card" :class="{
|
||||
<!-- 我创建的:第一张非内置且我亲手创建的卡片前打标题 -->
|
||||
<div v-if="showShareGroupHeaders
|
||||
&& !agent.is_builtin
|
||||
&& isMyAgent(agent)
|
||||
&& (index === 0
|
||||
|| sortedMineAgents[index - 1].is_builtin
|
||||
|| !isMyAgent(sortedMineAgents[index - 1]))" class="agent-section-header" role="button"
|
||||
tabindex="0" @click="toggleAgentSection('mine')"
|
||||
@keydown.enter.prevent="toggleAgentSection('mine')"
|
||||
@keydown.space.prevent="toggleAgentSection('mine')">
|
||||
<t-icon name="user" size="14px" />
|
||||
<span>{{ $t('agent.sections.mine') }}</span>
|
||||
<t-icon class="agent-section-toggle"
|
||||
:name="isAgentSectionCollapsed('mine') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<!-- 本空间 · 仅查看 / 其他成员:非内置且非我创建的同事 agent -->
|
||||
<div v-if="showShareGroupHeaders
|
||||
&& !agent.is_builtin
|
||||
&& !isMyAgent(agent)
|
||||
&& (index === 0
|
||||
|| sortedMineAgents[index - 1].is_builtin
|
||||
|| isMyAgent(sortedMineAgents[index - 1]))" class="agent-section-header" role="button"
|
||||
tabindex="0" @click="toggleAgentSection('tenantOthers')"
|
||||
@keydown.enter.prevent="toggleAgentSection('tenantOthers')"
|
||||
@keydown.space.prevent="toggleAgentSection('tenantOthers')">
|
||||
<t-icon :name="tenantSectionIconName" size="14px" />
|
||||
<span>{{ $t(tenantSectionLabelKey) }}</span>
|
||||
<t-icon class="agent-section-toggle"
|
||||
:name="isAgentSectionCollapsed('tenantOthers') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<div v-show="!isAgentRowHidden(agent)" class="agent-card" :class="{
|
||||
'is-builtin': agent.is_builtin,
|
||||
'agent-mode-normal': agent.config?.agent_mode === 'quick-answer',
|
||||
'agent-mode-agent': agent.config?.agent_mode === 'smart-reasoning'
|
||||
}" @click="handleCardClick(agent)">
|
||||
<!-- 收藏按钮 -->
|
||||
<button type="button" class="agent-favorite-star" :class="{ 'is-favorited': isAgentFavorited(agent.id) }"
|
||||
@click.stop="toggleFavoriteAgent(agent.id, $event)">
|
||||
<t-icon :name="isAgentFavorited(agent.id) ? 'star-filled' : 'star'" size="14px" />
|
||||
</button>
|
||||
<!-- 装饰星星 -->
|
||||
<div class="card-decoration">
|
||||
<svg class="star-icon" width="24" height="24" viewBox="0 0 20 20" fill="none"
|
||||
@@ -284,6 +373,11 @@
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<button type="button" class="agent-favorite-star"
|
||||
:class="{ 'is-favorited': isAgentFavorited(agent.id) }"
|
||||
@click.stop="toggleFavoriteAgent(agent.id, $event)">
|
||||
<t-icon :name="isAgentFavorited(agent.id) ? 'star-filled' : 'star'" size="14px" />
|
||||
</button>
|
||||
<!-- 卡片头部 -->
|
||||
<div class="card-header">
|
||||
<div class="card-header-left">
|
||||
@@ -405,8 +499,14 @@
|
||||
<div v-if="showShareGroupHeaders
|
||||
&& !shared.is_mine
|
||||
&& isSharedAgentEditable(shared.permission)
|
||||
&& (index === 0 || sortedSpaceAgentsList[index - 1].is_mine)" class="agent-section-header">
|
||||
&& (index === 0 || sortedSpaceAgentsList[index - 1].is_mine)" class="agent-section-header" role="button"
|
||||
tabindex="0" @click="toggleAgentSection('sharedEditable')"
|
||||
@keydown.enter.prevent="toggleAgentSection('sharedEditable')"
|
||||
@keydown.space.prevent="toggleAgentSection('sharedEditable')">
|
||||
<t-icon name="share" size="14px" />
|
||||
<span>{{ $t('agent.sections.sharedEditable') }}</span>
|
||||
<t-icon class="agent-section-toggle"
|
||||
:name="isAgentSectionCollapsed('sharedEditable') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<!-- 共享给我 · 仅查看:首次从可编辑 / is_mine 进入 viewer -->
|
||||
<div v-if="showShareGroupHeaders
|
||||
@@ -414,10 +514,16 @@
|
||||
&& !isSharedAgentEditable(shared.permission)
|
||||
&& (index === 0
|
||||
|| sortedSpaceAgentsList[index - 1].is_mine
|
||||
|| isSharedAgentEditable(sortedSpaceAgentsList[index - 1].permission))" class="agent-section-header">
|
||||
|| isSharedAgentEditable(sortedSpaceAgentsList[index - 1].permission))" class="agent-section-header"
|
||||
role="button" tabindex="0" @click="toggleAgentSection('sharedReadonly')"
|
||||
@keydown.enter.prevent="toggleAgentSection('sharedReadonly')"
|
||||
@keydown.space.prevent="toggleAgentSection('sharedReadonly')">
|
||||
<t-icon name="share" size="14px" />
|
||||
<span>{{ $t('agent.sections.sharedReadonly') }}</span>
|
||||
<t-icon class="agent-section-toggle"
|
||||
:name="isAgentSectionCollapsed('sharedReadonly') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<div class="agent-card shared-agent-card" :class="{
|
||||
<div v-show="!isAgentRowHidden(shared)" class="agent-card shared-agent-card" :class="{
|
||||
'agent-mode-normal': shared.agent?.config?.agent_mode === 'quick-answer',
|
||||
'agent-mode-agent': shared.agent?.config?.agent_mode === 'smart-reasoning'
|
||||
}" @click="handleSpaceAgentCardClick(shared)">
|
||||
@@ -852,16 +958,20 @@ const filteredAgents = computed<DisplayAgent[]>(() => {
|
||||
}
|
||||
if (spaceSelection.value !== 'all') return []
|
||||
const list: DisplayAgent[] = []
|
||||
// 本租户内的 agent 拆成「我创建」与「同事创建」两段,让 contributor
|
||||
// 视图能在二者之间插入「本空间 · 仅查看」分组标题。内建 agent
|
||||
// (is_builtin=true, created_by="") 视作"非我"——它本来就是租户共有的,
|
||||
// 也归到只读那一档;如果不是 contributor,标题被开关压住,看起来无差别。
|
||||
// 本租户内的 agent 拆成 内置 → 我创建 → 同事创建 三段。
|
||||
// 内置(is_builtin=true)和"个人所有权"是两个维度的概念,置顶为单独
|
||||
// 一段;它们的 created_by 始终为空,跟在「同事/无创建者」桶里反而让
|
||||
// tenantOthers 段同时混入"系统内置 + 历史无 owner 的自定义"两类,
|
||||
// 语义不清。
|
||||
const builtin: AgentWithUI[] = []
|
||||
const ownMine: AgentWithUI[] = []
|
||||
const teammateMine: AgentWithUI[] = []
|
||||
agents.value.forEach(a => {
|
||||
if (isMyAgent(a)) ownMine.push(a)
|
||||
if (a.is_builtin) builtin.push(a)
|
||||
else if (isMyAgent(a)) ownMine.push(a)
|
||||
else teammateMine.push(a)
|
||||
})
|
||||
builtin.forEach(a => list.push({ ...a, isMine: true as const }))
|
||||
ownMine.forEach(a => list.push({ ...a, isMine: true as const }))
|
||||
teammateMine.forEach(a => list.push({ ...a, isMine: true as const }))
|
||||
// 共享区按 share permission 排序:editor/admin 在前,viewer 在后,
|
||||
@@ -891,13 +1001,16 @@ const filteredAgents = computed<DisplayAgent[]>(() => {
|
||||
// 「工作空间」视图下的稳定排序:本租户内「我创建」在前、「同事创建 / 内建」
|
||||
// 在后。给 contributor 视图把「本空间 · 仅查看」分组标题正好插在过渡处。
|
||||
const sortedMineAgents = computed(() => {
|
||||
// 内置 → 我创建 → 同事创建。与 filteredAgents 的"全部"视图保持同序。
|
||||
const builtin: AgentWithUI[] = []
|
||||
const own: AgentWithUI[] = []
|
||||
const teammate: AgentWithUI[] = []
|
||||
agents.value.forEach(a => {
|
||||
if (isMyAgent(a)) own.push(a)
|
||||
if (a.is_builtin) builtin.push(a)
|
||||
else if (isMyAgent(a)) own.push(a)
|
||||
else teammate.push(a)
|
||||
})
|
||||
return [...own, ...teammate]
|
||||
return [...builtin, ...own, ...teammate]
|
||||
})
|
||||
|
||||
// 空间视角下的稳定排序:我自己创建的(is_mine)放前面,其余按 permission 切分。
|
||||
@@ -1165,9 +1278,61 @@ const AGENT_EDITABLE_PERMS = new Set(['admin', 'editor'])
|
||||
function isSharedAgentEditable(perm: string | undefined): boolean {
|
||||
return !!perm && AGENT_EDITABLE_PERMS.has(perm)
|
||||
}
|
||||
const showShareGroupHeaders = computed(() => {
|
||||
return authStore.hasRole('contributor') && !authStore.hasRole('admin')
|
||||
})
|
||||
// 与 KnowledgeBaseList 同理:分组标题对所有角色生效,依据"创建者 + 来源"
|
||||
// 这种客观信息分段,不再按当前用户的可写权限筛掉。
|
||||
const showShareGroupHeaders = computed(() => true)
|
||||
|
||||
// 同租户、非当前用户创建的 Agent 分组标题。
|
||||
// contributor / viewer 在本租户里对这些 Agent 没有写权限,所以打"仅查看";
|
||||
// admin / owner 对整个租户都有编辑权限,"仅查看"反而误导,统一改成
|
||||
// "本空间 · 其他成员"——按所有权而非权限来标注。
|
||||
const tenantSectionLabelKey = computed(() =>
|
||||
authStore.hasRole('admin')
|
||||
? 'agent.sections.tenantOthers'
|
||||
: 'agent.sections.tenantReadonly'
|
||||
)
|
||||
|
||||
// 与 KB 列表 .tenantSectionIconName 同理:admin/owner 看到"其他成员"配
|
||||
// usergroup(多人);contributor/viewer 看到"仅查看"配 browse(眼睛)。
|
||||
const tenantSectionIconName = computed(() =>
|
||||
authStore.hasRole('admin') ? 'usergroup' : 'browse'
|
||||
)
|
||||
|
||||
// 分组折叠:ephemeral,只在当前会话生效。和 KnowledgeBaseList 共用同一套
|
||||
// 思路——空 Set = 全展开,避免新增分段还得维护默认值。
|
||||
type AgentSectionKey = 'builtin' | 'mine' | 'tenantOthers' | 'sharedEditable' | 'sharedReadonly'
|
||||
const collapsedAgentSections = ref<Set<AgentSectionKey>>(new Set())
|
||||
const isAgentSectionCollapsed = (key: AgentSectionKey) => collapsedAgentSections.value.has(key)
|
||||
const toggleAgentSection = (key: AgentSectionKey) => {
|
||||
const next = new Set(collapsedAgentSections.value)
|
||||
if (next.has(key)) next.delete(key)
|
||||
else next.add(key)
|
||||
collapsedAgentSections.value = next
|
||||
}
|
||||
// 根据 agent 数据形态判分组:filteredAgents 元素带 isMine;sortedMineAgents
|
||||
// 是原始 agent(永远当作本租户);sortedSpaceAgentsList 用 is_mine。
|
||||
//
|
||||
// 当前用户自己创建的 agent 在模板里**没有**独立分组标题(不像 KB 那边有
|
||||
// "我创建的"段),所以这里返回 null——折叠任何分组都不会影响到它们。
|
||||
const agentSectionOf = (item: any): AgentSectionKey | null => {
|
||||
// 内置 agent(is_builtin=true)单独成段,置顶展示——它们是租户共有的
|
||||
// 系统资源,跟"我 / 同事 / 共享"几个所有权分类不在同一维度。判定要早于
|
||||
// shared 那一档,因为 filteredAgents 里的 shared 条目也可能携带 is_builtin
|
||||
// (理论上不会,但保守一些)。
|
||||
if (item?.is_builtin === true) return 'builtin'
|
||||
// 跨租户 shared 条目(filteredAgents 拆出来的 isMine=false / 空间视图的
|
||||
// sortedSpaceAgentsList 用 is_mine=false)一律按 permission 分到
|
||||
// sharedEditable / sharedReadonly。
|
||||
if (item?.isMine === false || item?.is_mine === false) {
|
||||
return isSharedAgentEditable(item?.permission) ? 'sharedEditable' : 'sharedReadonly'
|
||||
}
|
||||
// 本租户内:我亲手创建 → 'mine';同事 / 非内置但无 created_by → 'tenantOthers'。
|
||||
return isMyAgent(item as AgentWithUI) ? 'mine' : 'tenantOthers'
|
||||
}
|
||||
const isAgentRowHidden = (item: any): boolean => {
|
||||
const key = agentSectionOf(item)
|
||||
return key !== null && isAgentSectionCollapsed(key)
|
||||
}
|
||||
|
||||
const handleDelete = (agent: AgentWithUI) => {
|
||||
openMoreAgentId.value = null
|
||||
@@ -1307,7 +1472,8 @@ defineExpose({
|
||||
min-width: 0;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding: 8px 0;
|
||||
// 同 KB 列表:顶部去掉 padding,让 sticky 分组标题贴到容器最顶。
|
||||
padding: 0 0 8px;
|
||||
}
|
||||
|
||||
.agent-list-main-loading {
|
||||
@@ -1550,12 +1716,45 @@ defineExpose({
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 2px 0;
|
||||
// 同 KB 列表:下滑到当前分组时标题吸顶到滚动容器顶部,box-shadow 向上/
|
||||
// 向下延伸背景以封掉 sticky 边缘的 subpixel 残缝。
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 5;
|
||||
background: var(--td-bg-color-container);
|
||||
box-shadow: 0 -8px 0 0 var(--td-bg-color-container),
|
||||
0 4px 0 0 var(--td-bg-color-container);
|
||||
padding: 6px 4px 6px 0;
|
||||
color: var(--td-text-color-secondary);
|
||||
font-family: var(--app-font-family);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 20px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
outline: none;
|
||||
|
||||
&:hover {
|
||||
color: var(--td-text-color-primary);
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
box-shadow: 0 0 0 2px var(--td-brand-color-focus, rgba(0, 82, 217, 0.2));
|
||||
}
|
||||
|
||||
.t-icon {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.agent-section-toggle {
|
||||
margin-left: 4px;
|
||||
opacity: 0.7;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
&:hover .agent-section-toggle {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1573,7 +1772,7 @@ defineExpose({
|
||||
|
||||
.agent-card-wrap {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
gap: 10px;
|
||||
grid-template-columns: 1fr;
|
||||
animation: contentFadeIn 0.32s ease-out;
|
||||
}
|
||||
@@ -1597,7 +1796,7 @@ defineExpose({
|
||||
/* 与知识库列表卡片统一尺寸:紧凑行高、148px 卡片高 */
|
||||
.agent-card {
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
border-radius: 12px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
||||
@@ -1605,11 +1804,11 @@ defineExpose({
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
transition: all 0.25s ease;
|
||||
padding: 14px 16px;
|
||||
padding: 10px 14px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 148px;
|
||||
min-height: 148px;
|
||||
height: 128px;
|
||||
min-height: 128px;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--td-brand-color);
|
||||
@@ -1617,9 +1816,11 @@ defineExpose({
|
||||
}
|
||||
|
||||
.agent-favorite-star {
|
||||
// 浮在卡片右上角顶角。卡片自身有 padding,"更多"按钮在 header flex
|
||||
// 末端自然落在 padding 内部,与零位的 star 错开。
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 6px;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 3;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
@@ -1695,7 +1896,7 @@ defineExpose({
|
||||
}
|
||||
|
||||
.card-header {
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
@@ -1704,7 +1905,7 @@ defineExpose({
|
||||
}
|
||||
|
||||
.card-content {
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.card-description {
|
||||
@@ -1764,7 +1965,8 @@ defineExpose({
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
gap: 4px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.card-header-left {
|
||||
@@ -2053,6 +2255,18 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1900px) {
|
||||
.agent-card-wrap {
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 2200px) {
|
||||
.agent-card-wrap {
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除确认对话框样式
|
||||
:deep(.del-agent-dialog) {
|
||||
padding: 0px !important;
|
||||
|
||||
@@ -3437,36 +3437,38 @@ async function createNewSession(value: string): Promise<void> {
|
||||
|
||||
:deep(.t-tag) {
|
||||
cursor: pointer;
|
||||
max-width: 160px;
|
||||
max-width: 120px;
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
border-radius: 999px;
|
||||
border-color: var(--td-component-stroke);
|
||||
color: var(--td-text-color-primary);
|
||||
padding: 0 10px;
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
color: var(--td-text-color-secondary);
|
||||
padding: 0 6px;
|
||||
background: transparent;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--td-brand-color);
|
||||
color: var(--td-brand-color-active);
|
||||
background: var(--td-success-color-light);
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
}
|
||||
}
|
||||
|
||||
.tag-text {
|
||||
display: inline-block;
|
||||
max-width: 110px;
|
||||
max-width: 80px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
font-size: 12px;
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
.card-bottom-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.faq-manager-wrapper {
|
||||
@@ -3532,8 +3534,9 @@ async function createNewSession(value: string): Promise<void> {
|
||||
.doc-card-list {
|
||||
box-sizing: border-box;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
|
||||
gap: 16px;
|
||||
// 文档卡片信息量较大(标题 + 摘要 + 标签/类型),保持稍宽的最小列宽,避免一行塞太多导致内容拥挤。
|
||||
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||
gap: 10px;
|
||||
align-content: flex-start;
|
||||
width: 100%;
|
||||
|
||||
@@ -3550,20 +3553,20 @@ async function createNewSession(value: string): Promise<void> {
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 12px 16px 8px;
|
||||
padding: 8px 12px 6px;
|
||||
}
|
||||
|
||||
.card-content-nav {
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.card-bottom {
|
||||
flex-shrink: 0;
|
||||
margin-top: auto;
|
||||
width: 100%;
|
||||
padding: 0 16px;
|
||||
padding: 0 12px;
|
||||
box-sizing: border-box;
|
||||
height: 34px;
|
||||
height: 28px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
@@ -3857,15 +3860,15 @@ async function createNewSession(value: string): Promise<void> {
|
||||
}
|
||||
|
||||
.knowledge-card {
|
||||
min-width: 248px;
|
||||
min-width: 240px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 1px solid color-mix(in srgb, var(--td-component-stroke) 82%, var(--td-bg-color-secondarycontainer));
|
||||
height: 148px;
|
||||
border-radius: 9px;
|
||||
border: 1px solid var(--td-component-border);
|
||||
height: 128px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.035);
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
|
||||
background: var(--td-bg-color-container);
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
@@ -3913,7 +3916,7 @@ async function createNewSession(value: string): Promise<void> {
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 12px 16px 8px;
|
||||
padding: 8px 12px 6px;
|
||||
}
|
||||
|
||||
.card-analyze {
|
||||
@@ -3945,21 +3948,21 @@ async function createNewSession(value: string): Promise<void> {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 0;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.card-content-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 29px;
|
||||
line-height: 29px;
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: var(--td-text-color-primary);
|
||||
font-family: var(--app-font-family);
|
||||
font-size: 15px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.01em;
|
||||
margin-right: 8px;
|
||||
@@ -4007,9 +4010,9 @@ async function createNewSession(value: string): Promise<void> {
|
||||
.card-bottom {
|
||||
flex-shrink: 0;
|
||||
margin-top: auto;
|
||||
padding: 0 16px;
|
||||
padding: 0 12px;
|
||||
box-sizing: border-box;
|
||||
height: 34px;
|
||||
height: 28px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -96,40 +96,70 @@
|
||||
<!-- 置顶分组标题 -->
|
||||
<div
|
||||
v-if="filteredKnowledgeBases[0] && filteredKnowledgeBases[0].isMine && filteredKnowledgeBases[0].is_pinned"
|
||||
class="kb-section-header kb-section-header-pinned">
|
||||
class="kb-section-header kb-section-header-pinned" role="button" tabindex="0"
|
||||
@click="toggleKbSection('pinned')"
|
||||
@keydown.enter.prevent="toggleKbSection('pinned')"
|
||||
@keydown.space.prevent="toggleKbSection('pinned')">
|
||||
<t-icon name="pin-filled" size="14px" />
|
||||
<span>{{ $t('knowledgeList.sections.pinned') }}</span>
|
||||
<t-icon class="kb-section-toggle" :name="isKbSectionCollapsed('pinned') ? 'chevron-right' : 'chevron-down'"
|
||||
size="14px" />
|
||||
</div>
|
||||
<!-- 全部:我的知识库 + 共享给我的知识库 -->
|
||||
<!-- 全部:我的知识库 + 共享给我的知识库。
|
||||
「已置顶」分组由顶部 header 接管。其余分段(我创建 / 本空间 ·
|
||||
仅查看 / 共享给我)各自打自己的标题;原本的「其他」过渡标题
|
||||
在 per-user 置顶模型下已无意义,删除以免和具体子段标题叠加。 -->
|
||||
<template v-for="(kb, index) in filteredKnowledgeBases" :key="kb.id">
|
||||
<!-- 「其他」(置顶→非置顶):admin/owner/viewer 维持原行为,
|
||||
在任意 mine 子段内的置顶→非置顶处触发;contributor 视图下
|
||||
跨创建者的边界由下面更语义化的分组标题接管,「其他」收紧到
|
||||
同一创建者子段内部,以免双标题叠加。 -->
|
||||
<div v-if="index > 0
|
||||
&& filteredKnowledgeBases[index - 1].isMine
|
||||
&& filteredKnowledgeBases[index - 1].is_pinned
|
||||
<!-- 我创建的:第一张「我创建」非置顶卡片前打标题,统一展示
|
||||
不管上方是否存在「已置顶」段。与「本空间 · 仅查看」同样
|
||||
仅在 contributor 视图下出现——admin/owner 视图原本就没有
|
||||
任何分段标题,单独冒一个反而失衡。 -->
|
||||
<div v-if="showShareGroupHeaders
|
||||
&& kb.isMine
|
||||
&& isMyKb(kb as KB)
|
||||
&& !kb.is_pinned
|
||||
&& (!showShareGroupHeaders
|
||||
|| isMyKb(filteredKnowledgeBases[index - 1] as KB) === isMyKb(kb as KB))" class="kb-section-header">
|
||||
<span>{{ $t('knowledgeList.sections.others') }}</span>
|
||||
&& (index === 0
|
||||
|| (filteredKnowledgeBases[index - 1] as any).is_pinned)" class="kb-section-header" role="button"
|
||||
tabindex="0" @click="toggleKbSection('mine')"
|
||||
@keydown.enter.prevent="toggleKbSection('mine')"
|
||||
@keydown.space.prevent="toggleKbSection('mine')">
|
||||
<t-icon name="user" size="14px" />
|
||||
<span>{{ $t('knowledgeList.sections.mine') }}</span>
|
||||
<t-icon class="kb-section-toggle" :name="isKbSectionCollapsed('mine') ? 'chevron-right' : 'chevron-down'"
|
||||
size="14px" />
|
||||
</div>
|
||||
<!-- 本空间 · 仅查看:本租户里同事创建、对当前 contributor 不可编辑 -->
|
||||
<!-- 本空间 · 仅查看:本租户里同事创建、对当前 contributor 不可编辑。
|
||||
当前卡片必须是非置顶(否则归在「已置顶」),且前一张要么
|
||||
不存在、要么是「共享给我」、要么是我创建、要么是置顶卡片
|
||||
(置顶→非置顶的过渡同样要打这个标题)。 -->
|
||||
<div v-if="showShareGroupHeaders
|
||||
&& kb.isMine
|
||||
&& !isMyKb(kb as KB)
|
||||
&& !kb.is_pinned
|
||||
&& (index === 0
|
||||
|| !filteredKnowledgeBases[index - 1].isMine
|
||||
|| isMyKb(filteredKnowledgeBases[index - 1] as KB))" class="kb-section-header">
|
||||
<span>{{ $t('knowledgeList.sections.tenantReadonly') }}</span>
|
||||
|| isMyKb(filteredKnowledgeBases[index - 1] as KB)
|
||||
|| (filteredKnowledgeBases[index - 1] as any).is_pinned)" class="kb-section-header" role="button"
|
||||
tabindex="0" @click="toggleKbSection('tenantOthers')"
|
||||
@keydown.enter.prevent="toggleKbSection('tenantOthers')"
|
||||
@keydown.space.prevent="toggleKbSection('tenantOthers')">
|
||||
<t-icon :name="tenantSectionIconName" size="14px" />
|
||||
<span>{{ $t(tenantSectionLabelKey) }}</span>
|
||||
<t-icon class="kb-section-toggle"
|
||||
:name="isKbSectionCollapsed('tenantOthers') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<!-- 共享给我 · 可编辑:从「我的(含同事)」首次过渡到共享 + 可编辑 -->
|
||||
<div v-if="showShareGroupHeaders
|
||||
&& !kb.isMine
|
||||
&& isSharedKbEditable((kb as any).permission)
|
||||
&& (index === 0 || filteredKnowledgeBases[index - 1].isMine)" class="kb-section-header">
|
||||
&& (index === 0 || filteredKnowledgeBases[index - 1].isMine)" class="kb-section-header" role="button"
|
||||
tabindex="0" @click="toggleKbSection('sharedEditable')"
|
||||
@keydown.enter.prevent="toggleKbSection('sharedEditable')"
|
||||
@keydown.space.prevent="toggleKbSection('sharedEditable')">
|
||||
<t-icon name="share" size="14px" />
|
||||
<span>{{ $t('knowledgeList.sections.sharedEditable') }}</span>
|
||||
<t-icon class="kb-section-toggle"
|
||||
:name="isKbSectionCollapsed('sharedEditable') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<!-- 共享给我 · 仅查看:从「可编辑共享 / 我的」过渡到 viewer 共享 -->
|
||||
<div v-if="showShareGroupHeaders
|
||||
@@ -138,11 +168,16 @@
|
||||
&& (index === 0
|
||||
|| filteredKnowledgeBases[index - 1].isMine
|
||||
|| isSharedKbEditable((filteredKnowledgeBases[index - 1] as any).permission))"
|
||||
class="kb-section-header">
|
||||
class="kb-section-header" role="button" tabindex="0" @click="toggleKbSection('sharedReadonly')"
|
||||
@keydown.enter.prevent="toggleKbSection('sharedReadonly')"
|
||||
@keydown.space.prevent="toggleKbSection('sharedReadonly')">
|
||||
<t-icon name="share" size="14px" />
|
||||
<span>{{ $t('knowledgeList.sections.sharedReadonly') }}</span>
|
||||
<t-icon class="kb-section-toggle"
|
||||
:name="isKbSectionCollapsed('sharedReadonly') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<!-- 我的知识库卡片 -->
|
||||
<div v-if="kb.isMine" class="kb-card" :class="{
|
||||
<div v-if="kb.isMine" v-show="!isKbSectionCollapsed(kbSectionOf(kb))" class="kb-card" :class="{
|
||||
'uninitialized': !isInitialized(kb),
|
||||
'kb-type-document': (kb.type || 'document') === 'document',
|
||||
'kb-type-faq': kb.type === 'faq',
|
||||
@@ -150,7 +185,8 @@
|
||||
}"
|
||||
:ref="el => { if (highlightedKbId !== null && highlightedKbId === kb.id && el) highlightedCardRef = el as HTMLElement }"
|
||||
@click="handleCardClick(kb)">
|
||||
<!-- 收藏按钮:右上角浮动 -->
|
||||
<!-- 收藏按钮:右上角浮动;通过 .card-header 的 padding-right
|
||||
给「更多」按钮腾出空间,避免两个按钮叠在一起。 -->
|
||||
<button type="button" class="kb-favorite-star" :class="{ 'is-favorited': isKbFavorited(kb.id) }"
|
||||
@click.stop="toggleFavoriteKb(kb.id, $event)">
|
||||
<t-icon :name="isKbFavorited(kb.id) ? 'star-filled' : 'star'" size="14px" />
|
||||
@@ -243,11 +279,10 @@
|
||||
</div>
|
||||
|
||||
<!-- 共享知识库卡片 -->
|
||||
<div v-else class="kb-card shared-kb-card" :class="{
|
||||
<div v-else v-show="!isKbSectionCollapsed(kbSectionOf(kb))" class="kb-card shared-kb-card" :class="{
|
||||
'kb-type-document': (kb.type || 'document') === 'document',
|
||||
'kb-type-faq': kb.type === 'faq'
|
||||
}" @click="handleSharedKbClickFromAll(kb)">
|
||||
<!-- 收藏按钮 -->
|
||||
<button type="button" class="kb-favorite-star" :class="{ 'is-favorited': isKbFavorited(kb.id) }"
|
||||
@click.stop="toggleFavoriteKb(kb.id, $event)">
|
||||
<t-icon :name="isKbFavorited(kb.id) ? 'star-filled' : 'star'" size="14px" />
|
||||
@@ -322,29 +357,50 @@
|
||||
|
||||
<div v-if="spaceSelection === 'mine' && sortedMineKbs.length > 0" class="kb-card-wrap">
|
||||
<!-- 置顶分组标题 -->
|
||||
<div v-if="sortedMineKbs[0] && sortedMineKbs[0].is_pinned" class="kb-section-header kb-section-header-pinned">
|
||||
<div v-if="sortedMineKbs[0] && sortedMineKbs[0].is_pinned" class="kb-section-header kb-section-header-pinned"
|
||||
role="button" tabindex="0" @click="toggleKbSection('pinned')"
|
||||
@keydown.enter.prevent="toggleKbSection('pinned')"
|
||||
@keydown.space.prevent="toggleKbSection('pinned')">
|
||||
<t-icon name="pin-filled" size="14px" />
|
||||
<span>{{ $t('knowledgeList.sections.pinned') }}</span>
|
||||
<t-icon class="kb-section-toggle" :name="isKbSectionCollapsed('pinned') ? 'chevron-right' : 'chevron-down'"
|
||||
size="14px" />
|
||||
</div>
|
||||
<!-- 我的知识库 -->
|
||||
<!-- 我的知识库。「已置顶」由顶部 header 接管;其余各分段各打各的
|
||||
标题——见「全部」tab 同处注释。 -->
|
||||
<template v-for="(kb, index) in sortedMineKbs" :key="kb.id">
|
||||
<!-- 「其他」(置顶→非置顶):admin/owner/viewer 保留原行为;
|
||||
contributor 收紧到同一创建者子段内部,跨创建者边界让位给
|
||||
「本空间 · 仅查看」标题。 -->
|
||||
<div v-if="index > 0
|
||||
&& sortedMineKbs[index - 1].is_pinned
|
||||
<!-- 我创建的:第一张非置顶的我创建卡片前打标题,无论上方是否
|
||||
有「已置顶」段都要显示,和「本空间 · 仅查看」对齐——见
|
||||
「全部」tab 同处注释。 -->
|
||||
<div v-if="showShareGroupHeaders
|
||||
&& isMyKb(kb)
|
||||
&& !kb.is_pinned
|
||||
&& (!showShareGroupHeaders
|
||||
|| isMyKb(sortedMineKbs[index - 1]) === isMyKb(kb))" class="kb-section-header">
|
||||
<span>{{ $t('knowledgeList.sections.others') }}</span>
|
||||
&& (index === 0 || sortedMineKbs[index - 1].is_pinned)" class="kb-section-header" role="button"
|
||||
tabindex="0" @click="toggleKbSection('mine')"
|
||||
@keydown.enter.prevent="toggleKbSection('mine')"
|
||||
@keydown.space.prevent="toggleKbSection('mine')">
|
||||
<t-icon name="user" size="14px" />
|
||||
<span>{{ $t('knowledgeList.sections.mine') }}</span>
|
||||
<t-icon class="kb-section-toggle" :name="isKbSectionCollapsed('mine') ? 'chevron-right' : 'chevron-down'"
|
||||
size="14px" />
|
||||
</div>
|
||||
<!-- 本空间 · 仅查看:从「我创建」首次过渡到「同事创建」 -->
|
||||
<!-- 本空间 · 仅查看:当前非置顶的同事 KB,且前一张要么不存在、
|
||||
要么是我创建、要么是置顶卡片(置顶→非置顶过渡)。 -->
|
||||
<div v-if="showShareGroupHeaders
|
||||
&& !isMyKb(kb)
|
||||
&& (index === 0 || isMyKb(sortedMineKbs[index - 1]))" class="kb-section-header">
|
||||
<span>{{ $t('knowledgeList.sections.tenantReadonly') }}</span>
|
||||
&& !kb.is_pinned
|
||||
&& (index === 0
|
||||
|| isMyKb(sortedMineKbs[index - 1])
|
||||
|| sortedMineKbs[index - 1].is_pinned)" class="kb-section-header" role="button" tabindex="0"
|
||||
@click="toggleKbSection('tenantOthers')"
|
||||
@keydown.enter.prevent="toggleKbSection('tenantOthers')"
|
||||
@keydown.space.prevent="toggleKbSection('tenantOthers')">
|
||||
<t-icon :name="tenantSectionIconName" size="14px" />
|
||||
<span>{{ $t(tenantSectionLabelKey) }}</span>
|
||||
<t-icon class="kb-section-toggle"
|
||||
:name="isKbSectionCollapsed('tenantOthers') ? 'chevron-right' : 'chevron-down'" size="14px" />
|
||||
</div>
|
||||
<div class="kb-card" :class="{
|
||||
<div v-show="!isKbSectionCollapsed(kbSectionOf(kb))" class="kb-card" :class="{
|
||||
'uninitialized': !isInitialized(kb),
|
||||
'kb-type-document': (kb.type || 'document') === 'document',
|
||||
'kb-type-faq': kb.type === 'faq',
|
||||
@@ -352,7 +408,6 @@
|
||||
}"
|
||||
:ref="el => { if (highlightedKbId !== null && highlightedKbId === kb.id && el) highlightedCardRef = el as HTMLElement }"
|
||||
@click="handleCardClick(kb)">
|
||||
<!-- 收藏按钮 -->
|
||||
<button type="button" class="kb-favorite-star" :class="{ 'is-favorited': isKbFavorited(kb.id) }"
|
||||
@click.stop="toggleFavoriteKb(kb.id, $event)">
|
||||
<t-icon :name="isKbFavorited(kb.id) ? 'star-filled' : 'star'" size="14px" />
|
||||
@@ -461,6 +516,7 @@
|
||||
&& !shared.is_mine
|
||||
&& isSharedKbEditable(shared.permission)
|
||||
&& (index === 0 || sortedSpaceKbsList[index - 1].is_mine)" class="kb-section-header">
|
||||
<t-icon name="share" size="14px" />
|
||||
<span>{{ $t('knowledgeList.sections.sharedEditable') }}</span>
|
||||
</div>
|
||||
<!-- 共享给我 · 仅查看:从「可编辑共享 / 我的」首次进入「viewer」 -->
|
||||
@@ -470,6 +526,7 @@
|
||||
&& (index === 0
|
||||
|| sortedSpaceKbsList[index - 1].is_mine
|
||||
|| isSharedKbEditable(sortedSpaceKbsList[index - 1].permission))" class="kb-section-header">
|
||||
<t-icon name="share" size="14px" />
|
||||
<span>{{ $t('knowledgeList.sections.sharedReadonly') }}</span>
|
||||
</div>
|
||||
<div class="kb-card shared-kb-card" :class="{
|
||||
@@ -806,14 +863,33 @@ const spaceKbsLoading = ref(false)
|
||||
// 「工作空间」视图下的稳定排序:本租户内「我创建」在前、「同事创建」在后;
|
||||
// 子段内保留服务端的置顶优先顺序。给 contributor 视图把「本空间 · 仅查看」
|
||||
// 分组标题正好插在过渡处;其他角色看不到标题,纯排序变化也无害。
|
||||
const sortedMineKbs = computed(() => {
|
||||
const own: KB[] = []
|
||||
const teammate: KB[] = []
|
||||
kbs.value.forEach(kb => {
|
||||
if (isMyKb(kb)) own.push(kb)
|
||||
else teammate.push(kb)
|
||||
// Ordering for the 「本空间」 tab:
|
||||
// 1. pinned KBs (mine or teammate), newest pin first
|
||||
// 2. my non-pinned KBs
|
||||
// 3. teammate non-pinned KBs (rendered under the「本空间 · 仅查看」header)
|
||||
//
|
||||
// Pin is per-user as of migration 000050, so a teammate-created KB that
|
||||
// the caller has personally pinned must float into the pinned section
|
||||
// even though it would otherwise live in the teammate sub-group. The
|
||||
// previous version only bucketed by isMyKb and silently demoted these
|
||||
// pinned-but-teammate KBs.
|
||||
const sortedMineKbs = computed<KB[]>(() => {
|
||||
return [...kbs.value].sort((a, b) => {
|
||||
const ap = a.is_pinned ? 0 : 1
|
||||
const bp = b.is_pinned ? 0 : 1
|
||||
if (ap !== bp) return ap - bp
|
||||
if (a.is_pinned && b.is_pinned) {
|
||||
const at = a.pinned_at ? Date.parse(a.pinned_at as string) : 0
|
||||
const bt = b.pinned_at ? Date.parse(b.pinned_at as string) : 0
|
||||
if (at !== bt) return bt - at
|
||||
}
|
||||
const am = isMyKb(a) ? 0 : 1
|
||||
const bm = isMyKb(b) ? 0 : 1
|
||||
if (am !== bm) return am - bm
|
||||
const ac = a.created_at ? Date.parse(a.created_at as string) : 0
|
||||
const bc = b.created_at ? Date.parse(b.created_at as string) : 0
|
||||
return bc - ac
|
||||
})
|
||||
return [...own, ...teammate]
|
||||
})
|
||||
|
||||
// 空间视角下的稳定排序:我创建的(is_mine)放在前面,剩下的共享部分再按
|
||||
@@ -933,9 +1009,62 @@ function isSharedKbEditable(perm: string | undefined): boolean {
|
||||
// 是否在共享区展示「可编辑 / 仅查看」二级分组:仅对中间档(contributor / editor)
|
||||
// 有意义。viewer 反正都是只读,admin / owner 视角统一管理,分组反而碎。
|
||||
// 这里只是 UI 呈现,权限由后端兜底,不要把它当成安全边界。
|
||||
const showShareGroupHeaders = computed(() => {
|
||||
return authStore.hasRole('contributor') && !authStore.hasRole('admin')
|
||||
})
|
||||
// 分组标题对所有角色生效——置顶 / 我创建的 / 本空间 · 仅查看 / 共享给我
|
||||
// 都是基于"创建者 + 来源"的客观信息,不依赖当前用户的可写权限。
|
||||
// 原本只对 contributor 显示是为了在 admin/owner 那里隐藏"仅查看"这个权限
|
||||
// 暗示——但实际上 admin/owner 也会想区分自己创建 vs 同事创建的卡片,所以
|
||||
// 现在统一打开。如果哪天需要把权限色彩从标题里拿掉,就改 i18n 文案即可,
|
||||
// 不需要再回头碰这个 computed。
|
||||
const showShareGroupHeaders = computed(() => true)
|
||||
|
||||
// 同租户、非当前用户创建的 KB 分组标题。
|
||||
// contributor / viewer 在本租户里对这些 KB 没有写权限,所以打"仅查看";
|
||||
// admin / owner 反而对整个租户都有编辑权限,"仅查看"会反复误导他们以为
|
||||
// 自己改不了——这一段实际上是"工作空间里其他成员创建的 KB",按所有权
|
||||
// 而非权限来标注更准确。
|
||||
const tenantSectionLabelKey = computed(() =>
|
||||
authStore.hasRole('admin')
|
||||
? 'knowledgeList.sections.tenantOthers'
|
||||
: 'knowledgeList.sections.tenantReadonly'
|
||||
)
|
||||
|
||||
// 图标和上面的文案对齐:admin/owner 看到的是"本空间 · 其他成员",按所有权
|
||||
// 划分,配 usergroup(多人)更贴;contributor/viewer 看到的是"仅查看",
|
||||
// 维持 browse(眼睛)传达"只能看不能改"的语义。
|
||||
const tenantSectionIconName = computed(() =>
|
||||
authStore.hasRole('admin') ? 'usergroup' : 'browse'
|
||||
)
|
||||
|
||||
// 分组折叠:ephemeral,只在当前会话里生效,不落 localStorage/服务器。
|
||||
// 之所以走"折叠集合"而不是"展开集合",是因为默认全展开——空 Set
|
||||
// 即表示初始的全展开状态,避免每次新加分段还得回头维护默认值。
|
||||
type KbSectionKey = 'pinned' | 'mine' | 'tenantOthers' | 'sharedEditable' | 'sharedReadonly'
|
||||
const collapsedKbSections = ref<Set<KbSectionKey>>(new Set())
|
||||
const isKbSectionCollapsed = (key: KbSectionKey) => collapsedKbSections.value.has(key)
|
||||
const toggleKbSection = (key: KbSectionKey) => {
|
||||
// 重新赋一个新的 Set 是为了让 ref 的 .value 身份变化触发模板重渲染;
|
||||
// 直接 .add/.delete 在 Vue 3 的 reactive Set 里也能 work,但 ref(Set) 的
|
||||
// 内层代理行为在不同版本上略有差异,整体替换最稳。
|
||||
const next = new Set(collapsedKbSections.value)
|
||||
if (next.has(key)) next.delete(key)
|
||||
else next.add(key)
|
||||
collapsedKbSections.value = next
|
||||
}
|
||||
// 判断一条 KB 应该归在哪个分组——和模板里几处 v-if 用的是同一套判定,
|
||||
// 抽出来是为了 v-show 卡片时复用,避免把 5 个分组的 v-if 重新拼一遍。
|
||||
//
|
||||
// 输入有两种形态:
|
||||
// 1. filteredKnowledgeBases 的元素,会显式带 `isMine` 标志(见
|
||||
// filteredKnowledgeBases 里的 spread;跨租户 shared 拆给 isMine=false)。
|
||||
// 2. sortedMineKbs 的元素就是原始 KB,无 isMine、也无 permission 字段。
|
||||
// 跨租户共享条目一定带 `permission`,本租户条目永远没有,所以"无 permission"
|
||||
// 是本租户的安全标识。综合:先看 isMine,再回退到 permission 是否存在。
|
||||
const kbSectionOf = (kb: any): KbSectionKey => {
|
||||
if (kb?.is_pinned) return 'pinned'
|
||||
const isOwnTenant = kb?.isMine === true || (kb?.isMine !== false && kb?.permission == null)
|
||||
if (isOwnTenant) return isMyKb(kb) ? 'mine' : 'tenantOthers'
|
||||
return isSharedKbEditable(kb?.permission) ? 'sharedEditable' : 'sharedReadonly'
|
||||
}
|
||||
|
||||
// Filtered knowledge bases: 全部 = 我的 + 全部共享;我的 = 仅我的
|
||||
//
|
||||
@@ -957,15 +1086,24 @@ const filteredKnowledgeBases = computed(() => {
|
||||
return []
|
||||
}
|
||||
const result: Array<(KB & { isMine: true }) | (SharedKnowledgeBase['knowledge_base'] & { isMine: false; permission: string; shared_at: string; share_id: string } & any)> = []
|
||||
// 本租户的 KB 拆成「我创建」与「同事创建」两段,让 contributor 视图能在
|
||||
// 二者之间插入「本空间 · 仅查看」分组标题。子段内部仍按 server 返回的
|
||||
// 顺序(置顶在前),所以 pinned/others 那条 mine→mine 的次级分组依然成立。
|
||||
// 本租户的 KB 分三段渲染:①任何人创建但被当前用户置顶的→「已置顶」组;
|
||||
// ②我创建的非置顶;③同事创建的非置顶(contributor 视图下挂在「本空间 ·
|
||||
// 仅查看」标题下)。置顶现在是 per-user 维度,必须跨创建者优先级地上浮,
|
||||
// 否则同事创建但我置顶的 KB 会被错误地沉到底部。
|
||||
const pinned: KB[] = []
|
||||
const ownMine: KB[] = []
|
||||
const teammateMine: KB[] = []
|
||||
kbs.value.forEach(kb => {
|
||||
if (isMyKb(kb)) ownMine.push(kb)
|
||||
if (kb.is_pinned) pinned.push(kb)
|
||||
else if (isMyKb(kb)) ownMine.push(kb)
|
||||
else teammateMine.push(kb)
|
||||
})
|
||||
pinned.sort((a, b) => {
|
||||
const at = a.pinned_at ? Date.parse(a.pinned_at as string) : 0
|
||||
const bt = b.pinned_at ? Date.parse(b.pinned_at as string) : 0
|
||||
return bt - at
|
||||
})
|
||||
pinned.forEach(kb => result.push({ ...kb, isMine: true as const }))
|
||||
ownMine.forEach(kb => result.push({ ...kb, isMine: true as const }))
|
||||
teammateMine.forEach(kb => result.push({ ...kb, isMine: true as const }))
|
||||
// 共享区按 permission 排序:可编辑(admin/editor)在前,仅查看(viewer)在后。
|
||||
@@ -1594,7 +1732,9 @@ const handleUploadFinishedEvent = (event: Event) => {
|
||||
min-width: 0;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding: 8px 0;
|
||||
// 顶部不留 padding,sticky 的分组标题 (top: 0) 才能贴到容器最顶;
|
||||
// 底部 padding 保留,避免最后一行卡片紧贴边。
|
||||
padding: 0 0 8px;
|
||||
}
|
||||
|
||||
.kb-list-main-loading {
|
||||
@@ -1934,7 +2074,7 @@ const handleUploadFinishedEvent = (event: Event) => {
|
||||
|
||||
.kb-card-wrap {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
gap: 10px;
|
||||
grid-template-columns: 1fr;
|
||||
animation: contentFadeIn 0.32s ease-out;
|
||||
}
|
||||
@@ -1944,25 +2084,59 @@ const handleUploadFinishedEvent = (event: Event) => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 2px 0 2px;
|
||||
// 下滑时吸顶到滚动容器(.kb-list-main)顶部。z-index 要高于卡片自身的
|
||||
// hover 阴影 / 装饰层;背景必须不透明,否则卡片会从下方透出来。
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 5;
|
||||
background: var(--td-bg-color-container);
|
||||
// 用 box-shadow 把背景再往上"延伸"8px,封掉 sticky 与容器顶之间任何
|
||||
// subpixel 残缝(border-radius 的圆角三角、滚动时浏览器子像素渲染等
|
||||
// 都会让卡片从这里漏出 1-2px)。第二条 shadow 在下方也再补一点,避免
|
||||
// grid-gap 区域里卡片穿插过来。
|
||||
box-shadow: 0 -8px 0 0 var(--td-bg-color-container),
|
||||
0 4px 0 0 var(--td-bg-color-container);
|
||||
padding: 6px 4px 6px 0;
|
||||
color: var(--td-text-color-secondary);
|
||||
font-family: var(--app-font-family);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 20px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
outline: none;
|
||||
|
||||
.t-icon {
|
||||
color: var(--td-brand-color);
|
||||
&:hover {
|
||||
color: var(--td-text-color-primary);
|
||||
}
|
||||
|
||||
&.kb-section-header-pinned {
|
||||
color: var(--td-brand-color);
|
||||
&:focus-visible {
|
||||
box-shadow: 0 0 0 2px var(--td-brand-color-focus, rgba(0, 82, 217, 0.2));
|
||||
}
|
||||
|
||||
// Icons inherit the section header's text color so the whole row
|
||||
// (icon + label) reads as one muted secondary tone. The pinned
|
||||
// modifier no longer overrides this either — uniform appearance
|
||||
// is intentional; the icon shape alone is enough to flag which
|
||||
// section the user is looking at.
|
||||
.t-icon {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.kb-section-toggle {
|
||||
margin-left: 4px;
|
||||
opacity: 0.7;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
&:hover .kb-section-toggle {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.kb-card {
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
border-radius: 12px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
||||
@@ -1970,11 +2144,11 @@ const handleUploadFinishedEvent = (event: Event) => {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
transition: all 0.25s ease;
|
||||
padding: 14px 16px;
|
||||
padding: 10px 14px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 148px;
|
||||
min-height: 148px;
|
||||
height: 128px;
|
||||
min-height: 128px;
|
||||
|
||||
&.kb-card-skeleton {
|
||||
cursor: default;
|
||||
@@ -2051,10 +2225,12 @@ const handleUploadFinishedEvent = (event: Event) => {
|
||||
}
|
||||
|
||||
.kb-favorite-star {
|
||||
// 浮在卡片右上角顶角。卡片自身有 padding,"更多"按钮在 header flex 末端
|
||||
// 自然落在 padding 内部,与零位的 star 错开一段距离。
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 6px;
|
||||
z-index: 2;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 3;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
@@ -2093,7 +2269,7 @@ const handleUploadFinishedEvent = (event: Event) => {
|
||||
}
|
||||
|
||||
.card-header {
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
@@ -2102,7 +2278,7 @@ const handleUploadFinishedEvent = (event: Event) => {
|
||||
}
|
||||
|
||||
.card-content {
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.card-description {
|
||||
@@ -2134,7 +2310,8 @@ const handleUploadFinishedEvent = (event: Event) => {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
gap: 4px;
|
||||
margin-bottom: 4px;
|
||||
|
||||
.card-title {
|
||||
flex: 1;
|
||||
@@ -2494,6 +2671,18 @@ const handleUploadFinishedEvent = (event: Event) => {
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1900px) {
|
||||
.kb-card-wrap {
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 2200px) {
|
||||
.kb-card-wrap {
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除确认对话框样式
|
||||
:deep(.del-knowledge-dialog) {
|
||||
padding: 0px !important;
|
||||
|
||||
@@ -1412,7 +1412,7 @@ onUnmounted(() => {
|
||||
|
||||
.org-card-wrap {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
gap: 10px;
|
||||
grid-template-columns: 1fr;
|
||||
animation: contentFadeIn 0.32s ease-out;
|
||||
}
|
||||
@@ -1421,14 +1421,14 @@ onUnmounted(() => {
|
||||
cursor: default;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 148px;
|
||||
min-height: 148px;
|
||||
height: 128px;
|
||||
min-height: 128px;
|
||||
}
|
||||
|
||||
/* 与知识库 / 智能体列表统一:紧凑 + 1px 描边 */
|
||||
.org-card {
|
||||
border: 1px solid var(--td-component-stroke);
|
||||
border-radius: 12px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
||||
@@ -1436,11 +1436,11 @@ onUnmounted(() => {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
|
||||
padding: 14px 16px;
|
||||
padding: 10px 14px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 148px;
|
||||
min-height: 148px;
|
||||
height: 128px;
|
||||
min-height: 128px;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
@@ -1477,7 +1477,7 @@ onUnmounted(() => {
|
||||
.card-header {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
@@ -1488,7 +1488,7 @@ onUnmounted(() => {
|
||||
.card-content {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.card-bottom {
|
||||
@@ -1860,6 +1860,18 @@ onUnmounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1900px) {
|
||||
.org-card-wrap {
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 2200px) {
|
||||
.org-card-wrap {
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除/离开确认对话框样式
|
||||
:deep(.del-org-dialog) {
|
||||
padding: 0px !important;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
-- Rollback for 000051_custom_agents_creator_backfill.
|
||||
--
|
||||
-- We deliberately don't try to revert the per-row updates: there is no
|
||||
-- way to distinguish a row whose `created_by` was just set by 000051
|
||||
-- from a row that legitimately had the same tenant-owner as creator
|
||||
-- before the migration ran. Rolling back the column data would risk
|
||||
-- erasing genuine creator attributions, which is strictly worse than
|
||||
-- leaving the backfilled values in place.
|
||||
--
|
||||
-- The forward migration is therefore treated as one-way; this file
|
||||
-- exists only to satisfy golang-migrate's up/down pairing requirement.
|
||||
DO $$ BEGIN RAISE NOTICE '[Migration 000051] No-op rollback (backfill is one-way)'; END $$;
|
||||
@@ -0,0 +1,48 @@
|
||||
-- Migration: 000051_custom_agents_creator_backfill
|
||||
-- Backfill custom_agents.created_by for legacy non-builtin rows.
|
||||
--
|
||||
-- Background:
|
||||
-- * `custom_agents.created_by` was introduced together with the table in
|
||||
-- 000006 but the seed INSERT statements for the two built-in agents
|
||||
-- (builtin-quick-answer / builtin-smart-reasoning) intentionally omit
|
||||
-- this column — built-ins are tenant-shared system rows, so they
|
||||
-- legitimately carry NULL / empty creator_id. `AgentCreatorLookup`
|
||||
-- short-circuits on IsBuiltin=true and treats this as expected.
|
||||
-- * The RBAC migration 000043 backfilled `knowledge_bases.creator_id`
|
||||
-- to the tenant owner so Contributors keep "owner" access to legacy
|
||||
-- KBs they actually created, but it forgot the symmetrical update on
|
||||
-- `custom_agents`. As a result any non-builtin agent created before
|
||||
-- the per-row creator tracking landed (or written by tooling that
|
||||
-- skipped UserIDFromContext) has empty `created_by` and falls into
|
||||
-- the "tenant-owned, Admin+ only" bucket — the historical creator
|
||||
-- can no longer self-edit, and the `?creator=mine|others` list
|
||||
-- filter silently drops the row.
|
||||
--
|
||||
-- This migration applies the same owner-of-tenant fallback as
|
||||
-- knowledge_bases, scoped strictly to non-builtin rows so the
|
||||
-- intentional empty creator on built-in agents is preserved.
|
||||
DO $$ BEGIN RAISE NOTICE '[Migration 000051] Backfilling custom_agents.created_by'; END $$;
|
||||
|
||||
UPDATE custom_agents ca
|
||||
SET created_by = (
|
||||
SELECT tm.user_id
|
||||
FROM tenant_members tm
|
||||
WHERE tm.tenant_id = ca.tenant_id
|
||||
AND tm.role = 'owner'
|
||||
AND tm.status = 'active'
|
||||
AND tm.deleted_at IS NULL
|
||||
ORDER BY tm.joined_at ASC, tm.id ASC
|
||||
LIMIT 1
|
||||
)
|
||||
WHERE ca.is_builtin = FALSE
|
||||
AND (ca.created_by IS NULL OR ca.created_by = '')
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM tenant_members tm
|
||||
WHERE tm.tenant_id = ca.tenant_id
|
||||
AND tm.role = 'owner'
|
||||
AND tm.status = 'active'
|
||||
AND tm.deleted_at IS NULL
|
||||
);
|
||||
|
||||
DO $$ BEGIN RAISE NOTICE '[Migration 000051] custom_agents.created_by backfill complete'; END $$;
|
||||
Reference in New Issue
Block a user