Skip to content

Extract demo local-folder model handling out of App.jsx #97

@ysdede

Description

@ysdede

Summary

Extract demo local-folder model handling out of examples/demo/src/App.jsx into focused helpers.

Why

The hub-backed model-loading path already has shared modules, but the local-folder path still leaves App.jsx responsible for IndexedDB handle persistence, folder traversal, artifact detection, tokenizer/preprocessor selection, and local URL/config assembly. That keeps the biggest block of non-UI logic in the component.

Scope

  • Focus only on local-folder model support in examples/demo.
  • Preserve the current UX and diagnostics.
  • Keep the refactor incremental; avoid mixing unrelated UI cleanup.

Proposed Extraction

  • localModelStorage helper for IndexedDB persistence/restore/clear and capability checks.
  • localModelArtifacts helper for folder scan results, artifact detection, and option derivation.
  • localModelUrls or equivalent helper for local blob URL/config assembly.

Acceptance Criteria

  • Local-folder behavior matches current master.
  • Persisted directory reconnect flow still works.
  • Artifact detection and logging stay unchanged.
  • examples/demo/src/App.jsx loses the bulk of local-model orchestration code.
  • npm test still passes.
  • examples/demo still builds successfully.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions