- Fix Rust model scan to only list top-level models (not subdirectories) - Add scan_model_dir_top_level() function in model_files.rs - Create ModelSelectorPill component for chat input area - Remove model-section from Sidebar, move to ChatView - Update ChatView props to receive model-related props - Update tests for new ChatView props
41 lines
1.6 KiB
Markdown
41 lines
1.6 KiB
Markdown
# Task 1 Summary: Fix Rust model scan to top-level only
|
|
|
|
**Status:** ✅ Complete
|
|
**Files Modified:**
|
|
- `tauri-app/src-tauri/src/model_files.rs`
|
|
|
|
## Changes Made
|
|
|
|
### 1. Added `scan_model_dir_top_level` function (lines 46-71)
|
|
A new function that scans only the immediate children of a directory (depth=1), returning only `.gguf` files without recursing into subdirectories.
|
|
|
|
### 2. Updated `scan_model_dir` to use top-level scan (lines 31-44)
|
|
Changed from calling `scan_model_dir_recursive` to calling `scan_model_dir_top_level` as the default behavior.
|
|
|
|
### 3. Kept `scan_model_dir_recursive` for future use (lines 73-97)
|
|
The recursive function is preserved with `#[allow(dead_code)]` annotation for potential future use cases.
|
|
|
|
### 4. Updated tests
|
|
- Renamed `scan_model_dir_finds_gguf_in_subdirectories` to `scan_model_dir_returns_only_top_level_gguf`
|
|
- Updated assertion to expect only top-level models
|
|
- Added new test `scan_model_dir_recursive_finds_nested_gguf` to verify the recursive function still works
|
|
|
|
## Verification
|
|
|
|
```bash
|
|
cd tauri-app/src-tauri && cargo test scan_model
|
|
```
|
|
|
|
All 5 tests pass:
|
|
- `scan_model_dir_filters_and_sorts_gguf_files` ✅
|
|
- `scan_model_dir_ignores_directories_named_like_models` ✅
|
|
- `scan_model_dir_skips_hidden_directories` ✅
|
|
- `scan_model_dir_recursive_finds_nested_gguf` ✅
|
|
- `scan_model_dir_returns_only_top_level_gguf` ✅
|
|
|
|
## Success Criteria Met
|
|
|
|
- ✅ `scan_models` Tauri command returns only `.gguf` files in the immediate directory
|
|
- ✅ Nested models in subdirectories are excluded from default scan
|
|
- ✅ Recursive scan function remains available for future use
|
|
- ✅ All existing tests continue to pass |