jeecgboot/JeecgBoot · error · JeecgBootBizTipException
当前系统未配置默认图像模型,请前往yml中配置默认模型
Error message
当前系统未配置默认图像模型,请前往yml中配置默认模型
What it means
This error is thrown by AIChatHandler.imageGenerate() (text-to-image) when the provided airagModel is null or inactive (activateFlag == 0) and no default image generation model is configured. The method checks if aiChatConfig.getAiModelDraw().getApiKey() is empty, and if so, rejects the request. This indicates the system's fallback image model configuration is incomplete.
Source
Thrown at jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/llm/handler/AIChatHandler.java:537
return this.imageGenerate(airagModel, messages, params);
}
/**
* 文本生成图片
*
* @param airagModel
* @param messages
* @param params
* @return
*/
public List<Map<String, Object>> imageGenerate(AiragModel airagModel, String messages, AIChatParams params) {
if(airagModel == null || (airagModel.getActivateFlag()!=null && airagModel.getActivateFlag() == 0)){
if (airagModel != null && oConvertUtils.isNotEmpty(airagModel.getId())) {
log.warn("模型未激活,采用默认文生图模型");
}
//判断是否配置了默认模型
if(aiChatConfig == null || oConvertUtils.isEmpty(aiChatConfig.getAiModelDraw().getApiKey())){
throw new JeecgBootBizTipException("当前系统未配置默认图像模型,请前往yml中配置默认模型");
}
airagModel = this.getDefaultDrawModel(aiChatConfig.getAiModelDraw());
}
params = mergeParams(airagModel, params);
try {
return llmHandler.imageGenerate(messages, params);
} catch (Exception e) {
throw translateLlmException(e, "调用绘画AI接口失败,详情请查看后台日志。");
}
}
/**
* 图生图
* @param modelId
* @param messages
* @param params
* @returnView on GitHub (pinned to 96fb33f5ec)
Solutions
- Configure the default image generation model in application.yml under the AI chat config section: set aiModelDraw with provider, apiKey, model name, and endpoint.
- Alternatively, activate an existing image model in the admin UI (set activateFlag to 1) so the fallback path is not needed.
- Verify that aiChatConfig is properly injected (not null) and the getAiModelDraw() returns a non-null object with a non-empty apiKey.
- Check the complete AI configuration block in application-dev.yml / application-prod.yml for the aiModelDraw section.
Example fix
# before (application.yml) — no default image model
jeecg:
aiChat:
aiModelDraw:
apiKey: # empty
# after
jeecg:
aiChat:
aiModelDraw:
provider: openai
apiKey: sk-your-api-key
modelName: dall-e-3
apiUrl: https://api.openai.com/v1/images/generations Defensive patterns
Strategy: validation
Validate before calling
// Before calling imageGenerate, verify model or default config
if ((airagModel == null || airagModel.getActivateFlag() == null || airagModel.getActivateFlag() == 0)
&& (aiChatConfig == null || aiChatConfig.getAiModelDraw() == null
|| aiChatConfig.getAiModelDraw().getApiKey() == null
|| aiChatConfig.getAiModelDraw().getApiKey().isEmpty())) {
throw new IllegalStateException("No image model available. Activate a model or configure aiModelDraw in yml.");
} Type guard
public static boolean hasImageGenCapability(AiragModel model, AiChatConfig config) {
if (model != null && model.getActivateFlag() != null && model.getActivateFlag() == 1) return true;
return config != null
&& config.getAiModelDraw() != null
&& config.getAiModelDraw().getApiKey() != null
&& !config.getAiModelDraw().getApiKey().isEmpty();
} Try / catch
try {
List<Map<String, Object>> images = aiChatHandler.imageGenerate(airagModel, messages, params);
return images;
} catch (JeecgBootBizTipException e) {
if (e.getMessage().contains("未配置默认图像模型")) {
// Return user-friendly guidance
return Collections.emptyList(); // or show configuration prompt
}
throw e;
} Prevention
- Configure a default image generation model in application.yml at deployment time
- Add a startup health check that verifies AI model configurations
- Activate at least one image model in the admin UI as a fallback
- Display configuration status in the admin dashboard
When it happens
Trigger: A text-to-image request is made with either no modelId, a null model, or a model with activateFlag=0. The code falls back to the default draw model configuration (aiChatConfig.getAiModelDraw()), but finds the API key is empty. This path is hit when the primary model is unavailable and the fallback is not configured.
Common situations: Fresh installation where AI image generation has never been configured. The AI model was deactivated in admin settings but no default was set in yml. The aiModelDraw configuration section is missing from application.yml. The API key was cleared during config migration.
Related errors
- result.getMessage()
- 调用大模型接口失败:
- 类 {ruleClass} 未实现 IFillRuleHandler 接口
- 数据源URL配置格式不正确!
- 动态数据源连接失败,dbKey:{dbKey}
AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14).
Data as JSON: /api/errors/73336508d00b310d.
Report an issue: GitHub.