fix(skiva-1): spara accept, bildref, lokal träningsbank, lärande-loop-dok
- confirm-loop sparar nu även action=accept som positivt exempel i ai_corrections - imageS3Key sparas vid image_training-samtycke, annars null - ai_corrections.proposal lagrar det specifika AI-förslaget per item - BUILD_TRAINING_SAMPLE bankar lokalt till ai_training_bank (ej externt runTask) - Jobbet kastar aldrig i AAMOS_MODE=gemini - Migration 0020: ai_corrections.image_s3_key/proposal + ai_training_bank - docs/28-lärande-loop.md: datakontrakt, samtycke, retention, GDPR-radering - Tester: accept + bildref (ja/nej) + lokal bank i gemini-läge - REQUIRE_REAL=1 är AI-fokuserat i gemini-läge; staging mail/S3 får vara mock
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
-- Extend ai_corrections with image reference and add a local, versioned training bank.
|
||||
-- BUILD_TRAINING_SAMPLE banks here instead of calling external AAMOS/Gemini runTask.
|
||||
|
||||
ALTER TABLE ai_corrections
|
||||
ADD COLUMN image_s3_key TEXT,
|
||||
ADD COLUMN proposal JSONB;
|
||||
|
||||
CREATE TABLE ai_training_bank (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
correction_id UUID NOT NULL REFERENCES ai_corrections(id) ON DELETE CASCADE,
|
||||
scan_job_id UUID REFERENCES scan_jobs(id) ON DELETE SET NULL,
|
||||
version TEXT NOT NULL DEFAULT 'v1',
|
||||
task_type TEXT NOT NULL,
|
||||
image_s3_key TEXT,
|
||||
proposal JSONB NOT NULL,
|
||||
action TEXT NOT NULL,
|
||||
corrected JSONB,
|
||||
model_version TEXT,
|
||||
prompt_version TEXT,
|
||||
consent_snapshot JSONB NOT NULL DEFAULT '{}',
|
||||
exported_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX ai_training_bank_version_idx ON ai_training_bank(version, task_type);
|
||||
CREATE INDEX ai_training_bank_scan_job_idx ON ai_training_bank(scan_job_id);
|
||||
CREATE INDEX ai_training_bank_created_at_idx ON ai_training_bank(created_at);
|
||||
@@ -134,6 +134,13 @@
|
||||
"when": 1786141200000,
|
||||
"tag": "0019_ai_usage_cost_usd",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 19,
|
||||
"version": "7",
|
||||
"when": 1786144800000,
|
||||
"tag": "0020_ai_corrections_training_bank",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user