feat(enhance): config, templates, ComfyUI client, jobs, endpoints (#192)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cameron CordesandClaude Opus 5.5 authored and cameron committed 2026-10-30 19:41:05 +00:00
1 parent 21920e8608
commit 3a21761cfe
19 files changed
+3912

No files matched your search

@@ -0,0 +1 @@
DROP TABLE IF EXISTS enhance_jobs;
@@ -0,0 +1,31 @@
-- Enhance on demand (#192): one row per ComfyUI run submitted for a photo.
--
-- Keyed to the photo by `original_hash` (the blake3 content_hash of the file
-- that was submitted), like every other derived table, so a job survives a
-- rename or move; `library_id` + `rel_path` say which file it was at submit
-- time (and are what the API echoes back as `path`).
CREATE TABLE enhance_jobs (
id TEXT PRIMARY KEY NOT NULL, -- uuid, ImageApi's own
original_hash TEXT NOT NULL,
library_id INTEGER NOT NULL,
rel_path TEXT NOT NULL,
template TEXT NOT NULL,
prompt TEXT,
reference_hash TEXT,
reference_path TEXT, -- library-relative, same library
comfy_prompt_id TEXT NOT NULL,
-- queued | running | ready | approved | failed | expired | unavailable
status TEXT NOT NULL,
error TEXT,
queue_position INTEGER,
-- json: [{id, view: {filename, subfolder, type}}], ComfyUI's staged results
pending TEXT NOT NULL DEFAULT '[]',
-- json: [{n, comfy_path, library_id, rel_path}], approved results
saved TEXT NOT NULL DEFAULT '[]',
-- 1 = the user threw the result away; hidden from the per-photo list
discarded INTEGER NOT NULL DEFAULT 0,
created_at BIGINT NOT NULL,
updated_at BIGINT NOT NULL
);
CREATE INDEX idx_enhance_jobs_hash ON enhance_jobs(original_hash, created_at);
CREATE INDEX idx_enhance_jobs_status ON enhance_jobs(status);