3030 <!-- <a-button type="default" @click="openLink('http://localhost:7474/')" :icon="h(GlobalOutlined)">
3131 Neo4j 浏览器
3232 </a-button> -->
33- <a-button type =" primary" @click =" state.showModal = true" ><UploadOutlined /> 上传文件</a-button >
33+ <a-button
34+ v-if =" isNeo4j"
35+ type =" primary"
36+ @click =" state.showModal = true" ><UploadOutlined /> 上传文件</a-button >
37+ <a-button
38+ v-else
39+ type =" primary"
40+ @click =" state.showUploadTipModal = true" ><UploadOutlined /> 上传文件</a-button >
3441 <a-button v-if =" unindexedCount > 0" type =" primary" @click =" indexNodes" :loading =" state.indexing" >
3542 <SyncOutlined v-if =" !state.indexing" /> 为{{ unindexedCount }}个节点添加索引
3643 </a-button >
7380 </a-input >
7481 </div >
7582 <div class =" actions-right" >
83+ <a-button type =" default" @click =" exportGraphData" :icon =" h(ExportOutlined)" >
84+ 导出数据
85+ </a-button >
7686 <a-button type =" default" @click =" state.showInfoModal = true" :icon =" h(InfoCircleOutlined)" >
7787 说明
7888 </a-button >
91101 :unindexed-count =" unindexedCount"
92102 :model-matched =" modelMatched"
93103 @index-nodes =" indexNodes"
94- @export-data =" exportGraphData"
95104 />
96105 <LightRAGInfoPanel
97106 v-else
98107 :stats =" state.lightragStats"
99108 :graph-data =" graph.graphData"
100109 :database-name =" getDatabaseName()"
101- @export-data =" exportGraphData"
102110 />
103111 </div >
104112 </template >
144152 </div >
145153 </a-modal >
146154
155+ <!-- 上传提示弹窗 -->
156+ <a-modal
157+ :open =" state.showUploadTipModal"
158+ title =" 文件上传说明"
159+ @cancel =" () => state.showUploadTipModal = false"
160+ :footer =" null"
161+ width =" 500px"
162+ >
163+ <div class =" upload-tip-content" >
164+ <a-alert
165+ :message =" getUploadTipMessage()"
166+ type =" info"
167+ show-icon
168+ style =" margin-bottom : 16px ;"
169+ />
170+ <div v-if =" !isNeo4j" class =" upload-tip-actions" >
171+ <p >如需上传文档到当前选中的知识库,请前往对应的知识库详情页面进行操作:</p >
172+ <div class =" action-buttons" >
173+ <a-button type =" primary" @click =" goToDatabasePage" >
174+ <DatabaseOutlined /> 前往知识库详情页
175+ </a-button >
176+ </div >
177+ </div >
178+ </div >
179+ </a-modal >
180+
147181 <!-- 说明弹窗 -->
148182 <a-modal
149183 :open =" state.showInfoModal"
176210
177211<script setup>
178212import { computed , onMounted , reactive , ref , h } from ' vue' ;
213+ import { useRouter } from ' vue-router' ;
179214import { message } from ' ant-design-vue' ;
180215import { useConfigStore } from ' @/stores/config' ;
181- import { UploadOutlined , SyncOutlined , GlobalOutlined , InfoCircleOutlined , SearchOutlined , ReloadOutlined , LoadingOutlined , HighlightOutlined } from ' @ant-design/icons-vue' ;
216+ import { UploadOutlined , SyncOutlined , GlobalOutlined , InfoCircleOutlined , SearchOutlined , ReloadOutlined , LoadingOutlined , HighlightOutlined , DatabaseOutlined , ExportOutlined } from ' @ant-design/icons-vue' ;
182217import HeaderComponent from ' @/components/HeaderComponent.vue' ;
183218import { neo4jApi , unifiedApi } from ' @/apis/graph_api' ;
184219import { useUserStore } from ' @/stores/user' ;
@@ -193,6 +228,7 @@ const configStore = useConfigStore();
193228const cur_embed_model = computed (() => configStore .config ? .embed_model );
194229const modelMatched = computed (() => ! graphInfo? .value ? .embed_model_name || graphInfo .value .embed_model_name === cur_embed_model .value )
195230
231+ const router = useRouter ();
196232const graphRef = ref (null )
197233const graphInfo = ref (null )
198234const fileList = ref ([]);
@@ -207,6 +243,7 @@ const state = reactive({
207243 searchLoading: false ,
208244 showModal: false ,
209245 showInfoModal: false ,
246+ showUploadTipModal: false ,
210247 processing: false ,
211248 indexing: false ,
212249 showPage: true ,
@@ -458,6 +495,33 @@ const getDatabaseName = () => {
458495 return selectedDb ? selectedDb.label : state.selectedDbId;
459496};
460497
498+ const getUploadTipMessage = () => {
499+ if (isNeo4j.value) {
500+ return 'Neo4j 图数据库支持通过上传 JSONL 格式文件直接导入实体和关系数据。';
501+ } else {
502+ const selectedDb = state.dbOptions.find(db => db.value === state.selectedDbId);
503+ const dbType = selectedDb?.type || '未知';
504+ const dbName = selectedDb?.label || getDatabaseName();
505+ return ` 当前选择的是 ${dbType .toUpperCase ()} 类型的知识库" ${dbName}" ,该类型知识库需要在文档知识库页面上传文档,系统会自动从中提取知识图谱。` ;
506+ }
507+ };
508+
509+ const goToDatabasePage = () => {
510+ state.showUploadTipModal = false;
511+
512+ // 如果不是 Neo4j,需要找到对应的知识库 ID 并跳转
513+ if (!isNeo4j.value) {
514+ const selectedDb = state.dbOptions.find(db => db.value === state.selectedDbId);
515+ if (selectedDb && selectedDb.type !== 'neo4j') {
516+ // 跳转到对应的知识库详情页面
517+ router.push(` / database/ ${state .selectedDbId }` );
518+ } else {
519+ // 如果找不到对应的数据库,跳转到数据库列表页面
520+ router.push('/database');
521+ }
522+ }
523+ };
524+
461525</script>
462526
463527<style lang="less" scoped>
@@ -478,9 +542,8 @@ const getDatabaseName = () => {
478542 margin-right: 20px;
479543
480544 .label {
545+ font-size: 14px;
481546 margin-right: 8px;
482- font-weight: 500;
483- color: var(--color-text-secondary);
484547 }
485548}
486549
@@ -579,4 +642,19 @@ const getDatabaseName = () => {
579642 box-shadow: none;
580643 }
581644}
645+
646+ .upload-tip-content {
647+ .upload-tip-actions {
648+ p {
649+ margin-bottom: 16px;
650+ color: var(--color-text-secondary);
651+ }
652+ }
653+
654+ .action-buttons {
655+ display: flex;
656+ justify-content: center;
657+ margin-top: 20px;
658+ }
659+ }
582660</style>
0 commit comments