6cf82970a1
Thin wrappers over the FC-2b API: ml (settings GET/PATCH, backfill + recompute triggers), allowlist (list, threshold patch, remove with optimistic local update), aliases (list, remove with optimistic update). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
951 B
JavaScript
40 lines
951 B
JavaScript
import { defineStore } from 'pinia'
|
|
import { ref } from 'vue'
|
|
import { useApi } from '../composables/useApi.js'
|
|
|
|
export const useMLStore = defineStore('ml', () => {
|
|
const api = useApi()
|
|
const settings = ref(null)
|
|
const loading = ref(false)
|
|
const error = ref(null)
|
|
|
|
async function loadSettings() {
|
|
loading.value = true
|
|
error.value = null
|
|
try {
|
|
settings.value = await api.get('/api/ml/settings')
|
|
} catch (e) {
|
|
error.value = e.message
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
async function patchSettings(patch) {
|
|
settings.value = await api.patch('/api/ml/settings', { body: patch })
|
|
}
|
|
|
|
async function triggerBackfill() {
|
|
await api.post('/api/ml/backfill')
|
|
}
|
|
|
|
async function triggerRecomputeCentroids() {
|
|
await api.post('/api/ml/recompute-centroids')
|
|
}
|
|
|
|
return {
|
|
settings, loading, error,
|
|
loadSettings, patchSettings, triggerBackfill, triggerRecomputeCentroids
|
|
}
|
|
})
|