@@ -10,9 +10,10 @@ import KnowledgeApi from '@/api/admin/workspace/knowledge/knowledge'
1010import SharedKnowledgeApi from ' @/api/admin/workspace/shared/knowledge/knowledge'
1111import CommonApi from ' @/api/admin/workspace/common'
1212import CommonSystemApi from ' @/api/admin/system/common'
13- import { DOCUMENT_TASK_TYPE , KNOWLEDGE_TYPE } from ' @/api/enums'
13+ import { DOCUMENT_TASK_TYPE } from ' @/api/enums'
14+ import { KNOWLEDGE_TYPE_KEY } from ' @/constants/knowledge'
1415import { DOCUMENT_HIT_HANDLING_LABELS } from ' @/constants/document'
15- import { DOCUMENT_STATUS_FILTER_OPTIONS , isDocumentTaskRunning } from ' ./status'
16+ import { DOCUMENT_STATUS_FILTER_OPTIONS } from ' ./status'
1617import type { Dict , DocumentHitHandling , DocumentItem , OptionItem } from ' @/api/types'
1718import { datetimeFormat } from ' @/utils/time'
1819import { isWorkspaceSharedResource } from ' @/utils/resource-context'
@@ -26,7 +27,8 @@ import {
2627 DeleteDocumentAction ,
2728 DocumentTagsAction ,
2829 EmbeddingDocumentAction ,
29- GenerateDocumentQuestionsAction ,
30+ GenerateQuestionsAction ,
31+ BatchGenerateQuestionsAction ,
3032 DownloadDocumentAction ,
3133 ExportDocumentAction ,
3234 MigrateDocumentAction ,
@@ -36,18 +38,17 @@ import {
3638 TokenizeDocumentAction ,
3739 BatchTokenizeAction ,
3840} from ' ./action-dropdown'
39- import { useKnowledgeDetailContext } from ' ../context'
4041
4142defineOptions ({ name: ' DocumentListView' })
4243defineProps <ResourceDetailPageProps >()
4344defineExpose ({ customHeader: true })
4445
4546const route = useRoute ()
4647const knowledgeId = computed (() => String (route .params .knowledgeId ?? ' ' ))
47- const { knowledge } = useKnowledgeDetailContext ( )
48+ const knowledgeType = computed (() => route . params . type )
4849
4950/* 快速创建 */
50- const showQuickCreate = computed (() => knowledge .value ?. type === KNOWLEDGE_TYPE .BASE && ! isWorkspaceSharedResource ())
51+ const showQuickCreate = computed (() => knowledgeType .value === KNOWLEDGE_TYPE_KEY .BASE && ! isWorkspaceSharedResource ())
5152const quickCreateRef = ref <InstanceType <typeof MkQuickCreate >>()
5253
5354function handleCreateDocument(name : string ) {
@@ -382,42 +383,29 @@ onBeforeUnmount(() => {
382383 @refresh =" refreshAfterOperation "
383384 />
384385 <!-- 更多文档操作 -->
385- <MkTableMoreDropdown persistent>
386- <!-- 文档设置 -->
387- <SettingDocumentAction
388- :api =" DocumentApi "
389- :knowledge-id =" knowledgeId "
390- :documents =" [row ] "
391- :disabled =" operationLoading "
392- @refresh =" refreshAfterOperation "
393- />
386+ <MkTableMoreDropdown >
394387 <!-- 同步文档 -->
395388 <SyncDocumentAction
389+ v-if =" knowledgeType === KNOWLEDGE_TYPE_KEY .WEB || knowledgeType === KNOWLEDGE_TYPE_KEY .LARK "
396390 :api =" DocumentApi "
397391 :knowledge-id =" knowledgeId "
398392 v-model :loading =" operationLoading "
399393 :documents =" [row ] "
400- :knowledge-type =" knowledge ?.type "
401394 @refresh =" refreshAfterOperation "
402395 />
403- <!-- 取消生成问题 -->
404- <BatchCancelTaskAction
396+ <!-- 生成或取消生成问题 -->
397+ <GenerateQuestionsAction
405398 :api =" DocumentApi "
406- :knowledge-id =" knowledgeId "
407399 v-model :loading =" operationLoading "
408- :document-ids =" [row .id ] "
409- :task-type =" DOCUMENT_TASK_TYPE .GENERATE_PROBLEM "
410- label="取消生成问题"
411- v-if =" isDocumentTaskRunning (row , DOCUMENT_TASK_TYPE .GENERATE_PROBLEM )"
400+ :knowledge-id =" knowledgeId "
401+ :document =" row "
412402 @refresh =" refreshAfterOperation "
413403 />
414- <!-- 生成问题 -->
415- <GenerateDocumentQuestionsAction
404+ <!-- 文档设置 -->
405+ <SettingDocumentAction
416406 :api =" DocumentApi "
417- v-model :loading =" operationLoading "
418- v-else
419407 :knowledge-id =" knowledgeId "
420- :document-ids =" [row . id ] "
408+ :documents =" [row ] "
421409 :disabled =" operationLoading "
422410 @refresh =" refreshAfterOperation "
423411 />
@@ -454,7 +442,7 @@ onBeforeUnmount(() => {
454442 :document-ids =" [row .id ] "
455443 format="zip"
456444 />
457- <template v-if =" knowledge ?. type === KNOWLEDGE_TYPE .BASE || knowledge ?. type === KNOWLEDGE_TYPE .WORKFLOW " >
445+ <template v-if =" knowledgeType === KNOWLEDGE_TYPE_KEY .BASE || knowledgeType === KNOWLEDGE_TYPE_KEY .WORKFLOW " >
458446 <!-- 下载原文档 -->
459447 <DownloadDocumentAction :api =" DocumentApi " :knowledge-id =" knowledgeId " v-model :loading =" operationLoading " :document =" row " />
460448 <!-- 替换原文档 -->
@@ -499,10 +487,9 @@ onBeforeUnmount(() => {
499487 @refresh =" refreshAfterOperation "
500488 />
501489 <!-- 批量生成问题 -->
502- <GenerateDocumentQuestionsAction
490+ <BatchGenerateQuestionsAction
503491 :api =" DocumentApi "
504492 v-model :loading =" operationLoading "
505- batch
506493 :knowledge-id =" knowledgeId "
507494 :document-ids =" selectedDocumentIds "
508495 :disabled =" operationLoading "
@@ -537,7 +524,6 @@ onBeforeUnmount(() => {
537524 :knowledge-id =" knowledgeId "
538525 v-model :loading =" operationLoading "
539526 :documents =" selectedDocuments "
540- :knowledge-type =" knowledge ?.type "
541527 batch
542528 @refresh =" refreshAfterOperation "
543529 />
0 commit comments