Mirrors the BYOK dialog suggested in issue #2: - UserAiConfig gains an optional instructions column (schema.sql + migration 016); PUT validates (<=4000 chars) and full-replaces it. - Instructions ride along on the assistant chat system prompt only (chatSystemWith); the automation compiler and page-extraction prompts stay server-owned contracts. - Settings -> AI: labeled fields, per-provider suggested-model dropdown with a custom-model escape hatch, API key show/hide toggle, and the instructions textarea. - Tests: projection echo, omission clears, cap validation, and the system-prompt assertion via a recorded fake provider body.
12 lines
607 B
SQL
12 lines
607 B
SQL
-- 016_ai_instructions.sql — optional custom system instructions per user
|
|
-- (Settings → AI, mirroring the BYOK "instructions" field). Additive and
|
|
-- idempotent; schema.sql carries the identical column, so db-converge lands
|
|
-- the same shape on both paths.
|
|
--
|
|
-- Applied ONLY to the in-app assistant chat prompt. The server-owned
|
|
-- automation compiler and page-extraction prompts deliberately never
|
|
-- include user instructions: those are contracts (ValidateSpec, untrusted
|
|
-- fetched content), not personas.
|
|
|
|
ALTER TABLE "UserAiConfig" ADD COLUMN IF NOT EXISTS instructions text NOT NULL DEFAULT '';
|