|
Download plans/2025-04-16-model-selection-command.md from SaylorTwift/forgecode: direct link, hf CLI and curl.
- Browser
- Download file 1.94 kB
-
https://huggingface.co/SaylorTwift/forgecode/resolve/main/plans/2025-04-16-model-selection-command.md
- Command line
-
hf download hf://SaylorTwift/forgecode/plans/2025-04-16-model-selection-command.md
-
curl -L -o 2025-04-16-model-selection-command.md https://huggingface.co/SaylorTwift/forgecode/resolve/main/plans/2025-04-16-model-selection-command.md
1.94 kB
Model Selection Command Implementation
Objective
Add a /model command to the Forge CLI that uses the inquire library to display a list of available models and update the project's forge.yaml file with the selected model.
Implementation Plan
- Add
inquireas a dependency to the workspace and forge_main crate - Implement a
handle_model_selection()method in the UI module to:- Fetch available models using the API
- Display a selection interface using inquire
- Update the forge.yaml file with the selected model
- Update the Command::Model match case to call the new method
Implementation Details
- Added
inquiredependency to the workspace and forge_main Cargo.toml files - Implemented a new
handle_model_selection()method in the UI module that:- Fetches the list of available models
- Uses inquire to display a selection list
- Updates the standard_model anchor in the forge.yaml file
- Updated the Command::Model case in the UI::run method to call the new method
Verification Criteria
- The
/modelcommand should display a list of available models using inquire - After selecting a model, the forge.yaml file should be updated with the selected model
- The standard_model anchor in the forge.yaml file should be created if it doesn't exist
- Appropriate error messages should be displayed if any step fails
Potential Risks and Mitigations
- Risk: Models API might return an empty list Mitigation: Added error handling for empty model lists
- Risk: forge.yaml file might not exist in the current directory Mitigation: Added error handling for missing files
- Risk: forge.yaml file might be in an unexpected format Mitigation: Added error handling for parsing errors
Future Improvements
- Add support for updating advanced_model in addition to standard_model
- Add support for creating forge.yaml if it doesn't exist
- Add ability to filter models by provider