feat: implement reparse functionality with process configuration support
- Enhanced the `reparseKnowledge` function to accept optional process configuration overrides, allowing users to adjust parsing settings during reparse operations. - Updated the frontend components to integrate reparse capabilities, including the `UploadConfirmDialog` and `KnowledgeBase` views, providing a user-friendly interface for confirming reparse actions. - Added new localization strings for reparse confirmation and process configuration details in multiple languages. - Modified the backend API to handle reparse requests with optional configuration, ensuring proper validation and persistence of overrides. - Introduced new types and interfaces to manage reparse-specific data structures in the store, improving type safety and clarity in the codebase.
This commit is contained in:
@@ -251,8 +251,8 @@ export function updateManualKnowledge(
|
|||||||
return put(`/api/v1/knowledge/manual/${id}`, data);
|
return put(`/api/v1/knowledge/manual/${id}`, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reparseKnowledge(id: string) {
|
export function reparseKnowledge(id: string, data?: { process_config?: KnowledgeProcessOverrides }) {
|
||||||
return post(`/api/v1/knowledge/${id}/reparse`);
|
return post(`/api/v1/knowledge/${id}/reparse`, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function cancelKnowledgeParse(id: string) {
|
export function cancelKnowledgeParse(id: string) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const handleCancel = () => {
|
|||||||
:files="uploadConfirmStore.files"
|
:files="uploadConfirmStore.files"
|
||||||
:urls="uploadConfirmStore.urls"
|
:urls="uploadConfirmStore.urls"
|
||||||
:manual-preview="uploadConfirmStore.manual"
|
:manual-preview="uploadConfirmStore.manual"
|
||||||
|
:reparse-preview="uploadConfirmStore.reparse"
|
||||||
:accept-file-types="uploadConfirmStore.acceptFileTypes"
|
:accept-file-types="uploadConfirmStore.acceptFileTypes"
|
||||||
:supported-file-types="uploadConfirmStore.supportedFileTypes"
|
:supported-file-types="uploadConfirmStore.supportedFileTypes"
|
||||||
@confirm="handleConfirm"
|
@confirm="handleConfirm"
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
import { ref, reactive, onMounted, onBeforeUnmount, watch, computed, nextTick } from 'vue'
|
import { ref, reactive, onMounted, onBeforeUnmount, watch, computed, nextTick } from 'vue'
|
||||||
import { MessagePlugin } from 'tdesign-vue-next'
|
import { MessagePlugin } from 'tdesign-vue-next'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { getKnowledgeSpans, reparseKnowledge, cancelKnowledgeParse } from '@/api/knowledge-base/index'
|
import { getKnowledgeSpans, reparseKnowledge, cancelKnowledgeParse, getKnowledgeDetails } from '@/api/knowledge-base/index'
|
||||||
import { knowledgeSpansPayloadHasTrace } from '@/utils/knowledgeTrace'
|
import { knowledgeSpansPayloadHasTrace } from '@/utils/knowledgeTrace'
|
||||||
|
import type { KnowledgeProcessOverrides } from '@/types/knowledgeProcess'
|
||||||
|
|
||||||
interface SpanNode {
|
interface SpanNode {
|
||||||
span_id?: string
|
span_id?: string
|
||||||
@@ -92,6 +93,7 @@ const STAGES = ['docreader', 'chunking', 'embedding', 'multimodal', 'postprocess
|
|||||||
const POLL_INTERVAL_MS = 2000
|
const POLL_INTERVAL_MS = 2000
|
||||||
|
|
||||||
const data = ref<SpansResponse | null>(null)
|
const data = ref<SpansResponse | null>(null)
|
||||||
|
const processOverrides = ref<KnowledgeProcessOverrides | null>(null)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const refreshing = ref(false)
|
const refreshing = ref(false)
|
||||||
const selectedAttempt = ref<number | undefined>(undefined)
|
const selectedAttempt = ref<number | undefined>(undefined)
|
||||||
@@ -519,8 +521,21 @@ function onKeydown(ev: KeyboardEvent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchProcessOverrides() {
|
||||||
|
if (props.compact || !props.knowledgeId) return
|
||||||
|
try {
|
||||||
|
const res: any = await getKnowledgeDetails(props.knowledgeId)
|
||||||
|
if (res?.success && res.data) {
|
||||||
|
processOverrides.value = res.data.metadata?.process_overrides ?? null
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
processOverrides.value = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchSpans()
|
fetchSpans()
|
||||||
|
fetchProcessOverrides()
|
||||||
// One permanent interval for the entire component lifetime. The
|
// One permanent interval for the entire component lifetime. The
|
||||||
// tick decides whether to actually fetch — no clearing, no
|
// tick decides whether to actually fetch — no clearing, no
|
||||||
// re-arming, no watchers wired into it. If this interval ever
|
// re-arming, no watchers wired into it. If this interval ever
|
||||||
@@ -1290,6 +1305,46 @@ const stageBreakdown = computed<StageRowSummary[]>(() => {
|
|||||||
pct: typeof s.duration_ms === 'number' && s.duration_ms > 0 ? Math.min(100, (s.duration_ms / total) * 100) : 0,
|
pct: typeof s.duration_ms === 'number' && s.duration_ms > 0 ? Math.min(100, (s.duration_ms / total) * 100) : 0,
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Human-readable summary of the per-upload parse overrides stored in
|
||||||
|
// knowledge.metadata.process_overrides. Empty overrides → KB defaults.
|
||||||
|
const processConfigLines = computed<string[]>(() => {
|
||||||
|
const o = processOverrides.value
|
||||||
|
if (!o) return [t('knowledgeStages.processConfig.kbDefault')]
|
||||||
|
const k = (s: string) => `knowledgeStages.processConfig.${s}`
|
||||||
|
const onOff = (v: boolean) => (v ? t(k('on')) : t(k('off')))
|
||||||
|
const lines: string[] = []
|
||||||
|
|
||||||
|
const cc = o.chunking_config
|
||||||
|
if (cc) {
|
||||||
|
const parts: string[] = []
|
||||||
|
if (cc.chunk_size != null) parts.push(t(k('chunkSize'), { n: cc.chunk_size }))
|
||||||
|
if (cc.enable_parent_child != null) {
|
||||||
|
parts.push(cc.enable_parent_child ? t(k('parentChildOn')) : t(k('parentChildOff')))
|
||||||
|
}
|
||||||
|
if (parts.length) lines.push(`${t(k('chunking'))}: ${parts.join(' · ')}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const rules = o.parser_engine_rules || cc?.parser_engine_rules
|
||||||
|
if (rules?.length) {
|
||||||
|
lines.push(`${t(k('parser'))}: ${rules.map(r => `${r.file_types.join('/')}→${r.engine}`).join(', ')}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const mm = o.vlm_config?.enabled ?? o.enable_multimodel
|
||||||
|
if (mm != null) lines.push(`${t(k('multimodal'))}: ${onOff(mm)}`)
|
||||||
|
|
||||||
|
if (o.asr_config?.enabled != null) lines.push(`${t(k('asr'))}: ${onOff(o.asr_config.enabled)}`)
|
||||||
|
|
||||||
|
const qg = o.question_generation_config
|
||||||
|
if (qg?.enabled != null) {
|
||||||
|
lines.push(`${t(k('question'))}: ${qg.enabled ? t(k('questionOn'), { n: qg.question_count ?? 3 }) : t(k('off'))}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const graph = o.graph_enabled ?? o.extract_config?.enabled
|
||||||
|
if (graph != null) lines.push(`${t(k('graph'))}: ${onOff(graph)}`)
|
||||||
|
|
||||||
|
return lines.length ? lines : [t('knowledgeStages.processConfig.kbDefault')]
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -1333,6 +1388,19 @@ const stageBreakdown = computed<StageRowSummary[]>(() => {
|
|||||||
<span class="kp-live-text">{{ t('knowledgeStages.live') }}</span>
|
<span class="kp-live-text">{{ t('knowledgeStages.live') }}</span>
|
||||||
</span>
|
</span>
|
||||||
<div class="kp-head-actions">
|
<div class="kp-head-actions">
|
||||||
|
<t-popup trigger="hover" placement="bottom-right" :overlay-style="{ maxWidth: '340px' }">
|
||||||
|
<button type="button" class="kp-icon-btn"
|
||||||
|
:title="t('knowledgeStages.processConfig.title')"
|
||||||
|
:aria-label="t('knowledgeStages.processConfig.title')">
|
||||||
|
<t-icon name="info-circle" size="14px" />
|
||||||
|
</button>
|
||||||
|
<template #content>
|
||||||
|
<div class="kp-proccfg-pop">
|
||||||
|
<div class="kp-proccfg-title">{{ t('knowledgeStages.processConfig.title') }}</div>
|
||||||
|
<div v-for="(line, i) in processConfigLines" :key="i" class="kp-proccfg-line">{{ line }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</t-popup>
|
||||||
<button type="button" class="kp-icon-btn" :class="{
|
<button type="button" class="kp-icon-btn" :class="{
|
||||||
'kp-icon-btn-spin': refreshing,
|
'kp-icon-btn-spin': refreshing,
|
||||||
'kp-icon-btn-autoflow': isLive && !refreshing,
|
'kp-icon-btn-autoflow': isLive && !refreshing,
|
||||||
@@ -3163,4 +3231,26 @@ const stageBreakdown = computed<StageRowSummary[]>(() => {
|
|||||||
color: var(--td-brand-color);
|
color: var(--td-brand-color);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.kp-proccfg-pop {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 2px 0;
|
||||||
|
max-width: 320px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kp-proccfg-title {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--td-text-color-primary);
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kp-proccfg-line {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.6;
|
||||||
|
color: var(--td-text-color-secondary);
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -698,6 +698,11 @@ export default {
|
|||||||
overviewDescManual: 'The document will be published and indexed after you confirm the settings',
|
overviewDescManual: 'The document will be published and indexed after you confirm the settings',
|
||||||
confirmUrl: 'Import and parse',
|
confirmUrl: 'Import and parse',
|
||||||
confirmManual: 'Publish and parse',
|
confirmManual: 'Publish and parse',
|
||||||
|
titleReparse: 'Confirm reparse',
|
||||||
|
overviewDescReparse: 'After you confirm the settings, existing content will be cleared and the document re-parsed',
|
||||||
|
confirmReparse: 'Confirm and reparse',
|
||||||
|
reparseSource: 'Document to reparse',
|
||||||
|
reparseHint: 'Reuses the last parse settings; adjust them here',
|
||||||
urlSource: 'Import source',
|
urlSource: 'Import source',
|
||||||
manualSource: 'Document to publish',
|
manualSource: 'Document to publish',
|
||||||
editUrl: 'Edit URL',
|
editUrl: 'Edit URL',
|
||||||
@@ -707,6 +712,22 @@ export default {
|
|||||||
knowledgeStages: {
|
knowledgeStages: {
|
||||||
title: 'Processing pipeline',
|
title: 'Processing pipeline',
|
||||||
root: 'Knowledge processing',
|
root: 'Knowledge processing',
|
||||||
|
processConfig: {
|
||||||
|
title: 'Parse config for this run',
|
||||||
|
kbDefault: 'Using knowledge base defaults',
|
||||||
|
chunking: 'Chunking',
|
||||||
|
chunkSize: 'size {n}',
|
||||||
|
parentChildOn: 'parent-child on',
|
||||||
|
parentChildOff: 'parent-child off',
|
||||||
|
parser: 'Parser engine',
|
||||||
|
multimodal: 'Multimodal',
|
||||||
|
asr: 'Audio (ASR)',
|
||||||
|
question: 'Question generation',
|
||||||
|
questionOn: 'on ({n} per chunk)',
|
||||||
|
graph: 'Knowledge graph',
|
||||||
|
on: 'on',
|
||||||
|
off: 'off',
|
||||||
|
},
|
||||||
attempt: 'Attempt {n}',
|
attempt: 'Attempt {n}',
|
||||||
attemptLatest: 'Attempt {n} (latest)',
|
attemptLatest: 'Attempt {n} (latest)',
|
||||||
retry: 'Retry parsing',
|
retry: 'Retry parsing',
|
||||||
|
|||||||
@@ -704,12 +704,33 @@ export default {
|
|||||||
overviewDescManual: "설정 확인 후 문서를 게시하고 인덱싱합니다",
|
overviewDescManual: "설정 확인 후 문서를 게시하고 인덱싱합니다",
|
||||||
confirmUrl: "가져오기 및 파싱",
|
confirmUrl: "가져오기 및 파싱",
|
||||||
confirmManual: "게시 및 파싱",
|
confirmManual: "게시 및 파싱",
|
||||||
|
titleReparse: "재파싱 확인",
|
||||||
|
overviewDescReparse: "설정 확인 후 기존 내용을 삭제하고 문서를 다시 파싱합니다",
|
||||||
|
confirmReparse: "확인 후 재파싱",
|
||||||
|
reparseSource: "재파싱할 문서",
|
||||||
|
reparseHint: "이전 파싱 설정을 사용하며 여기서 조정할 수 있습니다",
|
||||||
urlSource: "가져오기 소스",
|
urlSource: "가져오기 소스",
|
||||||
manualSource: "게시할 문서",
|
manualSource: "게시할 문서",
|
||||||
editUrl: "URL 수정",
|
editUrl: "URL 수정",
|
||||||
manualCharCount: "{count}자",
|
manualCharCount: "{count}자",
|
||||||
},
|
},
|
||||||
knowledgeStages: {
|
knowledgeStages: {
|
||||||
|
processConfig: {
|
||||||
|
title: "이번 파싱 설정",
|
||||||
|
kbDefault: "지식 베이스 기본 설정 사용",
|
||||||
|
chunking: "청킹",
|
||||||
|
chunkSize: "크기 {n}",
|
||||||
|
parentChildOn: "부모-자식 켜짐",
|
||||||
|
parentChildOff: "부모-자식 꺼짐",
|
||||||
|
parser: "파서 엔진",
|
||||||
|
multimodal: "멀티모달",
|
||||||
|
asr: "오디오 인식",
|
||||||
|
question: "질문 생성",
|
||||||
|
questionOn: "켜짐 (청크당 {n}개)",
|
||||||
|
graph: "지식 그래프",
|
||||||
|
on: "켜짐",
|
||||||
|
off: "꺼짐",
|
||||||
|
},
|
||||||
title: "처리 파이프라인",
|
title: "처리 파이프라인",
|
||||||
root: "지식 처리",
|
root: "지식 처리",
|
||||||
attempt: "{n}번째 시도",
|
attempt: "{n}번째 시도",
|
||||||
|
|||||||
@@ -668,12 +668,33 @@ export default {
|
|||||||
overviewDescManual: 'После подтверждения настроек документ будет опубликован и проиндексирован',
|
overviewDescManual: 'После подтверждения настроек документ будет опубликован и проиндексирован',
|
||||||
confirmUrl: 'Импортировать и обработать',
|
confirmUrl: 'Импортировать и обработать',
|
||||||
confirmManual: 'Опубликовать и обработать',
|
confirmManual: 'Опубликовать и обработать',
|
||||||
|
titleReparse: 'Подтверждение повторной обработки',
|
||||||
|
overviewDescReparse: 'После подтверждения настроек существующее содержимое будет удалено, а документ обработан заново',
|
||||||
|
confirmReparse: 'Подтвердить и обработать заново',
|
||||||
|
reparseSource: 'Документ для повторной обработки',
|
||||||
|
reparseHint: 'Используются настройки прошлой обработки; их можно изменить здесь',
|
||||||
urlSource: 'Источник импорта',
|
urlSource: 'Источник импорта',
|
||||||
manualSource: 'Документ для публикации',
|
manualSource: 'Документ для публикации',
|
||||||
editUrl: 'Изменить URL',
|
editUrl: 'Изменить URL',
|
||||||
manualCharCount: '{count} символов',
|
manualCharCount: '{count} символов',
|
||||||
},
|
},
|
||||||
knowledgeStages: {
|
knowledgeStages: {
|
||||||
|
processConfig: {
|
||||||
|
title: 'Конфигурация обработки',
|
||||||
|
kbDefault: 'Используются настройки базы знаний по умолчанию',
|
||||||
|
chunking: 'Разбиение',
|
||||||
|
chunkSize: 'размер {n}',
|
||||||
|
parentChildOn: 'родитель-потомок вкл',
|
||||||
|
parentChildOff: 'родитель-потомок выкл',
|
||||||
|
parser: 'Движок парсера',
|
||||||
|
multimodal: 'Мультимодальность',
|
||||||
|
asr: 'Аудио (ASR)',
|
||||||
|
question: 'Генерация вопросов',
|
||||||
|
questionOn: 'вкл ({n} на фрагмент)',
|
||||||
|
graph: 'Граф знаний',
|
||||||
|
on: 'вкл',
|
||||||
|
off: 'выкл',
|
||||||
|
},
|
||||||
title: 'Конвейер обработки',
|
title: 'Конвейер обработки',
|
||||||
root: 'Обработка знаний',
|
root: 'Обработка знаний',
|
||||||
attempt: 'Попытка {n}',
|
attempt: 'Попытка {n}',
|
||||||
|
|||||||
@@ -701,6 +701,11 @@ export default {
|
|||||||
overviewDescManual: "确认解析配置后将发布并索引该文档",
|
overviewDescManual: "确认解析配置后将发布并索引该文档",
|
||||||
confirmUrl: "确认导入并解析",
|
confirmUrl: "确认导入并解析",
|
||||||
confirmManual: "确认发布并解析",
|
confirmManual: "确认发布并解析",
|
||||||
|
titleReparse: "重新解析确认",
|
||||||
|
overviewDescReparse: "确认解析配置后将清除现有内容并重新解析该文档",
|
||||||
|
confirmReparse: "确认并重新解析",
|
||||||
|
reparseSource: "待重新解析文档",
|
||||||
|
reparseHint: "将沿用上次解析的配置,可在此调整",
|
||||||
urlSource: "导入来源",
|
urlSource: "导入来源",
|
||||||
manualSource: "待发布文档",
|
manualSource: "待发布文档",
|
||||||
editUrl: "修改 URL",
|
editUrl: "修改 URL",
|
||||||
@@ -709,6 +714,22 @@ export default {
|
|||||||
knowledgeStages: {
|
knowledgeStages: {
|
||||||
title: "处理流水线",
|
title: "处理流水线",
|
||||||
root: "知识处理",
|
root: "知识处理",
|
||||||
|
processConfig: {
|
||||||
|
title: "本次解析配置",
|
||||||
|
kbDefault: "使用知识库默认配置",
|
||||||
|
chunking: "分块",
|
||||||
|
chunkSize: "大小 {n}",
|
||||||
|
parentChildOn: "父子分块开",
|
||||||
|
parentChildOff: "父子分块关",
|
||||||
|
parser: "解析引擎",
|
||||||
|
multimodal: "多模态",
|
||||||
|
asr: "音频识别",
|
||||||
|
question: "问题生成",
|
||||||
|
questionOn: "开({n} 个/块)",
|
||||||
|
graph: "知识图谱",
|
||||||
|
on: "开",
|
||||||
|
off: "关",
|
||||||
|
},
|
||||||
attempt: "第 {n} 次尝试",
|
attempt: "第 {n} 次尝试",
|
||||||
attemptLatest: "第 {n} 次尝试(最新)",
|
attemptLatest: "第 {n} 次尝试(最新)",
|
||||||
retry: "重新解析",
|
retry: "重新解析",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import type { KnowledgeProcessOverrides } from '@/types/knowledgeProcess'
|
import type { KnowledgeProcessOverrides } from '@/types/knowledgeProcess'
|
||||||
|
|
||||||
export type UploadConfirmMode = 'file' | 'url' | 'manual'
|
export type UploadConfirmMode = 'file' | 'url' | 'manual' | 'reparse'
|
||||||
|
|
||||||
export interface UploadConfirmManualSource {
|
export interface UploadConfirmManualSource {
|
||||||
kbId: string
|
kbId: string
|
||||||
@@ -11,12 +11,20 @@ export interface UploadConfirmManualSource {
|
|||||||
tagId?: string
|
tagId?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface UploadConfirmReparseSource {
|
||||||
|
knowledgeId: string
|
||||||
|
fileName?: string
|
||||||
|
fileType?: string
|
||||||
|
processOverrides?: KnowledgeProcessOverrides | null
|
||||||
|
}
|
||||||
|
|
||||||
export interface UploadConfirmResult {
|
export interface UploadConfirmResult {
|
||||||
processConfig: KnowledgeProcessOverrides
|
processConfig: KnowledgeProcessOverrides
|
||||||
mode: UploadConfirmMode
|
mode: UploadConfirmMode
|
||||||
files?: File[]
|
files?: File[]
|
||||||
urls?: string[]
|
urls?: string[]
|
||||||
manual?: UploadConfirmManualSource
|
manual?: UploadConfirmManualSource
|
||||||
|
reparse?: UploadConfirmReparseSource
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OpenUploadConfirmOptions {
|
export interface OpenUploadConfirmOptions {
|
||||||
@@ -25,6 +33,7 @@ export interface OpenUploadConfirmOptions {
|
|||||||
files?: File[]
|
files?: File[]
|
||||||
urls?: string[]
|
urls?: string[]
|
||||||
manual?: UploadConfirmManualSource
|
manual?: UploadConfirmManualSource
|
||||||
|
reparse?: UploadConfirmReparseSource
|
||||||
acceptFileTypes?: string
|
acceptFileTypes?: string
|
||||||
supportedFileTypes?: string[]
|
supportedFileTypes?: string[]
|
||||||
}
|
}
|
||||||
@@ -37,6 +46,7 @@ export const useUploadConfirmStore = defineStore('uploadConfirm', {
|
|||||||
files: [] as File[],
|
files: [] as File[],
|
||||||
urls: [] as string[],
|
urls: [] as string[],
|
||||||
manual: null as UploadConfirmManualSource | null,
|
manual: null as UploadConfirmManualSource | null,
|
||||||
|
reparse: null as UploadConfirmReparseSource | null,
|
||||||
acceptFileTypes: '',
|
acceptFileTypes: '',
|
||||||
supportedFileTypes: [] as string[],
|
supportedFileTypes: [] as string[],
|
||||||
pendingResolve: null as ((value: UploadConfirmResult) => void) | null,
|
pendingResolve: null as ((value: UploadConfirmResult) => void) | null,
|
||||||
@@ -52,6 +62,7 @@ export const useUploadConfirmStore = defineStore('uploadConfirm', {
|
|||||||
this.files = options.files ? [...options.files] : []
|
this.files = options.files ? [...options.files] : []
|
||||||
this.urls = options.urls ? [...options.urls] : []
|
this.urls = options.urls ? [...options.urls] : []
|
||||||
this.manual = options.manual || null
|
this.manual = options.manual || null
|
||||||
|
this.reparse = options.reparse || null
|
||||||
this.acceptFileTypes = options.acceptFileTypes || ''
|
this.acceptFileTypes = options.acceptFileTypes || ''
|
||||||
this.supportedFileTypes = options.supportedFileTypes ? [...options.supportedFileTypes] : []
|
this.supportedFileTypes = options.supportedFileTypes ? [...options.supportedFileTypes] : []
|
||||||
this.pendingResolve = resolve
|
this.pendingResolve = resolve
|
||||||
@@ -76,6 +87,7 @@ export const useUploadConfirmStore = defineStore('uploadConfirm', {
|
|||||||
this.files = []
|
this.files = []
|
||||||
this.urls = []
|
this.urls = []
|
||||||
this.manual = null
|
this.manual = null
|
||||||
|
this.reparse = null
|
||||||
this.acceptFileTypes = ''
|
this.acceptFileTypes = ''
|
||||||
this.supportedFileTypes = []
|
this.supportedFileTypes = []
|
||||||
this.pendingResolve = null
|
this.pendingResolve = null
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import {
|
|||||||
cancelKnowledgeParse,
|
cancelKnowledgeParse,
|
||||||
batchDeleteKnowledge,
|
batchDeleteKnowledge,
|
||||||
getKnowledgeSpans,
|
getKnowledgeSpans,
|
||||||
|
getKnowledgeDetails,
|
||||||
} from "@/api/knowledge-base/index";
|
} from "@/api/knowledge-base/index";
|
||||||
import { knowledgeSpansPayloadHasTrace } from '@/utils/knowledgeTrace';
|
import { knowledgeSpansPayloadHasTrace } from '@/utils/knowledgeTrace';
|
||||||
import FAQEntryManager from './components/FAQEntryManager.vue';
|
import FAQEntryManager from './components/FAQEntryManager.vue';
|
||||||
@@ -1680,10 +1681,48 @@ const confirmRebuildKnowledge = async (index: number, item: KnowledgeCard) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
closeCardMoreMenu(index);
|
closeCardMoreMenu(index);
|
||||||
|
|
||||||
|
// No KB context to seed the dialog defaults — fall back to a direct reparse
|
||||||
|
// that reuses the overrides stored at upload time.
|
||||||
|
if (!kbInfo.value) {
|
||||||
|
await submitReparse(item.id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prefill the confirm dialog with the overrides this doc was last parsed with.
|
||||||
|
let processOverrides: KnowledgeProcessOverrides | null = item.metadata?.process_overrides ?? null;
|
||||||
|
let fileName = item.file_name || item.title || '';
|
||||||
|
let fileType = item.file_type || '';
|
||||||
try {
|
try {
|
||||||
await reparseKnowledge(item.id);
|
const detail: any = await getKnowledgeDetails(item.id);
|
||||||
delete traceAvailableById[item.id];
|
if (detail?.success && detail.data) {
|
||||||
traceAvailableById[item.id] = true;
|
processOverrides = detail.data.metadata?.process_overrides ?? processOverrides;
|
||||||
|
fileName = detail.data.file_name || detail.data.title || fileName;
|
||||||
|
fileType = detail.data.file_type || fileType;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// fall back to the list item's fields
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await uploadConfirmStore.open({
|
||||||
|
mode: 'reparse',
|
||||||
|
kbInfo: kbInfo.value,
|
||||||
|
reparse: { knowledgeId: item.id, fileName, fileType, processOverrides },
|
||||||
|
});
|
||||||
|
if (result.mode === 'reparse' && result.reparse) {
|
||||||
|
await submitReparse(result.reparse.knowledgeId, result.processConfig);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// cancelled
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const submitReparse = async (id: string, processConfig?: KnowledgeProcessOverrides) => {
|
||||||
|
try {
|
||||||
|
await reparseKnowledge(id, processConfig ? { process_config: processConfig } : undefined);
|
||||||
|
delete traceAvailableById[id];
|
||||||
|
traceAvailableById[id] = true;
|
||||||
MessagePlugin.success(t('knowledgeBase.rebuildSubmitted'));
|
MessagePlugin.success(t('knowledgeBase.rebuildSubmitted'));
|
||||||
resetPage();
|
resetPage();
|
||||||
loadKnowledgeFiles(kbId.value);
|
loadKnowledgeFiles(kbId.value);
|
||||||
@@ -2242,20 +2281,14 @@ async function createNewSession(value: string): Promise<void> {
|
|||||||
<t-icon class="icon" name="refresh" />
|
<t-icon class="icon" name="refresh" />
|
||||||
<span>{{ t('knowledgeBase.rebuildDocument') }}</span>
|
<span>{{ t('knowledgeBase.rebuildDocument') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<t-popconfirm
|
<div
|
||||||
v-else
|
v-else
|
||||||
theme="warning"
|
class="card-menu-item"
|
||||||
:content="t('knowledgeBase.rebuildConfirm', { fileName: item.file_name || item.title || '' })"
|
@click.stop="confirmRebuildKnowledge(index, item)"
|
||||||
:confirm-btn="{ content: t('common.confirm'), theme: 'primary' }"
|
|
||||||
:cancel-btn="{ content: t('common.cancel') }"
|
|
||||||
placement="left"
|
|
||||||
@confirm="confirmRebuildKnowledge(index, item)"
|
|
||||||
>
|
>
|
||||||
<div class="card-menu-item" @click.stop>
|
<t-icon class="icon" name="refresh" />
|
||||||
<t-icon class="icon" name="refresh" />
|
<span>{{ t('knowledgeBase.rebuildDocument') }}</span>
|
||||||
<span>{{ t('knowledgeBase.rebuildDocument') }}</span>
|
</div>
|
||||||
</div>
|
|
||||||
</t-popconfirm>
|
|
||||||
<t-popconfirm
|
<t-popconfirm
|
||||||
v-if="isParseInFlight(item.parse_status)"
|
v-if="isParseInFlight(item.parse_status)"
|
||||||
theme="warning"
|
theme="warning"
|
||||||
|
|||||||
@@ -31,6 +31,12 @@
|
|||||||
{{ t('uploadConfirm.manualCharCount', { count: manualCharCount }) }}
|
{{ t('uploadConfirm.manualCharCount', { count: manualCharCount }) }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="mode === 'reparse' && reparsePreview" class="manual-source-panel">
|
||||||
|
<p class="manual-source-title" :title="reparsePreview.fileName">
|
||||||
|
{{ reparsePreview.fileName || t('uploadConfirm.reparseSource') }}
|
||||||
|
</p>
|
||||||
|
<p class="manual-source-meta">{{ t('uploadConfirm.reparseHint') }}</p>
|
||||||
|
</div>
|
||||||
<ul v-else-if="mode === 'file' && batchItemCount > 0" class="files-list">
|
<ul v-else-if="mode === 'file' && batchItemCount > 0" class="files-list">
|
||||||
<li v-for="(url, index) in localUrls" :key="`url-${url}-${index}`" class="file-item">
|
<li v-for="(url, index) in localUrls" :key="`url-${url}-${index}`" class="file-item">
|
||||||
<t-icon name="link" class="file-icon" />
|
<t-icon name="link" class="file-icon" />
|
||||||
@@ -251,6 +257,7 @@ import type { KnowledgeProcessOverrides } from '@/types/knowledgeProcess'
|
|||||||
import type {
|
import type {
|
||||||
UploadConfirmManualSource,
|
UploadConfirmManualSource,
|
||||||
UploadConfirmMode,
|
UploadConfirmMode,
|
||||||
|
UploadConfirmReparseSource,
|
||||||
UploadConfirmResult,
|
UploadConfirmResult,
|
||||||
} from '@/stores/uploadConfirm'
|
} from '@/stores/uploadConfirm'
|
||||||
|
|
||||||
@@ -292,6 +299,7 @@ const props = withDefaults(defineProps<{
|
|||||||
files?: File[]
|
files?: File[]
|
||||||
urls?: string[]
|
urls?: string[]
|
||||||
manualPreview?: UploadConfirmManualSource | null
|
manualPreview?: UploadConfirmManualSource | null
|
||||||
|
reparsePreview?: UploadConfirmReparseSource | null
|
||||||
tagId?: string
|
tagId?: string
|
||||||
acceptFileTypes?: string
|
acceptFileTypes?: string
|
||||||
supportedFileTypes?: string[]
|
supportedFileTypes?: string[]
|
||||||
@@ -300,6 +308,7 @@ const props = withDefaults(defineProps<{
|
|||||||
files: () => [],
|
files: () => [],
|
||||||
urls: () => [],
|
urls: () => [],
|
||||||
manualPreview: null,
|
manualPreview: null,
|
||||||
|
reparsePreview: null,
|
||||||
acceptFileTypes: '',
|
acceptFileTypes: '',
|
||||||
supportedFileTypes: () => [],
|
supportedFileTypes: () => [],
|
||||||
})
|
})
|
||||||
@@ -384,21 +393,25 @@ const batchItemCount = computed(() => localFiles.value.length + localUrls.value.
|
|||||||
|
|
||||||
const sourcePanelTitle = computed(() => {
|
const sourcePanelTitle = computed(() => {
|
||||||
if (props.mode === 'manual') return t('uploadConfirm.manualSource')
|
if (props.mode === 'manual') return t('uploadConfirm.manualSource')
|
||||||
|
if (props.mode === 'reparse') return t('uploadConfirm.reparseSource')
|
||||||
return t('uploadConfirm.fileList')
|
return t('uploadConfirm.fileList')
|
||||||
})
|
})
|
||||||
|
|
||||||
const dialogTitle = computed(() => {
|
const dialogTitle = computed(() => {
|
||||||
if (props.mode === 'manual') return t('uploadConfirm.titleManual')
|
if (props.mode === 'manual') return t('uploadConfirm.titleManual')
|
||||||
|
if (props.mode === 'reparse') return t('uploadConfirm.titleReparse')
|
||||||
return t('uploadConfirm.title')
|
return t('uploadConfirm.title')
|
||||||
})
|
})
|
||||||
|
|
||||||
const dialogDesc = computed(() => {
|
const dialogDesc = computed(() => {
|
||||||
if (props.mode === 'manual') return t('uploadConfirm.overviewDescManual')
|
if (props.mode === 'manual') return t('uploadConfirm.overviewDescManual')
|
||||||
|
if (props.mode === 'reparse') return t('uploadConfirm.overviewDescReparse')
|
||||||
return t('uploadConfirm.overviewDesc')
|
return t('uploadConfirm.overviewDesc')
|
||||||
})
|
})
|
||||||
|
|
||||||
const confirmButtonText = computed(() => {
|
const confirmButtonText = computed(() => {
|
||||||
if (props.mode === 'manual') return t('uploadConfirm.confirmManual')
|
if (props.mode === 'manual') return t('uploadConfirm.confirmManual')
|
||||||
|
if (props.mode === 'reparse') return t('uploadConfirm.confirmReparse')
|
||||||
return t('uploadConfirm.confirm')
|
return t('uploadConfirm.confirm')
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -409,6 +422,10 @@ const batchFileExts = computed(() => {
|
|||||||
set.add(ext)
|
set.add(ext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (props.mode === 'reparse') {
|
||||||
|
const ext = (props.reparsePreview?.fileType || '').toLowerCase()
|
||||||
|
if (ext) set.add(ext)
|
||||||
|
}
|
||||||
for (const url of localUrls.value) {
|
for (const url of localUrls.value) {
|
||||||
const ext = getExtFromUrl(url)
|
const ext = getExtFromUrl(url)
|
||||||
if (ext) set.add(ext)
|
if (ext) set.add(ext)
|
||||||
@@ -698,6 +715,49 @@ function buildProcessOverrides(): KnowledgeProcessOverrides {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function applyOverridesToState(o?: KnowledgeProcessOverrides | null) {
|
||||||
|
if (!o) return
|
||||||
|
const s = uiState.value
|
||||||
|
const cc = o.chunking_config
|
||||||
|
if (cc) {
|
||||||
|
if (cc.chunk_size != null) s.chunkingConfig.chunkSize = cc.chunk_size
|
||||||
|
if (cc.chunk_overlap != null) s.chunkingConfig.chunkOverlap = cc.chunk_overlap
|
||||||
|
if (cc.separators) s.chunkingConfig.separators = cc.separators
|
||||||
|
if (cc.enable_parent_child != null) s.chunkingConfig.enableParentChild = cc.enable_parent_child
|
||||||
|
if (cc.parent_chunk_size != null) s.chunkingConfig.parentChunkSize = cc.parent_chunk_size
|
||||||
|
if (cc.child_chunk_size != null) s.chunkingConfig.childChunkSize = cc.child_chunk_size
|
||||||
|
if (cc.strategy != null) s.chunkingConfig.strategy = cc.strategy
|
||||||
|
if (cc.token_limit != null) s.chunkingConfig.tokenLimit = cc.token_limit
|
||||||
|
if (cc.languages) s.chunkingConfig.languages = cc.languages
|
||||||
|
if (cc.parser_engine_rules) s.chunkingConfig.parserEngineRules = cc.parser_engine_rules
|
||||||
|
}
|
||||||
|
if (o.parser_engine_rules) s.chunkingConfig.parserEngineRules = o.parser_engine_rules
|
||||||
|
if (o.enable_multimodel != null) s.multimodalConfig.enabled = o.enable_multimodel
|
||||||
|
if (o.vlm_config) {
|
||||||
|
if (o.vlm_config.enabled != null) s.multimodalConfig.enabled = o.vlm_config.enabled
|
||||||
|
if (o.vlm_config.model_id != null) s.multimodalConfig.vllmModelId = o.vlm_config.model_id
|
||||||
|
}
|
||||||
|
if (o.asr_config) {
|
||||||
|
if (o.asr_config.enabled != null) s.asrConfig.enabled = o.asr_config.enabled
|
||||||
|
if (o.asr_config.model_id != null) s.asrConfig.modelId = o.asr_config.model_id
|
||||||
|
if (o.asr_config.language != null) s.asrConfig.language = o.asr_config.language
|
||||||
|
}
|
||||||
|
const qg = o.question_generation_config
|
||||||
|
if (qg) {
|
||||||
|
if (qg.enabled != null) s.questionGenerationConfig.enabled = qg.enabled
|
||||||
|
if (qg.question_count != null) s.questionGenerationConfig.questionCount = qg.question_count
|
||||||
|
}
|
||||||
|
const ec = o.extract_config
|
||||||
|
if (ec) {
|
||||||
|
if (ec.enabled != null) s.nodeExtractConfig.enabled = ec.enabled
|
||||||
|
if (ec.text != null) s.nodeExtractConfig.text = ec.text
|
||||||
|
if (ec.tags) s.nodeExtractConfig.tags = ec.tags
|
||||||
|
if (ec.nodes) s.nodeExtractConfig.nodes = ec.nodes.map(n => ({ name: n.name, attributes: n.attributes || [] }))
|
||||||
|
if (ec.relations) s.nodeExtractConfig.relations = ec.relations
|
||||||
|
}
|
||||||
|
if (o.graph_enabled != null) s.graphEnabled = o.graph_enabled
|
||||||
|
}
|
||||||
|
|
||||||
async function loadModels() {
|
async function loadModels() {
|
||||||
try {
|
try {
|
||||||
await chatResources.ensureModels()
|
await chatResources.ensureModels()
|
||||||
@@ -714,6 +774,9 @@ watch(
|
|||||||
localFiles.value = props.mode === 'file' ? [...(props.files || [])] : []
|
localFiles.value = props.mode === 'file' ? [...(props.files || [])] : []
|
||||||
localUrls.value = props.mode === 'file' ? [...(props.urls || [])] : []
|
localUrls.value = props.mode === 'file' ? [...(props.urls || [])] : []
|
||||||
initFromKbInfo(props.kbInfo)
|
initFromKbInfo(props.kbInfo)
|
||||||
|
if (props.mode === 'reparse') {
|
||||||
|
applyOverridesToState(props.reparsePreview?.processOverrides)
|
||||||
|
}
|
||||||
activeSection.value = 'overview'
|
activeSection.value = 'overview'
|
||||||
loadModels()
|
loadModels()
|
||||||
},
|
},
|
||||||
@@ -829,6 +892,8 @@ const handleConfirm = () => {
|
|||||||
const processConfig = buildProcessOverrides()
|
const processConfig = buildProcessOverrides()
|
||||||
if (props.mode === 'manual' && props.manualPreview) {
|
if (props.mode === 'manual' && props.manualPreview) {
|
||||||
emit('confirm', { processConfig, mode: 'manual', manual: { ...props.manualPreview } })
|
emit('confirm', { processConfig, mode: 'manual', manual: { ...props.manualPreview } })
|
||||||
|
} else if (props.mode === 'reparse' && props.reparsePreview) {
|
||||||
|
emit('confirm', { processConfig, mode: 'reparse', reparse: { ...props.reparsePreview } })
|
||||||
} else {
|
} else {
|
||||||
emit('confirm', {
|
emit('confirm', {
|
||||||
processConfig,
|
processConfig,
|
||||||
|
|||||||
@@ -1947,7 +1947,11 @@ func (s *knowledgeService) generateQuestionsWithContext(ctx context.Context,
|
|||||||
|
|
||||||
// ReparseKnowledge deletes existing document content and re-parses the knowledge asynchronously.
|
// ReparseKnowledge deletes existing document content and re-parses the knowledge asynchronously.
|
||||||
// This method reuses the logic from UpdateManualKnowledge for resource cleanup and async parsing.
|
// This method reuses the logic from UpdateManualKnowledge for resource cleanup and async parsing.
|
||||||
func (s *knowledgeService) ReparseKnowledge(ctx context.Context, knowledgeID string) (*types.Knowledge, error) {
|
func (s *knowledgeService) ReparseKnowledge(
|
||||||
|
ctx context.Context,
|
||||||
|
knowledgeID string,
|
||||||
|
processOverrides *types.KnowledgeProcessOverrides,
|
||||||
|
) (*types.Knowledge, error) {
|
||||||
logger.Info(ctx, "Start re-parsing knowledge")
|
logger.Info(ctx, "Start re-parsing knowledge")
|
||||||
|
|
||||||
tenantID := ctx.Value(types.TenantIDContextKey).(uint64)
|
tenantID := ctx.Value(types.TenantIDContextKey).(uint64)
|
||||||
@@ -1977,7 +1981,25 @@ func (s *knowledgeService) ReparseKnowledge(ctx context.Context, knowledgeID str
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
processOverrides, _ := existing.ProcessOverrides()
|
// When the caller supplies new overrides (e.g. via the reparse confirm
|
||||||
|
// dialog), validate them against this knowledge's file type, then persist
|
||||||
|
// to metadata so both this call's enqueue and the worker re-read the same
|
||||||
|
// config. nil keeps whatever was stored at upload time.
|
||||||
|
if processOverrides != nil {
|
||||||
|
if err := ValidateProcessOverrides(ctx, kb, processOverrides, reparseFileTypes(existing)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := existing.SetProcessOverrides(processOverrides); err != nil {
|
||||||
|
logger.Errorf(ctx, "Failed to set process overrides on reparse: %v", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := s.repo.UpdateKnowledgeColumn(ctx, existing.ID, "metadata", existing.Metadata); err != nil {
|
||||||
|
logger.Errorf(ctx, "Failed to persist process overrides on reparse: %v", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processOverrides, _ = existing.ProcessOverrides()
|
||||||
reparseEff := ResolveProcessConfig(kb, processOverrides)
|
reparseEff := ResolveProcessConfig(kb, processOverrides)
|
||||||
|
|
||||||
// Keep wiki's pending queue consistent across both manual and non-manual
|
// Keep wiki's pending queue consistent across both manual and non-manual
|
||||||
|
|||||||
@@ -121,6 +121,25 @@ func ApplyKnowledgeProcessOverrides(
|
|||||||
return eff, nil
|
return eff, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reparseFileTypes derives the file types used to validate overrides on reparse.
|
||||||
|
// Manual knowledge has no file; URL imports validate as html.
|
||||||
|
func reparseFileTypes(k *types.Knowledge) []string {
|
||||||
|
if k == nil || k.IsManual() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if k.Type == "url" {
|
||||||
|
return []string{"html"}
|
||||||
|
}
|
||||||
|
ft := k.FileType
|
||||||
|
if ft == "" && k.FileName != "" {
|
||||||
|
ft = getFileType(k.FileName)
|
||||||
|
}
|
||||||
|
if ft == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return []string{ft}
|
||||||
|
}
|
||||||
|
|
||||||
func defaultQuestionGenerationConfig(kb *types.KnowledgeBase) types.QuestionGenerationConfig {
|
func defaultQuestionGenerationConfig(kb *types.KnowledgeBase) types.QuestionGenerationConfig {
|
||||||
if kb == nil || kb.QuestionGenerationConfig == nil {
|
if kb == nil || kb.QuestionGenerationConfig == nil {
|
||||||
return types.QuestionGenerationConfig{}
|
return types.QuestionGenerationConfig{}
|
||||||
|
|||||||
@@ -1557,6 +1557,7 @@ func (h *KnowledgeHandler) UpdateManualKnowledge(c *gin.Context) {
|
|||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param id path string true "知识ID"
|
// @Param id path string true "知识ID"
|
||||||
|
// @Param body body object false "可选的处理配置覆盖:{\"process_config\": KnowledgeProcessOverrides}"
|
||||||
// @Success 200 {object} map[string]interface{} "重新解析任务已提交"
|
// @Success 200 {object} map[string]interface{} "重新解析任务已提交"
|
||||||
// @Failure 400 {object} errors.AppError "请求参数错误"
|
// @Failure 400 {object} errors.AppError "请求参数错误"
|
||||||
// @Failure 403 {object} errors.AppError "权限不足"
|
// @Failure 403 {object} errors.AppError "权限不足"
|
||||||
@@ -1581,8 +1582,23 @@ func (h *KnowledgeHandler) ReparseKnowledge(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Optional per-reparse parse config override. Empty body keeps the
|
||||||
|
// overrides stored at upload time.
|
||||||
|
var processOverrides *types.KnowledgeProcessOverrides
|
||||||
|
if c.Request.ContentLength != 0 {
|
||||||
|
var req struct {
|
||||||
|
ProcessConfig *types.KnowledgeProcessOverrides `json:"process_config"`
|
||||||
|
}
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
logger.Error(ctx, "Failed to parse reparse request body", err)
|
||||||
|
c.Error(errors.NewBadRequestError("Invalid reparse request body").WithDetails(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
processOverrides = req.ProcessConfig
|
||||||
|
}
|
||||||
|
|
||||||
// Call service to reparse knowledge
|
// Call service to reparse knowledge
|
||||||
knowledge, err := h.kgService.ReparseKnowledge(effCtx, id)
|
knowledge, err := h.kgService.ReparseKnowledge(effCtx, id, processOverrides)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if appErr, ok := errors.IsAppError(err); ok {
|
if appErr, ok := errors.IsAppError(err); ok {
|
||||||
c.Error(appErr)
|
c.Error(appErr)
|
||||||
|
|||||||
@@ -96,7 +96,13 @@ type KnowledgeService interface {
|
|||||||
payload *types.ManualKnowledgePayload,
|
payload *types.ManualKnowledgePayload,
|
||||||
) (*types.Knowledge, error)
|
) (*types.Knowledge, error)
|
||||||
// ReparseKnowledge deletes existing document content and re-parses the knowledge asynchronously.
|
// ReparseKnowledge deletes existing document content and re-parses the knowledge asynchronously.
|
||||||
ReparseKnowledge(ctx context.Context, knowledgeID string) (*types.Knowledge, error)
|
// When processOverrides is non-nil, it is validated and persisted to the knowledge metadata
|
||||||
|
// before re-parsing, letting callers adjust parse config on reparse; nil keeps stored overrides.
|
||||||
|
ReparseKnowledge(
|
||||||
|
ctx context.Context,
|
||||||
|
knowledgeID string,
|
||||||
|
processOverrides *types.KnowledgeProcessOverrides,
|
||||||
|
) (*types.Knowledge, error)
|
||||||
// CancelKnowledgeParse marks an in-progress parse as cancelled by the
|
// CancelKnowledgeParse marks an in-progress parse as cancelled by the
|
||||||
// user. The knowledge row and any partially written chunks/index are
|
// user. The knowledge row and any partially written chunks/index are
|
||||||
// kept; downstream queued tasks for the same knowledge are best-effort
|
// kept; downstream queued tasks for the same knowledge are best-effort
|
||||||
|
|||||||
Reference in New Issue
Block a user