feat(ai): add personal summary models and retire Q&A

Add an admin-managed provider model catalog with per-user summary selection, migration backfill, and generation snapshots. Retire report creation and messaging while preserving owner-scoped history.

Refs #15 #16

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 20:45:21 +01:00
parent ac17d27f51
commit 989996fbd6
53 changed files with 2228 additions and 979 deletions

View File

@ -34,11 +34,11 @@ func (safeSummarizer) Summarize(context.Context, string, []models.UserAsset, []g
func TestGenerationSucceedsWithoutArticleTablesAndRollsBackSummaryPostgres(t *testing.T) {
db, _ := ticket7DB(t)
for _, statement := range []string{
`CREATE TABLE users(id UUID PRIMARY KEY,language TEXT DEFAULT 'fr',ranking_mode TEXT DEFAULT 'title')`,
`CREATE TABLE users(id UUID PRIMARY KEY,language TEXT DEFAULT 'fr',ranking_mode TEXT DEFAULT 'title',summary_model_id UUID NULL)`,
`CREATE TABLE user_assets(id UUID PRIMARY KEY,user_id UUID,symbol TEXT,name TEXT,figi TEXT NULL,created_at TIMESTAMPTZ DEFAULT NOW())`,
`CREATE TABLE sources(id UUID PRIMARY KEY,name TEXT,type TEXT,enabled BOOLEAN,article_limit INTEGER DEFAULT 20,source_key TEXT,created_at TIMESTAMPTZ DEFAULT NOW())`,
`CREATE TABLE settings(key TEXT PRIMARY KEY,value TEXT)`,
`CREATE TABLE summaries(id UUID PRIMARY KEY,user_id UUID REFERENCES users(id),content TEXT,ai_provider_id UUID,generated_at TIMESTAMPTZ)`,
`CREATE TABLE summaries(id UUID PRIMARY KEY,user_id UUID REFERENCES users(id),content TEXT,ai_provider_id UUID,generated_at TIMESTAMPTZ,summary_model_id UUID NULL,provider_name TEXT NULL,model_name TEXT NULL)`,
`INSERT INTO users(id) VALUES('00000000-0000-0000-0000-000000000001')`,
`INSERT INTO sources(id,name,type,enabled,source_key) VALUES('00000000-0000-0000-0000-000000000002','Fixture','fixture',true,'yahoo_finance')`,
`CREATE TABLE summary_generations(id UUID PRIMARY KEY,user_id UUID,summary_id UUID REFERENCES summaries(id),outcome JSONB NOT NULL,created_at TIMESTAMPTZ)`,