From 49646da32db50ff6dd9399b3cd06732c56a845b1 Mon Sep 17 00:00:00 2001 From: euvre <93761161+euvre@users.noreply.github.com> Date: Tue, 11 Aug 2026 23:54:20 -0700 Subject: [PATCH] fix(web): align Go chunk method dropdown order with Python parser_ids (#18127) --- web/src/hooks/use-user-setting-request.tsx | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/web/src/hooks/use-user-setting-request.tsx b/web/src/hooks/use-user-setting-request.tsx index 20a59747e6..66ffd61fe9 100644 --- a/web/src/hooks/use-user-setting-request.tsx +++ b/web/src/hooks/use-user-setting-request.tsx @@ -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), }));