(fileIds)
| 351 | } |
| 352 | |
| 353 | async function parseFiles(fileIds) { |
| 354 | if (fileIds.length === 0) return |
| 355 | state.chunkLoading = true |
| 356 | try { |
| 357 | const data = await documentApi.parseDocuments(kbId.value, fileIds) |
| 358 | if (data.status === 'success' || data.status === 'queued') { |
| 359 | enableAutoRefresh('auto') |
| 360 | message.success(data.message || '解析任务已提交') |
| 361 | if (data.task_id) { |
| 362 | taskerStore.registerQueuedTask({ |
| 363 | task_id: data.task_id, |
| 364 | name: `文档解析 (${kbId.value})`, |
| 365 | task_type: 'knowledge_parse', |
| 366 | message: data.message, |
| 367 | payload: { kb_id: kbId.value, count: fileIds.length } |
| 368 | }) |
| 369 | } |
| 370 | await delayedRefresh() // 延迟1秒后刷新 |
| 371 | return true |
| 372 | } else { |
| 373 | message.error(data.message || '提交失败') |
| 374 | return false |
| 375 | } |
| 376 | } catch (error) { |
| 377 | console.error(error) |
| 378 | message.error(error.message || '请求失败') |
| 379 | return false |
| 380 | } finally { |
| 381 | state.chunkLoading = false |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | async function indexFiles(fileIds, params = {}) { |
| 386 | if (fileIds.length === 0) return |
nothing calls this directly
no test coverage detected