Skip to content

feat(discovery): Add Hugging Face Hub discovery filters for Video and Audio models - #18

Closed
spelech wants to merge 2 commits into
mainfrom
feat/discovery-filters-video-audio-12295208130764334231
Closed

feat(discovery): Add Hugging Face Hub discovery filters for Video and Audio models#18
spelech wants to merge 2 commits into
mainfrom
feat/discovery-filters-video-audio-12295208130764334231

Conversation

@spelech

@spelech spelech commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Extended model hub discovery in Hugging Face Hub and Civitai proxy endpoints and search services to filter, search, and route download weights for Video (Wan, LTX, HunyuanVideo), Audio/TTS (Kokoro, F5-TTS, Stable Audio), 3D Mesh, and GGUF models. Added category filter bar buttons to HuggingFaceTabControl.axaml and unit tests.

Fixes #13


PR created automatically by Jules for task 12295208130764334231 started by @spelech

… Audio models

- Update IHuggingFaceSearchService and HuggingFaceSearchService to support pipelineTag parameter and SearchModelsAsync.
- Update ModelProxyEndpoints GET /api/hf/search to pass pipeline_tag to Hugging Face API and add streaming download endpoints.
- Add DownloadManager with ResolveTargetDirectory to route video models (ComfyUI/models/diffusion_models), TTS/audio models (models/tts), 3D models (models/3d), LORA (models/Lora), and checkpoints.
- Update HuggingFaceSearchViewModel and HuggingFaceTabControl with category filter buttons ([All], [LLM (GGUF)], [Video], [Speech/TTS], [Music/SFX], [3D Mesh]).
- Add unit tests verifying pipelineTag search and DownloadManager target directory routing.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@spelech

spelech commented Aug 24, 2026

Copy link
Copy Markdown
Owner Author

🔍 Pull Request Review: PR #18 - Hugging Face Hub Discovery Filters for Video and Audio Models

🌟 Overall Verdict: APPROVED WITH SUGGESTIONS / NITPICKS (APPROVED_WITH_NITPICKS)

The implementation cleanly fulfills the requirements of Issue #13 by introducing pipeline tag filtering for Hugging Face Hub searches, category chips in the Avalonia UI, directory resolution in DownloadManager, and proxy endpoints for downloading model weights.


🚀 Key Strengths & Highlights

  1. Clean Architectural Alignment:
    • DownloadManager.ResolveTargetDirectory provides clear, deterministic mapping for video diffusion models (ComfyUI/models/diffusion_models), audio/TTS (models/tts), 3D assets (models/3d), and LoRAs (models/Lora).
    • Default Interface Method (DIM) in IHuggingFaceSearchService ensures backwards compatibility for existing callers of SearchRepositoriesAsync(apiBase, query, http).
  2. UI & UX Quality:
    • The segmented category pills in HuggingFaceTabControl.axaml (All, LLM (GGUF), Video, Speech/TTS, Music/SFX, 3D Mesh) integrate naturally with the Matte design system.
    • Dynamic tag badge in the search result cards (IsVisible="{Binding PipelineTag, Converter={x:Static StringConverters.IsNotNullOrEmpty}}") provides clear model metadata at a glance.
  3. Comprehensive Unit Tests:
    • Theory unit tests in SearchServicesTests.cs validate multiple directory routing scenarios across model categories and file name hints.

⚠️ Findings & Recommendations

1. 🛑 Download Timeout Too Short for Model Weights (Endpoints/ModelProxyEndpoints.cs:100, 126)

  • Issue: Both /api/civitai/download and /api/hf/download configure a 30-second cancellation token timeout:
    using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
  • Risk: Video (Wan 2.2, LTX-Video: 5–20 GB) and checkpoint weights are gigabytes in size. 30 seconds is insufficient for transferring multi-gigabyte models and will cause downloads to abort with TaskCanceledException / OperationCanceledException.
  • Recommendation: Pass HttpContext.RequestAborted or configure a generous timeout (e.g. TimeSpan.FromHours(2) / Timeout.InfiniteTimeSpan):
    // Suggested:
    using var response = await httpClient.GetAsync(fileUrl, HttpCompletionOption.ResponseHeadersRead, httpContext.RequestAborted);

2. 🔒 Path Traversal / File Name Sanitization (Endpoints/ModelProxyEndpoints.cs:95, 121)

  • Issue:
    var safeFileName = string.IsNullOrWhiteSpace(fileName) ? "model.safetensors" : fileName;
    var targetPath = Path.Combine(targetDir, safeFileName);
  • Risk: If fileName contains relative path sequences (e.g., ../../target), Path.Combine allows path traversal outside the intended directory.
  • Recommendation: Strip directory parts using Path.GetFileName:
    var rawFileName = string.IsNullOrWhiteSpace(fileName) ? "model.safetensors" : fileName;
    var safeFileName = Path.GetFileName(rawFileName);

3. 🌐 HttpClient Lifecycle in HuggingFaceSearchService.SearchModelsAsync

  • Issue: SearchModelsAsync instantiates a new HttpClient with using var http = new HttpClient(); on each search call instead of utilizing IHttpClientFactory or a shared client.
  • Recommendation: Consider injecting IHttpClientFactory or passing an HttpClient instance to prevent socket exhaustion under high request volume.

4. 🦙 GGUF Filter Handling in Direct SearchModelsAsync

  • Observation: ModelProxyEndpoints.cs maps pipeline_tag == "gguf" to &filter=gguf because Hugging Face classifies GGUF as a library filter rather than a pipeline tag. In HuggingFaceSearchService.SearchModelsAsync, passing pipelineTag: "gguf" directly queries &pipeline_tag=gguf.
  • Recommendation: Align SearchModelsAsync so pipelineTag.Equals("gguf", StringComparison.OrdinalIgnoreCase) converts to filter=gguf.

5. 🎨 Active State Visual Indication on Category Pills

  • Observation: Category buttons in HuggingFaceTabControl.axaml execute SelectCategoryCommand, but do not visually indicate which category is currently active.
  • Suggestion (Future Enhancement): Adding a subtle visual active state (such as accent background or border when SelectedPipelineTag matches the button parameter) would improve UX clarity.

📊 Summary Checklist

  • IHuggingFaceSearchService pipeline tag parameter support
  • ModelProxyEndpoints query handling (&pipeline_tag=)
  • HuggingFaceTabControl.axaml category chips and tag badge
  • DownloadManager model routing
  • Unit tests passing

… Audio models

- Update IHuggingFaceSearchService and HuggingFaceSearchService to support pipelineTag parameter and SearchModelsAsync.
- Update ModelProxyEndpoints GET /api/hf/search to pass pipeline_tag to Hugging Face API and add streaming download endpoints.
- Add DownloadManager with ResolveTargetDirectory to route video models (ComfyUI/models/diffusion_models), TTS/audio models (models/tts), 3D models (models/3d), LORA (models/Lora), and checkpoints.
- Update HuggingFaceSearchViewModel and HuggingFaceTabControl with category filter buttons ([All], [LLM (GGUF)], [Video], [Speech/TTS], [Music/SFX], [3D Mesh]).
- Add unit tests verifying pipelineTag search and DownloadManager target directory routing.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@spelech

spelech commented Aug 24, 2026

Copy link
Copy Markdown
Owner Author

Integrated and merged into main as part of release v3.7.0.

@spelech spelech closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(discovery): Add Hugging Face Hub discovery filters for Video and Audio models

1 participant