feat: remove sessions tab and related components from knowledge base detail view

This commit is contained in:
Soulter
2025-10-24 00:48:17 +08:00
parent 7e0a50fbf2
commit b0d3fc11f0
4 changed files with 0 additions and 218 deletions
@@ -56,26 +56,6 @@
"submit": "Upload",
"fileRequired": "Please select a file to upload"
},
"sessions": {
"title": "Session Configuration",
"subtitle": "Configure which sessions can use this knowledge base",
"empty": "No session configurations",
"add": "Add Configuration",
"scope": "Scope",
"scopeId": "Identifier",
"topK": "Top K Results",
"enableRerank": "Enable Rerank",
"actions": "Actions",
"edit": "Edit",
"delete": "Delete",
"scopeSession": "Session Level",
"scopePlatform": "Platform Level",
"deleteConfirm": "Are you sure you want to delete this configuration?",
"addSuccess": "Configuration added successfully",
"addFailed": "Failed to add configuration",
"deleteSuccess": "Configuration deleted successfully",
"deleteFailed": "Failed to delete configuration"
},
"settings": {
"title": "Knowledge Base Settings",
"basic": "Basic Settings",
@@ -57,22 +57,6 @@
"submit": "上传",
"fileRequired": "请选择要上传的文件"
},
"sessions": {
"title": "使用该知识库的会话",
"subtitle": "以下会话正在使用此知识库",
"empty": "暂无会话使用此知识库",
"refresh": "刷新",
"scope": "范围",
"scopeId": "会话标识",
"topK": "返回结果数",
"enableRerank": "启用重排序",
"actions": "操作",
"scopeSession": "会话级别",
"scopePlatform": "平台级别",
"viewInSessionManagement": "在会话管理中查看",
"goToSessionManagement": "前往会话管理",
"loadFailed": "加载会话列表失败"
},
"retrieval": {
"title": "知识库检索",
"subtitle": "使用稠密检索和稀疏检索测试知识库内容",
@@ -40,10 +40,6 @@
<v-icon start>mdi-magnify</v-icon>
{{ t('tabs.retrieval') }}
</v-tab>
<v-tab value="sessions">
<v-icon start>mdi-account-multiple</v-icon>
{{ t('tabs.sessions') }}
</v-tab>
<v-tab value="settings">
<v-icon start>mdi-cog</v-icon>
{{ t('tabs.settings') }}
@@ -166,11 +162,6 @@
<RetrievalTab :kb-id="kbId" :kb-name="kb.kb_name"/>
</v-window-item>
<!-- 使用会话 -->
<v-window-item value="sessions">
<SessionsTab :kb-id="kbId" />
</v-window-item>
<!-- 设置 -->
<v-window-item value="settings">
<SettingsTab :kb="kb" @updated="loadKB" />
@@ -192,7 +183,6 @@ import axios from 'axios'
import { useModuleI18n } from '@/i18n/composables'
import DocumentsTab from './components/DocumentsTab.vue'
import RetrievalTab from './components/RetrievalTab.vue'
import SessionsTab from './components/SessionsTab.vue'
import SettingsTab from './components/SettingsTab.vue'
const { tm: t } = useModuleI18n('features/knowledge-base/detail')
@@ -1,172 +0,0 @@
<template>
<div class="sessions-tab">
<v-card elevation="2">
<v-card-title class="d-flex align-center pa-4">
<span>{{ t('sessions.title') }}</span>
<v-spacer />
<v-btn
prepend-icon="mdi-refresh"
variant="tonal"
size="small"
@click="loadSessions"
:loading="loading"
>
{{ t('sessions.refresh') }}
</v-btn>
</v-card-title>
<v-card-subtitle class="px-4 pb-4">
{{ t('sessions.subtitle') }}
</v-card-subtitle>
<v-divider />
<v-card-text class="pa-0">
<v-data-table
:headers="headers"
:items="sessions"
:loading="loading"
>
<template #item.scope="{ item }">
<v-chip :color="item.scope === 'session' ? 'primary' : 'secondary'" size="small" variant="tonal">
{{ item.scope === 'session' ? t('sessions.scopeSession') : t('sessions.scopePlatform') }}
</v-chip>
</template>
<template #item.enable_rerank="{ item }">
<v-icon :color="item.enable_rerank ? 'success' : 'grey'">
{{ item.enable_rerank ? 'mdi-check-circle' : 'mdi-close-circle' }}
</v-icon>
</template>
<template #item.actions="{ item }">
<v-btn
icon="mdi-open-in-new"
variant="text"
size="small"
color="primary"
@click="goToSessionManagement(item)"
:title="t('sessions.viewInSessionManagement')"
/>
</template>
<template #no-data>
<div class="text-center py-8">
<v-icon size="64" color="grey-lighten-2">mdi-account-multiple-outline</v-icon>
<p class="mt-4 text-medium-emphasis">{{ t('sessions.empty') }}</p>
<v-btn
class="mt-4"
prepend-icon="mdi-cog"
variant="tonal"
color="primary"
@click="goToSessionManagement()"
>
{{ t('sessions.goToSessionManagement') }}
</v-btn>
</div>
</template>
</v-data-table>
</v-card-text>
</v-card>
<!-- 消息提示 -->
<v-snackbar v-model="snackbar.show" :color="snackbar.color">
{{ snackbar.text }}
</v-snackbar>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import axios from 'axios'
import { useModuleI18n } from '@/i18n/composables'
const { tm: t } = useModuleI18n('features/knowledge-base/detail')
const router = useRouter()
const props = defineProps<{
kbId: string
}>()
// 状态
const loading = ref(false)
const sessions = ref<any[]>([])
const snackbar = ref({
show: false,
text: '',
color: 'success'
})
const showSnackbar = (text: string, color: string = 'success') => {
snackbar.value.text = text
snackbar.value.color = color
snackbar.value.show = true
}
// 表格列
const headers = [
{ title: t('sessions.scope'), key: 'scope' },
{ title: t('sessions.scopeId'), key: 'scope_id' },
{ title: t('sessions.topK'), key: 'top_k' },
{ title: t('sessions.enableRerank'), key: 'enable_rerank' },
{ title: t('sessions.actions'), key: 'actions', sortable: false, align: 'end' }
]
// 加载使用该知识库的会话
const loadSessions = async () => {
loading.value = true
try {
const url = '/api/kb/session/config/list_by_kb'
const params = { kb_id: props.kbId }
const response = await axios.get(url, { params })
if (response.data.status === 'ok') {
sessions.value = response.data.data.sessions
} else {
console.error('[SessionsTab] API返回错误:', response.data.message)
showSnackbar(response.data.message || t('sessions.loadFailed'), 'error')
}
} catch (error) {
console.error('[SessionsTab] 请求失败:', error)
if (error.response) {
console.error('[SessionsTab] 错误响应状态:', error.response.status)
console.error('[SessionsTab] 错误响应数据:', error.response.data)
} else if (error.request) {
console.error('[SessionsTab] 请求未收到响应:', error.request)
} else {
console.error('[SessionsTab] 请求配置错误:', error.message)
}
showSnackbar(t('sessions.loadFailed'), 'error')
} finally {
loading.value = false
}
}
// 跳转到会话管理页面
const goToSessionManagement = (session?: any) => {
router.push({ name: 'SessionManagement' })
}
onMounted(() => {
loadSessions()
})
</script>
<style scoped>
.sessions-tab {
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
</style>