mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
fix(server): generate image (#11599)
This commit is contained in:
@@ -476,6 +476,19 @@ const actions = [
|
||||
},
|
||||
type: 'image' as const,
|
||||
},
|
||||
{
|
||||
promptName: ['debug:action:dalle3'],
|
||||
messages: [
|
||||
{
|
||||
role: 'user' as const,
|
||||
content: 'Panda',
|
||||
},
|
||||
],
|
||||
verifier: (t: ExecutionContext<Tester>, link: string) => {
|
||||
t.truthy(checkUrl(link), 'should be a valid url');
|
||||
},
|
||||
type: 'image' as const,
|
||||
},
|
||||
];
|
||||
|
||||
for (const { name, promptName, messages, verifier, type } of actions) {
|
||||
|
||||
@@ -313,9 +313,9 @@ export class OpenAIProvider
|
||||
prompt,
|
||||
});
|
||||
|
||||
return result.images
|
||||
.map(image => image.base64)
|
||||
.filter((v): v is string => !!v);
|
||||
return result.images.map(
|
||||
image => `data:image/png;base64,${image.base64}`
|
||||
);
|
||||
} catch (e: any) {
|
||||
metrics.ai.counter('generate_images_errors').add(1, { model });
|
||||
throw this.handleError(e, model, options);
|
||||
|
||||
Reference in New Issue
Block a user