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.
Summary
Extract demo local-folder model handling out of
examples/demo/src/App.jsxinto focused helpers.Why
The hub-backed model-loading path already has shared modules, but the local-folder path still leaves
App.jsxresponsible 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
examples/demo.Proposed Extraction
localModelStoragehelper for IndexedDB persistence/restore/clear and capability checks.localModelArtifactshelper for folder scan results, artifact detection, and option derivation.localModelUrlsor equivalent helper for local blob URL/config assembly.Acceptance Criteria
master.examples/demo/src/App.jsxloses the bulk of local-model orchestration code.npm teststill passes.examples/demostill builds successfully.