@lobehub/chat 1.105.0 → 1.105.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.105.1](https://github.com/lobehub/lobe-chat/compare/v1.105.0...v1.105.1)
6
+
7
+ <sup>Released on **2025-07-29**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Support more Text2Image from Qwen.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Support more Text2Image from Qwen, closes [#8574](https://github.com/lobehub/lobe-chat/issues/8574) ([b8c0e2d](https://github.com/lobehub/lobe-chat/commit/b8c0e2d))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ## [Version 1.105.0](https://github.com/lobehub/lobe-chat/compare/v1.104.5...v1.105.0)
6
31
 
7
32
  <sup>Released on **2025-07-28**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Support more Text2Image from Qwen."
6
+ ]
7
+ },
8
+ "date": "2025-07-29",
9
+ "version": "1.105.1"
10
+ },
2
11
  {
3
12
  "children": {
4
13
  "features": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.105.0",
3
+ "version": "1.105.1",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -958,9 +958,42 @@ const qwenChatModels: AIChatModelCard[] = [
958
958
 
959
959
  const qwenImageModels: AIImageModelCard[] = [
960
960
  {
961
- description: '阿里云通义旗下的文生图模型',
962
- displayName: 'Wanxiang T2I Turbo',
961
+ description: '万相2.2极速版,当前最新模型。在创意性、稳定性、写实质感上全面升级,生成速度快,性价比高。',
962
+ displayName: 'Wanxiang2.2 T2I Flash',
963
963
  enabled: true,
964
+ id: 'wan2.2-t2i-flash',
965
+ organization: 'Qwen',
966
+ parameters: {
967
+ height: { default: 1024, max: 1440, min: 512, step: 1 },
968
+ prompt: {
969
+ default: '',
970
+ },
971
+ seed: { default: null },
972
+ width: { default: 1024, max: 1440, min: 512, step: 1 },
973
+ },
974
+ releasedAt: '2025-07-28',
975
+ type: 'image',
976
+ },
977
+ {
978
+ description: '万相2.2专业版,当前最新模型。在创意性、稳定性、写实质感上全面升级,生成细节丰富。',
979
+ displayName: 'Wanxiang2.2 T2I Plus',
980
+ enabled: true,
981
+ id: 'wan2.2-t2i-plus',
982
+ organization: 'Qwen',
983
+ parameters: {
984
+ height: { default: 1024, max: 1440, min: 512, step: 1 },
985
+ prompt: {
986
+ default: '',
987
+ },
988
+ seed: { default: null },
989
+ width: { default: 1024, max: 1440, min: 512, step: 1 },
990
+ },
991
+ releasedAt: '2025-07-28',
992
+ type: 'image',
993
+ },
994
+ {
995
+ description: '全面升级版本。生成速度快、效果全面、综合性价比高。对应通义万相官网2.1极速模型。',
996
+ displayName: 'Wanxiang2.1 T2I Turbo',
964
997
  id: 'wanx2.1-t2i-turbo',
965
998
  organization: 'Qwen',
966
999
  parameters: {
@@ -974,6 +1007,178 @@ const qwenImageModels: AIImageModelCard[] = [
974
1007
  releasedAt: '2025-01-08',
975
1008
  type: 'image',
976
1009
  },
1010
+ {
1011
+ description: '全面升级版本。生成图像细节更丰富,速度稍慢。对应通义万相官网2.1专业模型。',
1012
+ displayName: 'Wanxiang2.1 T2I Plus',
1013
+ id: 'wanx2.1-t2i-plus',
1014
+ organization: 'Qwen',
1015
+ parameters: {
1016
+ height: { default: 1024, max: 1440, min: 512, step: 1 },
1017
+ prompt: {
1018
+ default: '',
1019
+ },
1020
+ seed: { default: null },
1021
+ width: { default: 1024, max: 1440, min: 512, step: 1 },
1022
+ },
1023
+ releasedAt: '2025-01-08',
1024
+ type: 'image',
1025
+ },
1026
+ {
1027
+ description: '擅长质感人像,速度中等、成本较低。对应通义万相官网2.0极速模型。',
1028
+ displayName: 'Wanxiang2.0 T2I Turbo',
1029
+ id: 'wanx2.0-t2i-turbo',
1030
+ organization: 'Qwen',
1031
+ parameters: {
1032
+ height: { default: 1024, max: 1440, min: 512, step: 1 },
1033
+ prompt: {
1034
+ default: '',
1035
+ },
1036
+ seed: { default: null },
1037
+ width: { default: 1024, max: 1440, min: 512, step: 1 },
1038
+ },
1039
+ releasedAt: '2025-01-17',
1040
+ type: 'image',
1041
+ },
1042
+ {
1043
+ description: '基础文生图模型。对应通义万相官网1.0通用模型。',
1044
+ displayName: 'Wanxiang v1',
1045
+ id: 'wanx-v1',
1046
+ organization: 'Qwen',
1047
+ parameters: {
1048
+ height: { default: 1024, max: 1440, min: 512, step: 1 },
1049
+ prompt: {
1050
+ default: '',
1051
+ },
1052
+ seed: { default: null },
1053
+ width: { default: 1024, max: 1440, min: 512, step: 1 },
1054
+ },
1055
+ releasedAt: '2024-05-22',
1056
+ type: 'image',
1057
+ },
1058
+ {
1059
+ description: 'FLUX.1 [schnell] 作为目前开源最先进的少步模型,不仅超越了同类竞争者,甚至还优于诸如 Midjourney v6.0 和 DALL·E 3 (HD) 等强大的非精馏模型。该模型经过专门微调,以保留预训练阶段的全部输出多样性,相较于当前市场上的最先进模型,FLUX.1 [schnell] 显著提升了在视觉质量、指令遵从、尺寸/比例变化、字体处理及输出多样性等方面的可能,为用户带来更为丰富多样的创意图像生成体验。',
1060
+ displayName: 'FLUX.1 [schnell]',
1061
+ enabled: true,
1062
+ id: 'flux-schnell',
1063
+ organization: 'Qwen',
1064
+ parameters: {
1065
+ prompt: {
1066
+ default: '',
1067
+ },
1068
+ seed: { default: null },
1069
+ size: {
1070
+ default: '1024x1024',
1071
+ enum: ['512x1024', '768x512', '768x1024', '1024x576', '576x1024', '1024x1024'],
1072
+ },
1073
+ steps: { default: 4, max: 12, min: 1 },
1074
+ },
1075
+ releasedAt: '2024-08-07',
1076
+ type: 'image',
1077
+ },
1078
+ {
1079
+ description: 'FLUX.1 [dev] 是一款面向非商业应用的开源权重、精炼模型。FLUX.1 [dev] 在保持了与FLUX专业版相近的图像质量和指令遵循能力的同时,具备更高的运行效率。相较于同尺寸的标准模型,它在资源利用上更为高效。',
1080
+ displayName: 'FLUX.1 [dev]',
1081
+ enabled: true,
1082
+ id: 'flux-dev',
1083
+ organization: 'Qwen',
1084
+ parameters: {
1085
+ prompt: {
1086
+ default: '',
1087
+ },
1088
+ seed: { default: null },
1089
+ size: {
1090
+ default: '1024x1024',
1091
+ enum: ['512x1024', '768x512', '768x1024', '1024x576', '576x1024', '1024x1024'],
1092
+ },
1093
+ steps: { default: 50, max: 50, min: 1 },
1094
+ },
1095
+ releasedAt: '2024-08-07',
1096
+ type: 'image',
1097
+ },
1098
+ {
1099
+ description: 'FLUX.1-merged 模型结合了 "DEV" 在开发阶段探索的深度特性和 "Schnell" 所代表的高速执行优势。通过这一举措,FLUX.1-merged 不仅提升了模型的性能界限,还拓宽了其应用范围。',
1100
+ displayName: 'FLUX.1-merged',
1101
+ enabled: true,
1102
+ id: 'flux-merged',
1103
+ organization: 'Qwen',
1104
+ parameters: {
1105
+ prompt: {
1106
+ default: '',
1107
+ },
1108
+ seed: { default: null },
1109
+ size: {
1110
+ default: '1024x1024',
1111
+ enum: ['512x1024', '768x512', '768x1024', '1024x576', '576x1024', '1024x1024'],
1112
+ },
1113
+ steps: { default: 30, max: 30, min: 1 },
1114
+ },
1115
+ releasedAt: '2024-08-22',
1116
+ type: 'image',
1117
+ },
1118
+ {
1119
+ description: 'stable-diffusion-3.5-large 是一个具有8亿参数的多模态扩散变压器(MMDiT)文本到图像生成模型,具备卓越的图像质量和提示词匹配度,支持生成 100 万像素的高分辨率图像,且能够在普通消费级硬件上高效运行。',
1120
+ displayName: 'StableDiffusion 3.5 Large',
1121
+ id: 'stable-diffusion-3.5-large',
1122
+ organization: 'Qwen',
1123
+ parameters: {
1124
+ height: { default: 1024, max: 1024, min: 512, step: 128 },
1125
+ prompt: {
1126
+ default: '',
1127
+ },
1128
+ steps: { default: 40, max: 500, min: 1 },
1129
+ width: { default: 1024, max: 1024, min: 512, step: 128 },
1130
+ },
1131
+ releasedAt: '2024-10-25',
1132
+ type: 'image',
1133
+ },
1134
+ {
1135
+ description: 'stable-diffusion-3.5-large-turbo 是在 stable-diffusion-3.5-large 的基础上采用对抗性扩散蒸馏(ADD)技术的模型,具备更快的速度。',
1136
+ displayName: 'StableDiffusion 3.5 Large Turbo',
1137
+ id: 'stable-diffusion-3.5-large-turbo',
1138
+ organization: 'Qwen',
1139
+ parameters: {
1140
+ height: { default: 1024, max: 1024, min: 512, step: 128 },
1141
+ prompt: {
1142
+ default: '',
1143
+ },
1144
+ steps: { default: 40, max: 500, min: 1 },
1145
+ width: { default: 1024, max: 1024, min: 512, step: 128 },
1146
+ },
1147
+ releasedAt: '2024-10-25',
1148
+ type: 'image',
1149
+ },
1150
+ {
1151
+ description: 'stable-diffusion-xl 相比于 v1.5 做了重大的改进,并且与当前开源的文生图 SOTA 模型 midjourney 效果相当。具体改进之处包括: 更大的 unet backbone,是之前的 3 倍; 增加了 refinement 模块用于改善生成图片的质量;更高效的训练技巧等。',
1152
+ displayName: 'StableDiffusion xl',
1153
+ id: 'stable-diffusion-xl',
1154
+ organization: 'Qwen',
1155
+ parameters: {
1156
+ height: { default: 1024, max: 1024, min: 512, step: 128 },
1157
+ prompt: {
1158
+ default: '',
1159
+ },
1160
+ steps: { default: 50, max: 500, min: 1 },
1161
+ width: { default: 1024, max: 1024, min: 512, step: 128 },
1162
+ },
1163
+ releasedAt: '2024-04-09',
1164
+ type: 'image',
1165
+ },
1166
+ {
1167
+ description: 'stable-diffusion-v1.5 是以 stable-diffusion-v1.2 检查点的权重进行初始化,并在 "laion-aesthetics v2 5+" 上以 512x512 的分辨率进行了595k步的微调,减少了 10% 的文本条件化,以提高无分类器的引导采样。',
1168
+ displayName: 'StableDiffusion v1.5',
1169
+ id: 'stable-diffusion-v1.5',
1170
+ organization: 'Qwen',
1171
+ parameters: {
1172
+ height: { default: 512, max: 1024, min: 512, step: 128 },
1173
+ prompt: {
1174
+ default: '',
1175
+ },
1176
+ steps: { default: 50, max: 500, min: 1 },
1177
+ width: { default: 512, max: 1024, min: 512, step: 128 },
1178
+ },
1179
+ releasedAt: '2024-04-09',
1180
+ type: 'image',
1181
+ },
977
1182
  ];
978
1183
 
979
1184
  export const allModels = [...qwenChatModels, ...qwenImageModels];
@@ -18,20 +18,38 @@ interface QwenImageTaskResponse {
18
18
  request_id: string;
19
19
  }
20
20
 
21
+ const QwenText2ImageModels = [
22
+ 'wan2.2-t2i',
23
+ 'wanx2.1-t2i',
24
+ 'wanx2.0-t2i',
25
+ 'wanx-v1',
26
+ 'flux',
27
+ 'stable-diffusion'
28
+ ];
29
+
30
+ const getModelType = (model: string): string => {
31
+ // 可以添加其他模型类型的判断
32
+ // if (QwenImage2ImageModels.some(prefix => model.startsWith(prefix))) {
33
+ // return 'image2image';
34
+ // }
35
+
36
+ if (QwenText2ImageModels.some(prefix => model.startsWith(prefix))) {
37
+ return 'text2image';
38
+ }
39
+
40
+ throw new Error(`Unsupported model: ${model}`);
41
+ }
42
+
21
43
  /**
22
44
  * Create an image generation task with Qwen API
23
45
  */
24
46
  async function createImageTask(payload: CreateImagePayload, apiKey: string): Promise<string> {
25
47
  const { model, params } = payload;
26
48
  // I can only say that the design of Alibaba Cloud's API is really bad; each model has a different endpoint path.
27
- const modelEndpointMap: Record<string, string> = {
28
- 'wanx2.1-t2i-turbo':
29
- 'https://dashscope.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis',
30
- };
31
-
32
- const endpoint = modelEndpointMap[model];
49
+ const modelType = getModelType(model);
50
+ const endpoint = `https://dashscope.aliyuncs.com/api/v1/services/aigc/${modelType}/image-synthesis`
33
51
  if (!endpoint) {
34
- throw new Error(`Unsupported model: ${model}`);
52
+ throw new Error(`No endpoint configured for model type: ${modelType}`);
35
53
  }
36
54
  log('Creating image task with model: %s, endpoint: %s', model, endpoint);
37
55
 
@@ -45,10 +63,12 @@ async function createImageTask(payload: CreateImagePayload, apiKey: string): Pro
45
63
  model,
46
64
  parameters: {
47
65
  n: 1,
48
- ...(params.seed !== undefined ? { seed: params.seed } : {}),
66
+ ...(typeof params.seed === 'number' ? { seed: params.seed } : {}),
49
67
  ...(params.width && params.height
50
68
  ? { size: `${params.width}*${params.height}` }
51
- : { size: '1024*1024' }),
69
+ : params.size
70
+ ? { size: params.size.replaceAll('x', '*') }
71
+ : { size: '1024*1024' }),
52
72
  },
53
73
  }),
54
74
  headers: {