Files
FabledCurator/frontend/src/stores/gpu.js
T
bvandeusen 80f8eb4756
CI / lint (push) Successful in 3s
CI / frontend-build (push) Successful in 19s
CI / backend-lint-and-test (push) Successful in 27s
CI / integration (push) Successful in 3m25s
feat(gpu): re-process trigger to apply new crop detectors to the existing library (#1202)
The siglip/ccip backfills skip images that already have current-version regions,
so adding crop detectors only affected NEW images — the back-catalogue would
never be re-cropped. Add a reprocess trigger that resets every done/error job of
a task back to pending, so the agent re-runs the FULL pipeline (figure detection
+ CCIP + concept/panel crops) over the whole library under the current detectors.

- reprocess_gpu_jobs(task='ccip') task + POST /api/gpu/reprocess.
- gpu store reprocess() + GpuAgentCard "Re-process library (re-detect + re-crop)"
  button with a confirm (it's heavy).
- Test: a done job resets to pending (attempts cleared).

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

40 lines
1.3 KiB
JavaScript

import { defineStore } from 'pinia'
import { useApi } from '../composables/useApi.js'
// GPU agent control surface (#114): the FC-side admin for the desktop agent —
// the bearer token it authenticates with, the job-queue depth, and the backfill
// trigger. The agent itself talks to /api/gpu/jobs/* over HTTP; nothing here
// touches Redis/Postgres directly.
export const useGpuStore = defineStore('gpu', () => {
const api = useApi()
// { token: <string|null>, configured: bool }
async function token() {
return await api.get('/api/gpu/token')
}
// Generate a fresh token (invalidates the old one). Returns { token }.
async function rotateToken() {
return await api.post('/api/gpu/token/rotate')
}
// { pending, leased, done, error }
async function status() {
return await api.get('/api/gpu/status')
}
// Enqueue a job per image lacking one for `task` (the agent drains it).
async function backfill(task = 'ccip') {
return await api.post('/api/gpu/backfill', { body: { task } })
}
// Reset every done/error `task` job to pending → re-run the WHOLE library
// under the current pipeline (e.g. after adding crop detectors).
async function reprocess(task = 'ccip') {
return await api.post('/api/gpu/reprocess', { body: { task } })
}
return { token, rotateToken, status, backfill, reprocess }
})