fix(web): align Go chunk method dropdown order with Python parser_ids (#18127)

This commit is contained in:
euvre
2026-08-11 23:54:20 -07:00
committed by GitHub
parent 70485d7ad0
commit 49646da32d

View File

@@ -194,7 +194,36 @@ export const useSelectParserList = (): Array<{
const translated = t(key);
return translated !== key ? translated : title;
};
return pipelineList.map((item) => ({
// Order the Go pipeline catalog the same way as the Python
// backend's parser_ids (settings.PARSERS), so the chunk-method
// dropdown lists commonly used methods first. The Python "naive"
// slot corresponds to the Go "general" pipeline. Go-only pipelines
// (e.g. knowledge_compiler) keep their API order at the end.
const pythonParserOrder = [
'general', // "naive" in Python parser_ids
'qa',
'resume',
'manual',
'table',
'paper',
'book',
'laws',
'presentation',
'picture',
'one',
'audio',
'email',
'tag',
];
const order = new Map(
pythonParserOrder.map((id, index) => [id, index]),
);
const sortedList = [...pipelineList].sort(
(a, b) =>
(order.get(a.id) ?? pythonParserOrder.length) -
(order.get(b.id) ?? pythonParserOrder.length),
);
return sortedList.map((item) => ({
value: item.id,
label: labelFromAPI(item.id, item.title),
}));