| | |
| | | import { |
| | | deleteKnowledgeDocument, |
| | | getKnowledgeDocumentPage, |
| | | processDocument, |
| | | updateKnowledgeDocumentStatus, |
| | | } from '#/api/ai/knowledge/document'; |
| | | import { $t } from '#/locales'; |
| | |
| | | name: 'AiKnowledgeSegment', |
| | | query: { documentId: id }, |
| | | }); |
| | | } |
| | | |
| | | /** 处理文档(分段+向量化) */ |
| | | async function handleProcess(row: AiKnowledgeDocumentApi.KnowledgeDocument) { |
| | | const hideLoading = message.loading({ |
| | | content: `正在处理文档【${row.name}】...`, |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await processDocument(row.id!); |
| | | message.success(`文档【${row.name}】处理成功`); |
| | | handleRefresh(); |
| | | } catch { |
| | | message.error(`文档【${row.name}】处理失败`); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 更新文档状态 */ |
| | |
| | | |
| | | <template> |
| | | <Page auto-content-height> |
| | | <div class="mb-2"> |
| | | <a-button type="default" @click="router.back()"> |
| | | 返回上一页 |
| | | </a-button> |
| | | </div> |
| | | <Grid table-title="知识库文档列表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | |
| | | onClick: handleSegment.bind(null, row.id), |
| | | }, |
| | | { |
| | | label: '处理', |
| | | type: 'link', |
| | | icon: ACTION_ICON.REFRESH, |
| | | auth: ['ai:knowledge:update'], |
| | | onClick: handleProcess.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |