@@ -73,6 +109,8 @@ import {
CopyOutlined,
LikeOutlined,
DislikeOutlined,
+ DeploymentUnitOutlined,
+ BulbOutlined,
FileOutlined,
ClockCircleOutlined
} from '@ant-design/icons-vue'
@@ -143,6 +181,20 @@ const closeSubGraph = () => {
subGraphVisible.value = false
}
+// 添加网页搜索结果相关变量
+const webResultVisible = ref(false)
+const webResults = ref(null)
+
+// 添加显示网页搜索结果的方法
+const showWebResult = (msg) => {
+ if (msg.refs?.web_search) {
+ webResults.value = msg.refs?.web_search.results
+ webResultVisible.value = true
+ } else {
+ console.error('无法获取网页搜索结果')
+ }
+}
+
const hasSubGraphData = (msg) => {
return msg.refs &&
msg.refs.graph_base &&
@@ -165,15 +217,15 @@ const getPercent = (value) => {
display: flex;
margin-bottom: 20px;
color: var(--gray-500);
- font-size: 14px;
+ font-size: 13px;
gap: 10px;
.item {
background: var(--gray-100);
- color: var(--gray-800);
+ color: var(--gray-700);
padding: 2px 8px;
border-radius: 8px;
- font-size: 14px;
+ font-size: 13px;
user-select: none;
&.btn {
@@ -275,4 +327,76 @@ const getPercent = (value) => {
margin-bottom: 12px;
}
}
+
+.web-result-detail {
+ .results-list {
+ .result-item {
+ border-bottom: 1px solid #f0f0f0;
+ padding: 16px 0;
+
+ &:last-child {
+ border-bottom: none;
+ }
+ }
+
+ .result-meta {
+ margin-bottom: 12px;
+
+ .score-info {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 2rem;
+ margin-bottom: 8px;
+
+ span {
+ display: flex;
+ align-items: center;
+
+ strong {
+ margin-right: 8px;
+ white-space: nowrap;
+ color: #666;
+ }
+
+ .ant-progress {
+ width: 170px;
+ margin-bottom: 0;
+ margin-inline: 10px;
+
+ .ant-progress-bg {
+ background-color: #666;
+ }
+ }
+ }
+ }
+
+ .result-url {
+ font-size: 12px;
+ color: #1677FF;
+ margin-bottom: 8px;
+ word-break: break-all;
+ }
+ }
+
+ .result-content {
+ .result-title {
+ font-size: 16px;
+ font-weight: bold;
+ margin-bottom: 8px;
+ color: #333;
+ }
+
+ .result-text {
+ font-size: 14px;
+ line-height: 1.6;
+ white-space: pre-wrap;
+ word-break: break-word;
+ background-color: #f9f9f9;
+ padding: 12px;
+ border-radius: 4px;
+ border: 1px solid #e8e8e8;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/web/src/components/TableConfigComponent.vue b/web/src/components/TableConfigComponent.vue
index 7b372d4c..a08f4bd2 100644
--- a/web/src/components/TableConfigComponent.vue
+++ b/web/src/components/TableConfigComponent.vue
@@ -43,7 +43,7 @@
@@ -91,12 +91,14 @@ props.config && Object.entries(props.config).forEach(([key, value]) => {
// 控制模态框显示
const addConfigModalVisible = ref(false);
+const isAdding = ref(false); // 添加新的ref变量
// 新增配置项数据
const newConfig = ref({ key: '', value: '' });
// 添加配置
const addConfig = () => {
+ isAdding.value = true; // 设置添加状态
addConfigModalVisible.value = true;
};
@@ -113,6 +115,7 @@ const confirmAddConfig = () => {
configList.push({ key: newConfig.value.key, value: newConfig.value.value });
addConfigModalVisible.value = false;
newConfig.value = { key: '', value: '' };
+ isAdding.value = false; // 重置添加状态
};
// 删除配置
@@ -137,6 +140,13 @@ const configObject = computed(() => {
watch(configObject, (newValue) => {
emit('update:config', newValue);
}, { deep: true });
+
+// 监听模态框关闭
+watch(addConfigModalVisible, (newValue) => {
+ if (!newValue) {
+ isAdding.value = false; // 当模态框关闭时重置添加状态
+ }
+});
+
\ No newline at end of file
diff --git a/web/src/router/index.js b/web/src/router/index.js
index 613c1406..35574dd3 100644
--- a/web/src/router/index.js
+++ b/web/src/router/index.js
@@ -7,7 +7,7 @@ const router = createRouter({
routes: [
{
path: '/',
- name: 'home',
+ name: 'main',
component: BlankLayout,
children: [ {
path: '',
@@ -24,7 +24,7 @@ const router = createRouter({
children: [
{
path: '',
- name: 'Chat',
+ name: 'ChatComp',
component: () => import('../views/ChatView.vue'),
meta: { keepAlive: true }
}
@@ -37,7 +37,7 @@ const router = createRouter({
children: [
{
path: '',
- name: 'Graph',
+ name: 'GraphComp',
component: () => import('../views/GraphView.vue'),
meta: { keepAlive: false }
}
@@ -50,13 +50,13 @@ const router = createRouter({
children: [
{
path: '',
- name: 'Database',
+ name: 'DatabaseComp',
component: () => import('../views/DataBaseView.vue'),
meta: { keepAlive: true }
},
{
path: ':database_id',
- name: 'databaseInfo',
+ name: 'DatabaseInfoComp',
component: () => import('../views/DataBaseInfoView.vue'),
meta: { keepAlive: false }
}
@@ -69,7 +69,7 @@ const router = createRouter({
children: [
{
path: '',
- name: 'Setting',
+ name: 'SettingComp',
component: () => import('../views/SettingView.vue'),
meta: { keepAlive: true }
}
@@ -82,7 +82,7 @@ const router = createRouter({
children: [
{
path: '',
- name: 'ToolsView',
+ name: 'ToolsComp',
component: () => import('../views/ToolsView.vue'),
meta: { keepAlive: true }
},
diff --git a/web/src/views/ChatView.vue b/web/src/views/ChatView.vue
index fc982936..55b09876 100644
--- a/web/src/views/ChatView.vue
+++ b/web/src/views/ChatView.vue
@@ -41,9 +41,16 @@ const convs = reactive(JSON.parse(localStorage.getItem('chat-convs')) || [
])
const state = reactive({
- isSidebarOpen: true,
+ isSidebarOpen: JSON.parse(localStorage.getItem('chat-sidebar-open') || 'true'),
})
+// Watch isSidebarOpen and save to localStorage
+watch(
+ () => state.isSidebarOpen,
+ (newValue) => {
+ localStorage.setItem('chat-sidebar-open', JSON.stringify(newValue))
+ }
+)
const curConvId = ref(0)
const generateRandomHash = (length) => {
diff --git a/web/src/views/GraphView.vue b/web/src/views/GraphView.vue
index 861acf99..40b50e95 100644
--- a/web/src/views/GraphView.vue
+++ b/web/src/views/GraphView.vue
@@ -3,7 +3,7 @@
- 前往 设置 页面配置图数据库。
+ 前往 设置 页面启用知识图谱。
@@ -11,7 +11,7 @@
-
+
state.showModal = false"
ok-text="添加到图数据库" cancel-text="取消"
:confirm-loading="state.precessing">
+
+
当前图数据库向量模型:{{ graphInfo?.embed_model_name }}
+
当前所选择的向量模型是 {{ configStore.config.embed_model }}
+
+ 第一次创建之后将无法修改向量模型,当前向量模型 {{ configStore.config.embed_model }}
{
.then((res) => {
if (res.ok) {
return res.json();
+ } else if (!configStore.config.enable_knowledge_graph) {
+ throw new Error('请前往设置页面配置启用知识图谱')
} else {
throw new Error("加载失败");
}
@@ -181,7 +188,7 @@ const loadSampleNodes = () => {
graphData.nodes = data.result.nodes
graphData.edges = data.result.edges
console.log(graphData)
- randerGraph()
+ setTimeout(() => randerGraph(), 500)
})
.catch((error) => {
message.error(error.message);
@@ -195,12 +202,6 @@ const onSearch = () => {
return
}
- const cur_embed_model = configStore.config.embed_model
- if (cur_embed_model !== 'zhipu-embedding-3') {
- message.error('当前不支持实体检索,请在设置中选择向量模型为 zhipu-embedding-3')
- return
- }
-
state.searchLoading = true
fetch(`/api/data/graph/node?entity_name=${state.searchInput}`)
.then((res) => {
diff --git a/web/src/views/HomeView.vue b/web/src/views/HomeView.vue
index 8d3686b2..66f6c2bf 100644
--- a/web/src/views/HomeView.vue
+++ b/web/src/views/HomeView.vue
@@ -5,7 +5,7 @@
大模型驱动的知识库管理工具
-
+
diff --git a/web/src/views/SettingView.vue b/web/src/views/SettingView.vue
index a314595a..2942ab34 100644
--- a/web/src/views/SettingView.vue
+++ b/web/src/views/SettingView.vue
@@ -2,7 +2,7 @@