Summary
AI model choices are currently hard-coded in the Worker code. We should centralise model selection so the email agent, auto-drafting flow, prompt-injection scanner, and draft verifier can each use a default model while also supporting deploy-time overrides.
Proposed Changes
- Add a centralized AI model config module with defaults for:
- Email agent chat
- Auto-draft generation
- Prompt-injection scanning
- Draft verification
- Support Worker env var overrides for each model.
- Replace hard-coded model strings in agent and AI helper call sites.
- Add the corresponding model variables to
wrangler.jsonc.
Acceptance Criteria
- Model defaults are defined in one place.
- Existing behavior remains unchanged when no overrides are provided.
- Each model can be overridden via Worker vars.
- Typecheck passes.
Summary
AI model choices are currently hard-coded in the Worker code. We should centralise model selection so the email agent, auto-drafting flow, prompt-injection scanner, and draft verifier can each use a default model while also supporting deploy-time overrides.
Proposed Changes
wrangler.jsonc.Acceptance Criteria