fix: call find_model_files() with source_pattern instead of empty filter
The previous fix still called find_model_files() with empty filter, which doesn't work. Now we call find_model_files() for EACH file mapping individually, passing the source_pattern as the filter. This eliminates the "No files matched filter (filter: )" warnings and allows the script to properly find and link downloaded models. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -613,24 +613,15 @@ link_model() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Find all model files in cache (no filter needed, we have explicit paths)
|
||||
local model_files
|
||||
model_files=$(find_model_files "$repo_id" "")
|
||||
|
||||
if [[ -z "$model_files" ]]; then
|
||||
print_warning "No model files found in cache for ${repo_id}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Process each file mapping
|
||||
# Process each file mapping - find each file individually by its pattern
|
||||
while IFS='|' read -r source_pattern dest_path; do
|
||||
if [[ -z "$source_pattern" ]] || [[ -z "$dest_path" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Find the file matching the source pattern in model_files
|
||||
# Find the specific file using its source pattern as filter
|
||||
local source_file
|
||||
source_file=$(echo "$model_files" | grep -F "/$source_pattern" | head -n1)
|
||||
source_file=$(find_model_files "$repo_id" "$source_pattern" 2>/dev/null | head -n1)
|
||||
|
||||
if [[ -z "$source_file" ]] || [[ ! -f "$source_file" ]]; then
|
||||
print_warning "Source file not found: ${source_pattern}"
|
||||
@@ -1061,15 +1052,7 @@ verify_model_links() {
|
||||
|
||||
# Check if explicit file mappings exist
|
||||
if [[ -n "$file_mappings" ]]; then
|
||||
# Verify files exist in cache (no filter needed)
|
||||
local model_files
|
||||
model_files=$(find_model_files "$repo_id" "" 2>/dev/null)
|
||||
|
||||
if [[ -z "$model_files" ]]; then
|
||||
echo "NOT_DOWNLOADED|0|0|0"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Process each file mapping to verify links
|
||||
while IFS='|' read -r source_pattern dest_path; do
|
||||
if [[ -z "$source_pattern" ]] || [[ -z "$dest_path" ]]; then
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user