Skip to content

Commit e63c1db

Browse files
committed
chore: add PR body file
1 parent 3992785 commit e63c1db

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

pr-body.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Summary
2+
3+
This PR refactors the HuggingFace provider implementation to match the established pattern used by other providers that fetch models via network calls (e.g., OpenRouter, Glama, Ollama).
4+
5+
## Changes
6+
7+
- **Moved fetcher to correct location**: Moved `huggingface-models.ts` from `src/services/` to `src/api/providers/fetchers/huggingface.ts`
8+
- **Updated fetcher to return ModelInfo**: The fetcher now returns `Record<string, ModelInfo>` instead of raw HuggingFace model data, consistent with other providers
9+
- **Integrated with model cache**: Added HuggingFace to `RouterName` type and integrated it with the `modelCache.ts` system for memory and file caching
10+
- **Updated provider to extend RouterProvider**: The HuggingFace provider now extends the `RouterProvider` base class and uses the `fetchModel()` pattern
11+
- **Removed unnecessary wrapper**: Deleted `src/api/huggingface-models.ts` as it's no longer needed
12+
- **Updated webview integration**: Modified `webviewMessageHandler.ts` to use the new pattern with `getModels()` while maintaining backward compatibility
13+
14+
## Benefits
15+
16+
1. **Consistency**: HuggingFace now follows the same pattern as other providers
17+
2. **Caching**: Model lists are now cached in memory and on disk
18+
3. **Maintainability**: Easier to understand and modify when all providers follow the same pattern
19+
4. **Type safety**: Better integration with TypeScript types
20+
21+
## Testing
22+
23+
- ✅ All existing tests pass
24+
- ✅ TypeScript compilation successful
25+
- ✅ Linting checks pass
26+
- ✅ Added HuggingFace to RouterModels mock in webview tests

0 commit comments

Comments
 (0)