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:
@ -23,7 +23,7 @@ func (r *Repository) SaveGeneration(ctx context.Context, userID, id string, summ
|
||||
defer tx.Rollback()
|
||||
var summaryID *string
|
||||
if summary != nil {
|
||||
if _, err = tx.ExecContext(ctx, `INSERT INTO summaries (id,user_id,content,ai_provider_id,generated_at) VALUES ($1,$2,$3,$4,$5)`, summary.ID, userID, summary.Content, summary.AIProviderID, summary.GeneratedAt); err != nil {
|
||||
if _, err = tx.ExecContext(ctx, `INSERT INTO summaries (id,user_id,content,ai_provider_id,generated_at,summary_model_id,provider_name,model_name) VALUES ($1,$2,$3,$4,$5,$6,$7,$8)`, summary.ID, userID, summary.Content, summary.AIProviderID, summary.GeneratedAt, summary.SummaryModelID, summary.ProviderName, summary.ModelName); err != nil {
|
||||
return err
|
||||
}
|
||||
summaryID = &summary.ID
|
||||
@ -51,7 +51,7 @@ func (r *Repository) ListGenerations(ctx context.Context, userID string, limit i
|
||||
}
|
||||
func (r *Repository) GetOwnedSummary(id, userID string) (*Summary, error) {
|
||||
s := &Summary{}
|
||||
err := r.db.QueryRow(`SELECT id,user_id,content,ai_provider_id,generated_at FROM summaries WHERE id=$1 AND user_id=$2`, id, userID).Scan(&s.ID, &s.UserID, &s.Content, &s.AIProviderID, &s.GeneratedAt)
|
||||
err := r.db.QueryRow(`SELECT id,user_id,content,ai_provider_id,generated_at,summary_model_id,provider_name,model_name FROM summaries WHERE id=$1 AND user_id=$2`, id, userID).Scan(&s.ID, &s.UserID, &s.Content, &s.AIProviderID, &s.GeneratedAt, &s.SummaryModelID, &s.ProviderName, &s.ModelName)
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user