BYO AI settings: custom instructions, model picker, key show/hide
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.
This commit is contained in:
+4
-1
@@ -453,13 +453,16 @@ CREATE INDEX "AgentRun_taskId_createdAt_idx" ON "AgentRun"("taskId", "createdAt"
|
||||
-- internal/crypto (same versioned format as IMAP passwords and
|
||||
-- notification channel secrets) and masked in every API response. The
|
||||
-- server-wide env key (AI_API_KEY) is the fallback and is plan-gated by
|
||||
-- entitlements.AllowServerAI.
|
||||
-- entitlements.AllowServerAI. "instructions" holds the user's optional
|
||||
-- custom system instructions for the in-app assistant; server-owned
|
||||
-- prompts (automation compiler, page extraction) never include them.
|
||||
CREATE TABLE "UserAiConfig" (
|
||||
id text PRIMARY KEY,
|
||||
"ownerId" text NOT NULL UNIQUE REFERENCES "User"(id) ON DELETE CASCADE,
|
||||
provider text NOT NULL CHECK (provider IN ('openai-compatible','anthropic','gemini')),
|
||||
"baseUrl" text NOT NULL DEFAULT '',
|
||||
model text NOT NULL,
|
||||
instructions text NOT NULL DEFAULT '',
|
||||
"apiKey" text NOT NULL,
|
||||
enabled boolean NOT NULL DEFAULT true,
|
||||
version integer NOT NULL DEFAULT 1,
|
||||
|
||||
Reference in New Issue
Block a user