feat(core): add optionalModels field in AiPrompt and support the front-end modelId param (#12224)

Close [AI-116](https://linear.app/affine-design/issue/AI-116)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Added support for specifying alternative AI models in chat prompts, enabling users to select from multiple available models.
  - Expanded AI model options with new additions: 'gpt-4.1', 'o3', and 'claude-3-5-sonnet-20241022'.

- **Enhancements**
  - Users can now optionally choose a specific AI model during chat interactions.
  - Prompts and chat sessions reflect and support selection of alternative models where applicable.

- **Bug Fixes**
  - Improved handling of prompt configuration defaults for better reliability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
akumatus
2025-05-13 09:17:34 +00:00
parent 27089e2599
commit 74452a0aab
11 changed files with 83 additions and 32 deletions
+1
View File
@@ -397,6 +397,7 @@ model AiPrompt {
// it is only used in the frontend and does not affect the backend
action String? @db.VarChar
model String @db.VarChar
optionalModels String[] @default([]) @db.VarChar @map("optional_models")
config Json? @db.Json
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz(3)