feat(core): add gemini callout syntax highlighting (#12413)

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

What Changed?
- Add `gemini-2.5-flash-preview-04-17` model
- Add `thinkingConfig` provider options
- Add callout syntax highlighting

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

- **New Features**
  - Added support for the "Gemini 2.5 Flash" model and updated the "Gemini 2.5 Pro" model to a newer version.
  - Enhanced streaming responses to better format reasoning outputs and provide clearer callouts in AI-generated content.

- **Bug Fixes**
  - Improved audio transcription prompts in test cases for more accurate and explicit testing.

- **Documentation**
  - Expanded citation instructions for AI chat responses, including examples for multiple citations.

- **Chores**
  - Updated the "@ai-sdk/google" dependency to a newer version.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
akumatus
2025-05-23 01:58:01 +00:00
parent 0ce05ca96e
commit 119cf9442b
7 changed files with 101 additions and 19 deletions

View File

@@ -350,7 +350,7 @@ const actions: Prompt[] = [
{
name: 'Transcript audio',
action: 'Transcript audio',
model: 'gemini-2.5-pro-preview-03-25',
model: 'gemini-2.5-pro-preview-05-06',
messages: [
{
role: 'system',
@@ -1096,6 +1096,8 @@ const chat: Prompt[] = [
'o4-mini',
'claude-3-7-sonnet-20250219',
'claude-3-5-sonnet-20241022',
'gemini-2.5-flash-preview-04-17',
'gemini-2.5-pro-preview-05-06',
],
messages: [
{
@@ -1122,11 +1124,12 @@ When referencing information from the provided documents, files or web search re
1. Use markdown footnote format for citations
2. Add citations immediately after the relevant sentence or paragraph
3. Required format: [^reference_index] where reference_index is an increasing positive integer
4. You MUST include citations at the end of your response in this exact format:
4. When a single sentence needs multiple citations, write each marker in its own pair of brackets and place them consecutively. Correct: [^2][^4][^12], Incorrect: [^2, 4, 12].
5. You MUST include citations at the end of your response in this exact format:
- For documents: [^reference_index]:{"type":"doc","docId":"document_id"}
- For files: [^reference_index]:{"type":"attachment","blobId":"blob_id","fileName":"file_name","fileType":"file_type"}
- For web search results: [^reference_index]:{"type":"url","url":"url_path"}
5. Ensure citations adhere strictly to the required format. Do not add extra spaces in citations like [^ reference_index] or [ ^reference_index].
6. Ensure citations adhere strictly to the required format. Do not add extra spaces in citations like [^ reference_index] or [ ^reference_index].
### Citations Structure
Your response MUST follow this structure:
@@ -1136,6 +1139,7 @@ Your response MUST follow this structure:
Example Output with Citations:
This is my response with a document citation[^1]. Here is more content with another file citation[^2]. And here is a web search result citation[^3].
Here is multiple citations: [^1][^2][^3].
[^1]:{"type":"doc","docId":"abc123"}
[^2]:{"type":"attachment","blobId":"xyz789","fileName":"example.txt","fileType":"text"}