🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 chrore: fix qwen-image model and standardize image size format (#8935)
afonc9a65f78c5f4
diff --git a/packages/model-runtime/src/qwen/createImage.test.ts b/packages/model-runtime/src/qwen/createImage.test.tsindex 730c5a67792..616326f76a1 100644--- a/packages/model-runtime/src/qwen/createImage.test.ts+++ b/packages/model-runtime/src/qwen/createImage.test.ts@@ -327,25 +327,6 @@ describe('createQwenImage', () => {});describe('Error scenarios', () => {- it('should handle unsupported model', async () => {- const payload: CreateImagePayload = {- model: 'unsupported-model',- params: {- prompt: 'Test prompt',- },- };-- await expect(createQwenImage(payload, mockOptions)).rejects.toEqual(- expect.objectContaining({- errorType: 'ProviderBizError',- provider: 'qwen',- }),- );-- // Should not make any fetch calls- expect(fetch).not.toHaveBeenCalled();- });-it('should handle task creation failure', async () => {global.fetch = vi.fn().mockResolvedValueOnce({ok: false,diff --git a/packages/model-runtime/src/qwen/createImage.ts b/packages/model-runtime/src/qwen/createImage.tsindex dca58081e15..3d28a2ebbfd 100644--- a/packages/model-runtime/src/qwen/createImage.ts+++ b/packages/model-runtime/src/qwen/createImage.ts@@ -19,39 +19,13 @@ interface QwenImageTaskResponse {request_id: string;}-const QwenText2ImageModels = [- 'wan2.2-t2i',- 'wanx2.1-t2i',- 'wanx2.0-t2i',- 'wanx-v1',- 'flux',- 'stable-diffusion',-];--const getModelType = (model: string): string => {- // 可以添加其他模型类型的判断- // if (QwenImage2ImageModels.some(prefix => model.startsWith(prefix))) {- // return 'image2image';- // }-- if (QwenText2ImageModels.some((prefix) => model.startsWith(prefix))) {- return 'text2image';- }-- throw new Error(`Unsupported model: ${model}`);-};-/*** Create an image generation task with Qwen API*/async function createImageTask(payload: CreateImagePayload, apiKey: string): Promise<string> {const { model, params } = payload;// I can only say that the design of Alibaba Cloud's API is really bad; each model has a different endpoint path.- const modelType = getModelType(model);- const endpoint = `https://dashscope.aliyuncs.com/api/v1/services/aigc/${modelType}/image-synthesis`;- if (!endpoint) {- throw new Error(`No endpoint configured for model type: ${modelType}`);- }+ const endpoint = `https://dashscope.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis`;log('Creating image task with model: %s, endpoint: %s', model, endpoint);const response = await fetch(endpoint, {diff --git a/src/config/aiModels/qwen.ts b/src/config/aiModels/qwen.tsindex da4f64f9732..5165437f598 100644--- a/src/config/aiModels/qwen.ts+++ b/src/config/aiModels/qwen.ts@@ -1357,8 +1357,8 @@ const qwenImageModels: AIImageModelCard[] = [},seed: { default: null },size: {- default: '1328*1328',- enum: ['1664*928', '1472*1140', '1328*1328', '1140*1472', '928*1664'],+ default: '1328x1328',+ enum: ['1664x928', '1472x1140', '1328x1328', '1140x1472', '928x1664'],},},pricing: {