🤯 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
chore: apply some suggestion (1,4,6)
Zhijie He763352c56a9c
diff --git a/packages/model-bank/src/aiModels/qwen.ts b/packages/model-bank/src/aiModels/qwen.tsindex 2fdcd87b582..ca5d8738de5 100644--- a/packages/model-bank/src/aiModels/qwen.ts+++ b/packages/model-bank/src/aiModels/qwen.ts@@ -1130,8 +1130,8 @@ const qwenChatModels: AIChatModelCard[] = [{abilities: {functionCall: true,- search: true,reasoning: true,+ search: true,},contextWindowTokens: 262_144,description:@@ -2353,6 +2353,7 @@ const qwenImageModels: AIImageModelCard[] = [description:'Qwen Image Edit is an image-to-image model that edits images based on input images and text prompts, enabling precise adjustments and creative transformations.',displayName: 'Qwen Image Edit',+ enabled: true,id: 'qwen-image-edit',organization: 'Qwen',parameters: {@@ -2423,6 +2424,7 @@ const qwenImageModels: AIImageModelCard[] = [description:'Qwen-Image is a general image generation model supporting multiple art styles and strong complex text rendering, especially Chinese and English. It supports multi-line layouts, paragraph-level text, and fine detail for complex text-image layouts.',displayName: 'Qwen Image',+ enabled: true,id: 'qwen-image',organization: 'Qwen',parameters: {@@ -2557,6 +2559,7 @@ const qwenImageModels: AIImageModelCard[] = [description:'Wanxiang 2.2 Plus is the latest model with upgrades in creativity, stability, and realism, producing richer details.',displayName: 'Wanxiang2.2 T2I Plus',+ enabled: true,id: 'wan2.2-t2i-plus',organization: 'Qwen',parameters: {@@ -2661,6 +2664,7 @@ const qwenImageModels: AIImageModelCard[] = [description:'FLUX.1 [schnell] is the most advanced open-source few-step model, surpassing similar competitors and even strong non-distilled models like Midjourney v6.0 and DALL-E 3 (HD). It is finely tuned to preserve pretraining diversity, significantly improving visual quality, instruction following, size/aspect variation, font handling, and output diversity.',displayName: 'FLUX.1 [schnell]',+ enabled: true,id: 'flux-schnell',organization: 'Qwen',parameters: {@@ -2685,6 +2689,7 @@ const qwenImageModels: AIImageModelCard[] = [description:'FLUX.1 [dev] is an open-weights distilled model for non-commercial use. It keeps near-pro image quality and instruction following while running more efficiently, using resources better than same-size standard models.',displayName: 'FLUX.1 [dev]',+ enabled: true,id: 'flux-dev',organization: 'Qwen',parameters: {@@ -2709,6 +2714,7 @@ const qwenImageModels: AIImageModelCard[] = [description:'FLUX.1-merged combines the deep features explored in "DEV" with the high-speed advantages of "Schnell", extending performance limits and broadening applications.',displayName: 'FLUX.1-merged',+ enabled: true,id: 'flux-merged',organization: 'Qwen',parameters: {diff --git a/packages/model-runtime/src/providers/qwen/createImage.ts b/packages/model-runtime/src/providers/qwen/createImage.tsindex 7c3d838f52e..e734e7f14c0 100644--- a/packages/model-runtime/src/providers/qwen/createImage.ts+++ b/packages/model-runtime/src/providers/qwen/createImage.ts@@ -61,6 +61,7 @@ async function createQwenImageTask(payload: CreateImagePayload,apiKey: string,endpoint: 'text2image' | 'image2image',+ provider: string,): Promise<string> {const { model, params } = payload;const url = `https://dashscope.aliyuncs.com/api/v1/services/aigc/${endpoint}/image-synthesis`;@@ -88,7 +89,11 @@ async function createQwenImageTask(}if (!images || images.length === 0) {- throw new Error('imageUrls or imageUrl is required for image-to-image models');+ throw AgentRuntimeError.createImage({+ error: new Error('imageUrls or imageUrl is required for image-to-image models'),+ errorType: 'ProviderBizError',+ provider,+ });}input.images = images;@@ -249,57 +254,11 @@ export async function createQwenImage(const { model } = payload;try {- if (image2ImageModels.has(model)) {- log('Using image2image API for model: %s', model);-- const taskId = await createQwenImageTask(payload, apiKey, 'image2image');-- const result = await asyncifyPolling<QwenImageTaskResponse, CreateImageResponse>({- checkStatus: (taskStatus: QwenImageTaskResponse): TaskResult<CreateImageResponse> => {- log('Task %s status: %s', taskId, taskStatus.output.task_status);-- if (taskStatus.output.task_status === 'SUCCEEDED') {- if (!taskStatus.output.results || taskStatus.output.results.length === 0) {- return {- error: new Error('Task succeeded but no images generated'),- status: 'failed',- };- }-- const generatedImageUrl = taskStatus.output.results[0].url;- log('Image generated successfully: %s', generatedImageUrl);-- return {- data: { imageUrl: generatedImageUrl },- status: 'success',- };- }-- if (taskStatus.output.task_status === 'FAILED') {- const errorMessage =- taskStatus.output.error_message || 'Task failed without error message';- return {- error: new Error(`Image generation failed for model ${model}: ${errorMessage}`),- status: 'failed',- };- }-- return { status: 'pending' };- },- logger: {- debug: (message: any, ...args: any[]) => log(message, ...args),- error: (message: any, ...args: any[]) => log(message, ...args),- },- pollingQuery: () => queryTaskStatus(taskId, apiKey),- });-- return result;- }-- if (text2ImageModels.has(model)) {- log('Using text2image API for model: %s', model);+ if (text2ImageModels.has(model) || image2ImageModels.has(model)) {+ const endpoint = image2ImageModels.has(model) ? 'image2image' : 'text2image';+ log('Using %s API for model: %s', endpoint, model);- const taskId = await createQwenImageTask(payload, apiKey, 'text2image');+ const taskId = await createQwenImageTask(payload, apiKey, endpoint, provider);const result = await asyncifyPolling<QwenImageTaskResponse, CreateImageResponse>({checkStatus: (taskStatus: QwenImageTaskResponse): TaskResult<CreateImageResponse> => {