mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
feat(server): adapt 4o image (#11956)
fix AI-88 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added support for the new image generation model "gpt-image-1" in both backend and frontend. - Updated available prompt options to include "gpt-image-1" for image creation actions. - **Improvements** - Set a 5-minute timeout for image generation requests to improve reliability. - **Tests** - Expanded test coverage to validate image generation using the new "gpt-image-1" prompt. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/google": "^1.2.10",
|
||||
"@ai-sdk/openai": "^1.3.9",
|
||||
"@ai-sdk/openai": "^1.3.18",
|
||||
"@ai-sdk/perplexity": "^1.1.6",
|
||||
"@apollo/server": "^4.11.3",
|
||||
"@aws-sdk/client-s3": "^3.779.0",
|
||||
|
||||
@@ -514,7 +514,7 @@ const actions = [
|
||||
type: 'image' as const,
|
||||
},
|
||||
{
|
||||
promptName: ['debug:action:dalle3'],
|
||||
promptName: ['debug:action:dalle3', 'debug:action:gpt-image-1'],
|
||||
messages: [
|
||||
{
|
||||
role: 'user' as const,
|
||||
|
||||
@@ -288,6 +288,12 @@ const actions: Prompt[] = [
|
||||
model: 'dall-e-3',
|
||||
messages: [],
|
||||
},
|
||||
{
|
||||
name: 'debug:action:gpt-image-1',
|
||||
action: 'image',
|
||||
model: 'gpt-image-1',
|
||||
messages: [],
|
||||
},
|
||||
{
|
||||
name: 'debug:action:fal-sd15',
|
||||
action: 'image',
|
||||
|
||||
@@ -77,6 +77,7 @@ export class OpenAIProvider
|
||||
'text-moderation-stable',
|
||||
// text to image
|
||||
'dall-e-3',
|
||||
'gpt-image-1',
|
||||
];
|
||||
|
||||
#instance!: VercelOpenAIProvider;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// TODO(@Peng): automate this
|
||||
export const promptKeys = [
|
||||
'debug:action:dalle3',
|
||||
'debug:action:gpt-image-1',
|
||||
'debug:action:fal-sd15',
|
||||
'debug:action:fal-upscaler',
|
||||
'debug:action:fal-remove-bg',
|
||||
|
||||
@@ -492,7 +492,7 @@ Could you make a new website based on these notes and send back just the html fi
|
||||
|
||||
AIProvider.provide('createImage', async options => {
|
||||
// test to image
|
||||
let promptName: PromptKey = 'debug:action:dalle3';
|
||||
let promptName: PromptKey = 'debug:action:gpt-image-1';
|
||||
// image to image
|
||||
if (options.attachments?.length) {
|
||||
promptName = 'debug:action:fal-sd15';
|
||||
@@ -507,6 +507,8 @@ Could you make a new website based on these notes and send back just the html fi
|
||||
client,
|
||||
sessionId,
|
||||
content: options.input,
|
||||
// 5 minutes
|
||||
timeout: 300000,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user