feat: 完成全量功能开发,包括前端管理后台与后端服务优化

此提交实现了完整的知识库管理系统:
1. 新增Vue3 + Antd Vue前端管理后台,包含登录、文档管理、检索、类目设置等完整页面
2. 重构后端LLM调用抽象层,支持Ollama与OpenAI兼容服务动态切换
3. 调整默认嵌入模型配置为本地bge-m3模式
4. 优化入库任务去重逻辑与缓存清理机制
5. 完善Docker镜像构建与docker-compose部署配置
6. 修复多项测试用例与兼容性问题
7. 新增运行时配置API,支持动态调整系统参数
This commit is contained in:
2026-07-31 12:05:25 +08:00
parent fdb664e546
commit 2ab8b56a01
52 changed files with 7030 additions and 171 deletions
+232
View File
@@ -0,0 +1,232 @@
<script setup>
import { computed, h, ref } from 'vue'
import { useRoute, useRouter, RouterView } from 'vue-router'
import { storeToRefs } from 'pinia'
import { Modal } from 'ant-design-vue'
import {
DashboardOutlined,
FileTextOutlined,
UploadOutlined,
SearchOutlined,
AppstoreOutlined,
SettingOutlined,
MenuFoldOutlined,
MenuUnfoldOutlined,
LogoutOutlined,
DatabaseOutlined
} from '@ant-design/icons-vue'
import { useAuthStore } from '@/stores/useAuthStore'
const route = useRoute()
const router = useRouter()
const authStore = useAuthStore()
const { user, displayName } = storeToRefs(authStore)
const collapsed = ref(false)
const selectedKeys = computed(() => {
return [route.name ? String(route.name) : '']
})
const openKeys = ref(['main'])
const menuItems = [
{ key: 'overview', icon: () => h(DashboardOutlined), label: '概览' },
{ key: 'documents', icon: () => h(FileTextOutlined), label: '文档管理' },
{ key: 'ingest', icon: () => h(UploadOutlined), label: '文档入库' },
{ key: 'search', icon: () => h(SearchOutlined), label: '检索测试台' },
{ key: 'categories', icon: () => h(AppstoreOutlined), label: '类目列表' },
{ key: 'settings', icon: () => h(SettingOutlined), label: '设置' }
]
function handleMenuClick({ key }) {
if (key && key !== route.name) {
router.push({ name: key })
}
}
function handleLogout() {
Modal.confirm({
title: '确认登出',
content: '确定要退出登录吗?',
okText: '登出',
cancelText: '取消',
onOk() {
authStore.logout()
router.replace({ name: 'login' })
}
})
}
</script>
<template>
<a-layout class="main-layout">
<a-layout-sider
v-model:collapsed="collapsed"
collapsible
:trigger="null"
breakpoint="lg"
class="main-layout__sider"
>
<div class="main-layout__logo">
<span class="main-layout__logo-icon">
<DatabaseOutlined />
</span>
<span v-if="!collapsed" class="main-layout__logo-text">QMDSearch</span>
</div>
<a-menu
theme="dark"
mode="inline"
:selected-keys="selectedKeys"
:open-keys="openKeys"
:items="menuItems"
@click="handleMenuClick"
/>
</a-layout-sider>
<a-layout>
<a-layout-header class="main-layout__header">
<a-button
type="text"
class="main-layout__collapse"
@click="collapsed = !collapsed"
>
<MenuUnfoldOutlined v-if="collapsed" />
<MenuFoldOutlined v-else />
</a-button>
<div class="main-layout__title">知识库管理后台</div>
<div class="main-layout__user">
<span class="main-layout__user-name">{{ displayName }}</span>
<a-divider type="vertical" />
<a-button
type="text"
size="small"
class="main-layout__logout"
@click="handleLogout"
>
<template #icon><LogoutOutlined /></template>
登出
</a-button>
</div>
</a-layout-header>
<a-layout-content class="main-layout__content">
<RouterView />
</a-layout-content>
<a-layout-footer class="main-layout__footer">
QMDSearch Admin · 当前用户{{ user?.username || '-' }}
</a-layout-footer>
</a-layout>
</a-layout>
</template>
<style scoped>
.main-layout {
min-height: 100vh;
}
.main-layout__sider {
position: sticky;
top: 0;
height: 100vh;
overflow: auto;
box-shadow: 2px 0 8px rgba(0, 21, 41, 0.15);
}
.main-layout__logo {
height: 52px;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
padding: 0 16px;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
background: linear-gradient(135deg, #001529 0%, #002140 100%);
}
.main-layout__logo-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border-radius: 6px;
background: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
color: #fff;
font-size: 16px;
box-shadow: 0 2px 6px rgba(22, 119, 255, 0.4);
}
.main-layout__logo-text {
color: #fff;
font-size: 17px;
font-weight: 700;
letter-spacing: 0.5px;
white-space: nowrap;
}
.main-layout__header {
display: flex;
align-items: center;
background: #fff;
padding: 0 20px;
height: 52px;
line-height: 52px;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
z-index: 10;
}
.main-layout__collapse {
flex: 0 0 auto;
font-size: 16px;
color: #4b5563;
}
.main-layout__collapse:hover {
color: #1677ff;
}
.main-layout__title {
flex: 1 1 auto;
margin-left: 12px;
font-size: 16px;
font-weight: 600;
color: #1f2937;
}
.main-layout__user {
flex: 0 0 auto;
display: flex;
align-items: center;
gap: 4px;
}
.main-layout__user-name {
color: #4b5563;
font-size: 13px;
}
.main-layout__logout {
color: #6b7280;
}
.main-layout__logout:hover {
color: #ff4d4f;
}
.main-layout__content {
margin: 16px;
padding: 0;
background: transparent;
overflow: auto;
}
.main-layout__footer {
text-align: center;
color: #6b7280;
font-size: 12px;
background: transparent;
padding: 12px 16px;
}
</style>