|
12 | 12 | type="primary" |
13 | 13 | @click="chunkData" |
14 | 14 | :loading="chunkLoading" |
15 | | - :disabled="(uploadMode === 'file' && fileList.length === 0) || (uploadMode === 'url' && !urlList.trim())" |
| 15 | + :disabled="fileList.length === 0" |
16 | 16 | > |
17 | 17 | 添加到知识库 |
18 | 18 | </a-button> |
|
26 | 26 | :options="uploadModeOptions" |
27 | 27 | size="large" |
28 | 28 | class="source-segmented" |
| 29 | + :disabled="true" |
29 | 30 | /> |
30 | 31 | </div> |
31 | 32 | <div class="config-controls"> |
|
101 | 102 | </a-upload-dragger> |
102 | 103 | </div> |
103 | 104 |
|
104 | | - |
105 | | - |
106 | | - <!-- URL 输入区域 --> |
107 | | - <div class="url-input" v-if="uploadMode === 'url'"> |
108 | | - <a-form layout="vertical"> |
109 | | - <a-form-item label="网页链接 (每行一个URL)"> |
110 | | - <a-textarea |
111 | | - v-model:value="urlList" |
112 | | - placeholder="请输入网页链接,每行一个" |
113 | | - :rows="6" |
114 | | - :disabled="chunkLoading" |
115 | | - /> |
116 | | - </a-form-item> |
117 | | - </a-form> |
118 | | - <p class="url-hint"> |
119 | | - 支持添加网页内容,系统会自动抓取网页文本并进行分块。请确保URL格式正确且可以公开访问。 |
120 | | - </p> |
121 | | - </div> |
| 105 | + |
122 | 106 | </div> |
123 | 107 | </a-modal> |
124 | 108 |
|
|
139 | 123 |
|
140 | 124 | <script setup> |
141 | 125 | import { ref, computed, onMounted, watch } from 'vue'; |
142 | | -import { message, Upload } from 'ant-design-vue'; |
| 126 | +import { message, Upload, Tooltip } from 'ant-design-vue'; |
143 | 127 | import { useUserStore } from '@/stores/user'; |
144 | 128 | import { useDatabaseStore } from '@/stores/database'; |
145 | 129 | import { ocrApi } from '@/apis/system_api'; |
@@ -269,19 +253,20 @@ const uploadModeOptions = computed(() => [ |
269 | 253 | }, |
270 | 254 | { |
271 | 255 | value: 'url', |
272 | | - label: h('div', { class: 'segmented-option' }, [ |
273 | | - h(LinkOutlined, { class: 'option-icon' }), |
274 | | - h('span', { class: 'option-text' }, '输入网址'), |
275 | | - ]), |
| 256 | + label: h(Tooltip, { title: 'URL 文档上传与解析功能已禁用,出于安全考虑,当前版本仅支持文件上传' }, { |
| 257 | + default: () => h('div', { class: 'segmented-option' }, [ |
| 258 | + h(LinkOutlined, { class: 'option-icon' }), |
| 259 | + h('span', { class: 'option-text' }, '输入网址'), |
| 260 | + ]) |
| 261 | + }), |
276 | 262 | }, |
277 | 263 | ]); |
278 | 264 |
|
279 | 265 | // 文件列表 |
280 | 266 | const fileList = ref([]); |
281 | 267 |
|
282 | 268 |
|
283 | | -// URL列表 |
284 | | -const urlList = ref(''); |
| 269 | +// URL相关功能已移除 |
285 | 270 |
|
286 | 271 | // OCR服务健康状态 |
287 | 272 | const ocrHealthStatus = ref({ |
@@ -330,14 +315,7 @@ const isOcrEnabled = computed(() => { |
330 | 315 | return chunkParams.value.enable_ocr !== 'disable'; |
331 | 316 | }); |
332 | 317 |
|
333 | | -watch(uploadMode, (mode, previous) => { |
334 | | - if (mode === 'url') { |
335 | | - previousOcrSelection.value = chunkParams.value.enable_ocr; |
336 | | - chunkParams.value.enable_ocr = 'disable'; |
337 | | - } else if (mode === 'file' && previous === 'url') { |
338 | | - chunkParams.value.enable_ocr = previousOcrSelection.value || 'disable'; |
339 | | - } |
340 | | -}); |
| 318 | +// 上传模式切换相关逻辑已移除 |
341 | 319 |
|
342 | 320 | // 计算属性:是否有PDF或图片文件 |
343 | 321 | const hasPdfOrImageFiles = computed(() => { |
@@ -630,31 +608,11 @@ const chunkData = async () => { |
630 | 608 | } finally { |
631 | 609 | store.state.chunkLoading = false; |
632 | 610 | } |
633 | | - } else if (uploadMode.value === 'url') { |
634 | | - const urls = urlList.value.split('\n') |
635 | | - .map(url => url.trim()) |
636 | | - .filter(url => url.length > 0 && (url.startsWith('http://') || url.startsWith('https://'))); |
637 | | -
|
638 | | - if (urls.length === 0) { |
639 | | - message.error('请输入有效的网页链接(必须以http://或https://开头)'); |
640 | | - return; |
641 | | - } |
642 | | -
|
643 | | - try { |
644 | | - store.state.chunkLoading = true; |
645 | | - success = await store.addFiles({ items: urls, contentType: 'url', params: chunkParams.value }); |
646 | | - } catch (error) { |
647 | | - console.error('URL上传失败:', error); |
648 | | - message.error('URL上传失败: ' + (error.message || '未知错误')); |
649 | | - } finally { |
650 | | - store.state.chunkLoading = false; |
651 | | - } |
652 | 611 | } |
653 | 612 |
|
654 | 613 | if (success) { |
655 | 614 | emit('update:visible', false); |
656 | 615 | fileList.value = []; |
657 | | - urlList.value = ''; |
658 | 616 | } |
659 | 617 | }; |
660 | 618 |
|
|
0 commit comments