Files
FabledCurator/frontend/src/stores/ml.js
T
bvandeusen 359bc5a283
CI / lint (push) Successful in 2s
CI / frontend-build (push) Successful in 21s
CI / backend-lint-and-test (push) Successful in 27s
CI / integration (push) Successful in 3m25s
feat(ml): default to SigLIP 2 (new installs) + model dropdown, no free-text (#1203)
- Migration 0069: new installs default to SigLIP 2 (so400m, 512px, 1152-d drop-in)
  — UPDATE applies ONLY where no image is embedded yet (fresh install), so an
  existing library is NOT silently invalidated; it switches deliberately via the
  dropdown → Re-embed → Retrain. Column server_defaults moved to SigLIP 2.
- GET /api/ml/embedder-models: server-authoritative supported list (SigLIP 2 512
  recommended / 384 faster / SigLIP 1 384 original) so the UI never free-types.
- GpuAgentCard: the two name/version text fields → a single model dropdown;
  Save sets name+version from the picked option (the current model is always
  selectable even if off-list).
- embedder.py DEFAULT_MODEL_NAME unchanged (stays the baked local-dir SigLIP 1)
  to avoid a local-dir/weights mismatch; SigLIP 2 loads by HF name, cached on the
  ml-worker's persistent HF_HOME.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ttrj5P7upUTueSfoJcxEqa
2026-06-30 16:29:27 -04:00

36 lines
1001 B
JavaScript

import { defineStore } from 'pinia'
import { ref } from 'vue'
import { useApi } from '../composables/useApi.js'
import { useAsyncAction } from '../composables/useAsyncAction.js'
export const useMLStore = defineStore('ml', () => {
const api = useApi()
const settings = ref(null)
const { loading, error, run } = useAsyncAction({ errorAs: 'message' })
async function loadSettings() {
await run(async () => {
settings.value = await api.get('/api/ml/settings')
})
}
async function patchSettings(patch) {
settings.value = await api.patch('/api/ml/settings', { body: patch })
}
async function triggerBackfill() {
await api.post('/api/ml/backfill')
}
// Server-authoritative list of supported embedders for the model dropdown.
async function embedderModels() {
const r = await api.get('/api/ml/embedder-models')
return r.models || []
}
return {
settings, loading, error,
loadSettings, patchSettings, triggerBackfill, embedderModels
}
})