feat(grok): 新增并更新图片生成模型配置
新增 grok-imagine-1.0-fast 和 grok-imagine-1.0-fast-edit 模型及其 NSFW 变体到支持列表。 更新模型映射,将原有 imagine 模型的 modeId 从 'fast' 改为 'expert',并为新增的 fast 模型配置正确的映射。 简化图片生成启用逻辑,现在仅基于模型名称(包含 'imagine' 或 'edit' 但不包含 'video')进行判断,以提高准确性和可维护性。 更新版本号至 2.13.0。
This commit is contained in:
parent
9d87e54837
commit
c5cb63a239
3 changed files with 13 additions and 10 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
|||
2.12.9
|
||||
2.13.0
|
||||
|
|
|
|||
|
|
@ -42,8 +42,10 @@ const CORE_MODEL_MAPPING = {
|
|||
'grok-4.20-fast': { name: 'grok-420', mode: 'MODEL_MODE_FAST', modeId: 'fast' },
|
||||
'grok-4.20-expert': { name: 'grok-420', mode: 'MODEL_MODE_EXPERT', modeId: 'expert' },
|
||||
'grok-4.20-heavy': { name: 'grok-420', mode: 'MODEL_MODE_HEAVY', modeId: 'heavy' },
|
||||
'grok-imagine-1.0': { name: 'imagine-image', mode: 'MODEL_MODE_FAST', modeId: 'fast' },
|
||||
'grok-imagine-1.0-edit': { name: 'imagine-image-edit', mode: 'MODEL_MODE_FAST', modeId: 'fast' },
|
||||
'grok-imagine-1.0-fast': { name: 'imagine-image', mode: 'MODEL_MODE_FAST', modeId: 'fast' },
|
||||
'grok-imagine-1.0-fast-edit': { name: 'imagine-image', mode: 'MODEL_MODE_FAST', modeId: 'fast' },
|
||||
'grok-imagine-1.0': { name: 'imagine-image', mode: 'MODEL_MODE_FAST', modeId: 'expert' },
|
||||
'grok-imagine-1.0-edit': { name: 'imagine-image', mode: 'MODEL_MODE_FAST', modeId: 'expert' },
|
||||
// 'grok-imagine-1.0-video': { name: 'grok-3', mode: 'MODEL_MODE_FAST', modeId: 'fast' }
|
||||
};
|
||||
|
||||
|
|
@ -541,10 +543,7 @@ export class GrokApiService {
|
|||
const isMediaModel = modelLower.includes('imagine') || isVideoModel || isEditModel;
|
||||
const isNsfw = isGrokNsfwModel(rawModelId) || requestBody.nsfw === true || requestBody.disableNsfwFilter === true;
|
||||
|
||||
const shouldEnableImage = isMediaModel ||
|
||||
modelLower.includes('expert') ||
|
||||
modelLower.includes('fast') ||
|
||||
modelLower.includes('grok-3') ||
|
||||
const shouldEnableImage = (modelLower.includes('imagine') || modelLower.includes('edit')) && !modelLower.includes('video') ||
|
||||
requestBody.enableImageGeneration === true;
|
||||
|
||||
const imageGenerationCount = Math.min(parseInt(requestBody.n || requestBody.imageGenerationCount || (shouldEnableImage ? 2 : 0)), 2);
|
||||
|
|
@ -913,7 +912,7 @@ export class GrokApiService {
|
|||
const n = parseInt(requestBody.n || 1);
|
||||
const normalizedModel = normalizeGrokModelId(model);
|
||||
const modelLower = normalizedModel.toLowerCase();
|
||||
const isImagine = modelLower.includes('imagine');
|
||||
const isImagine = (modelLower.includes('imagine') || modelLower.includes('edit')) && !modelLower.includes('video');
|
||||
// 识别优先使用 WS 的模型 (仅限图片生成,排除视频)
|
||||
// const isWSPreferred = isImagine && !modelLower.includes('video');
|
||||
|
||||
|
|
@ -1261,7 +1260,7 @@ export class GrokApiService {
|
|||
const rawModel = typeof model === 'string' ? model : '';
|
||||
const normalizedModel = normalizeGrokModelId(rawModel);
|
||||
const modelLower = normalizedModel.toLowerCase();
|
||||
const isImagine = modelLower.includes('imagine') || modelLower.includes('edit');
|
||||
const isImagine = (modelLower.includes('imagine') || modelLower.includes('edit')) && !modelLower.includes('video');
|
||||
// 识别优先使用 WS 的模型 (仅限图片生成,排除视频)
|
||||
// const isWSPreferred = isImagine && !modelLower.includes('video');
|
||||
const isNsfw = isGrokNsfwModel(rawModel) || requestBody.nsfw === true || requestBody.disableNsfwFilter === true;
|
||||
|
|
|
|||
|
|
@ -103,6 +103,8 @@ export const PROVIDER_MODELS = {
|
|||
'grok-4.20-heavy',
|
||||
'grok-imagine-1.0',
|
||||
'grok-imagine-1.0-edit',
|
||||
'grok-imagine-1.0-fast',
|
||||
'grok-imagine-1.0-fast-edit',
|
||||
'grok-4.1-mini-nsfw',
|
||||
'grok-4.1-thinking-nsfw',
|
||||
'grok-4.20-nsfw',
|
||||
|
|
@ -111,7 +113,9 @@ export const PROVIDER_MODELS = {
|
|||
'grok-4.20-expert-nsfw',
|
||||
'grok-4.20-heavy-nsfw',
|
||||
'grok-imagine-1.0-nsfw',
|
||||
'grok-imagine-1.0-edit-nsfw'
|
||||
'grok-imagine-1.0-edit-nsfw',
|
||||
'grok-imagine-1.0-fast-nsfw',
|
||||
'grok-imagine-1.0-fast-edit-nsfw'
|
||||
]
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue