Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): should choose different models based on content or attachments (#6567)

fundonb2ca8249c118
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts
index 5aea5c9424..e81fb5c2c8 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts
@@ -1,6 +1,7 @@
import { assertExists } from '@blocksuite/global/utils';
import { AIProvider } from '@blocksuite/presets';
+import type { PromptKey } from './prompt';
import {
createChatSession,
listHistories,
@@ -250,8 +251,12 @@ export function setupAIProvider() {
});
AIProvider.provide('createImage', options => {
- // const promptName = 'debug:action:fal-sd15';
- const promptName = 'debug:action:dalle3';
+ // test to image
+ let promptName: PromptKey = 'debug:action:dalle3';
+ // image to image
+ if (options.attachments?.length) {
+ promptName = 'debug:action:fal-sd15';
+ }
return toImage({
...options,
promptName,