From 97979d9e7c53c067c9d9912a3bd9bf4bccf7bd9d Mon Sep 17 00:00:00 2001 From: Will Miao Date: Mon, 9 Mar 2026 15:49:37 +0800 Subject: [PATCH] fix(send-to-workflow): strip file extension before searching relative paths Backend _relative_path_matches_tokens() removes extensions from paths before matching (commit 43f6bfab). This fix ensures frontend also removes extensions from search terms to avoid matching failures. Fixes issue where send model to workflow would receive absolute paths instead of relative paths because the API returned empty results when searching with file extension. --- static/js/utils/uiHelpers.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/js/utils/uiHelpers.js b/static/js/utils/uiHelpers.js index 84b6ea54..3dc54ff1 100644 --- a/static/js/utils/uiHelpers.js +++ b/static/js/utils/uiHelpers.js @@ -483,8 +483,12 @@ async function ensureRelativeModelPath(modelPath, collectionType) { return modelPath; } + // Remove model file extension (.safetensors, .ckpt, .pt, .bin) for cleaner matching + // Backend removes extensions from paths before matching, so search term should not include extension + const searchTerm = fileName.replace(/\.(safetensors|ckpt|pt|bin)$/i, ''); + try { - const response = await fetch(`/api/lm/${collectionType}/relative-paths?search=${encodeURIComponent(fileName)}&limit=10`); + const response = await fetch(`/api/lm/${collectionType}/relative-paths?search=${encodeURIComponent(searchTerm)}&limit=10`); if (!response.ok) { return modelPath; }