Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

fix: fix edit & i2i models input muti-images

Zhijie He5d7ee01bce54
diff --git a/packages/model-bank/src/aiModels/qwen.ts b/packages/model-bank/src/aiModels/qwen.ts
index ca5d8738de5..bdbf896d6ca 100644
--- a/packages/model-bank/src/aiModels/qwen.ts
+++ b/packages/model-bank/src/aiModels/qwen.ts
@@ -2311,8 +2311,8 @@ const qwenImageModels: AIImageModelCard[] = [
id: 'qwen-image-edit-max',
organization: 'Qwen',
parameters: {
- imageUrl: {
- default: '',
+ imageUrls: {
+ default: [],
},
prompt: {
default: '',
@@ -2334,8 +2334,8 @@ const qwenImageModels: AIImageModelCard[] = [
id: 'qwen-image-edit-plus',
organization: 'Qwen',
parameters: {
- imageUrl: {
- default: '',
+ imageUrls: {
+ default: [],
},
prompt: {
default: '',
@@ -2452,8 +2452,8 @@ const qwenImageModels: AIImageModelCard[] = [
organization: 'Qwen',
parameters: {
height: { default: 1280, max: 1280, min: 768, step: 1 },
- imageUrl: {
- default: '',
+ imageUrls: {
+ default: [],
},
prompt: {
default: '',
@@ -2497,8 +2497,8 @@ const qwenImageModels: AIImageModelCard[] = [
organization: 'Qwen',
parameters: {
height: { default: 1280, max: 1280, min: 768, step: 1 },
- imageUrl: {
- default: '',
+ imageUrls: {
+ default: [],
},
prompt: {
default: '',
diff --git a/packages/model-runtime/src/providers/qwen/createImage.ts b/packages/model-runtime/src/providers/qwen/createImage.ts
index e734e7f14c0..e9d926e8adf 100644
--- a/packages/model-runtime/src/providers/qwen/createImage.ts
+++ b/packages/model-runtime/src/providers/qwen/createImage.ts
@@ -144,14 +144,12 @@ async function createMultimodalGeneration(
const endpoint = `https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation`;
log('Creating image with model: %s, endpoint: %s', model, endpoint);
- const content: Array<{ image: string } | { text: string }> = [{ text: params.prompt }];
+ const content: Array<{ image: string | string[] } | { text: string }> = [{ text: params.prompt }];
if (params.imageUrl) {
content.unshift({ image: params.imageUrl });
- log('Using imageUrl for image-to-image generation');
} else if (params.imageUrls && params.imageUrls.length > 0) {
- content.unshift({ image: params.imageUrls[0] });
- log('Using first imageUrls for image-to-image generation');
+ content.unshift({ image: params.imageUrls });
}
const response = await fetch(endpoint, {