feat: 集成 KieAI 服务,移除 models-integration 子项目
- 添加 Gemini 2.5 Flash 对话接口(流式+非流式) - 添加 NanoBanana 图像生成/编辑接口 - 添加 Sora2 视频生成接口(文生视频、图生视频、去水印) - 移除 models-integration 子项目(功能已迁移至主后端) - 新增测试文档和 Playwright E2E 配置 - 更新前端页面和 API 接口 - 更新后端配置和日志处理
This commit is contained in:
@@ -2,6 +2,7 @@ package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.config.KieAIConfig;
|
||||
import com.zbkj.common.request.kieai.CreateProTextToVideoRequest;
|
||||
import com.zbkj.common.request.kieai.KieAIGeminiChatRequest;
|
||||
import com.zbkj.common.request.kieai.KieAINanoBananaRequest;
|
||||
import com.zbkj.common.request.kieai.Sora2Request;
|
||||
import com.zbkj.common.response.kieai.KieAICreateTaskResponse;
|
||||
@@ -19,6 +20,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
@@ -49,6 +51,36 @@ public class KieAIController {
|
||||
@Autowired
|
||||
private KieAIConfig kieAIConfig;
|
||||
|
||||
// ==================== Gemini 2.5 Flash Chat ====================
|
||||
|
||||
/**
|
||||
* Gemini 2.5 Flash 对话(根据 stream 参数返回流式或非流式)
|
||||
*/
|
||||
@PostMapping("/gemini/chat")
|
||||
@ApiOperation(value = "Gemini 2.5 Flash 对话", notes = "根据 stream 参数返回流式(SSE)或非流式(JSON)")
|
||||
public Object geminiChat(@RequestBody @Validated KieAIGeminiChatRequest request) {
|
||||
try {
|
||||
if (Boolean.TRUE.equals(request.getStream())) {
|
||||
return toolKieAIService.geminiChatStream(request);
|
||||
}
|
||||
Map<String, Object> result = toolKieAIService.geminiChat(request);
|
||||
return CommonResult.success(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("Gemini chat 失败", e);
|
||||
return CommonResult.failed("Gemini 对话失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gemini 2.5 Flash 流式对话
|
||||
*/
|
||||
@PostMapping(value = "/gemini/chat/stream", produces = "text/event-stream")
|
||||
@ApiOperation(value = "Gemini 2.5 Flash 流式对话", notes = "使用 SSE 实时推送响应")
|
||||
public SseEmitter geminiChatStream(@RequestBody @Validated KieAIGeminiChatRequest request) {
|
||||
request.setStream(true);
|
||||
return toolKieAIService.geminiChatStream(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文本生成图像任务
|
||||
*/
|
||||
|
||||
@@ -312,6 +312,16 @@ public class ToolController {
|
||||
return CommonResult.success(toolKnowledgeService.getNutrientDetail(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* 为 cover_image 为空的饮食指南/科普文章生成封面图(KieAI 1:1,100KB 内,上传 OSS 并更新 v2_knowledge)
|
||||
*/
|
||||
@ApiOperation(value = "补全知识封面图")
|
||||
@PostMapping("/knowledge/fill-cover-images")
|
||||
public CommonResult<Integer> fillKnowledgeCoverImages(@RequestParam(defaultValue = "10") int limit) {
|
||||
int updated = toolKnowledgeService.fillMissingCoverImages(limit);
|
||||
return CommonResult.success(updated);
|
||||
}
|
||||
|
||||
// ==================== 打卡社区相关 ====================
|
||||
|
||||
/**
|
||||
@@ -486,6 +496,15 @@ public class ToolController {
|
||||
return CommonResult.success(toolHomeService.getHealthStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首页展示配置(如四大功能入口是否显示,由 eb_system_config 中 field01 控制,1=显示)
|
||||
*/
|
||||
@ApiOperation(value = "获取首页展示配置")
|
||||
@GetMapping("/home/display-config")
|
||||
public CommonResult<Map<String, Object>> getHomeDisplayConfig() {
|
||||
return CommonResult.success(toolHomeService.getDisplayConfig());
|
||||
}
|
||||
|
||||
// ==================== 食谱相关 ====================
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# CRMEB 相关配置
|
||||
crmeb:
|
||||
imagePath: /usr/local/crmeb/crmebimage/ # 服务器图片路径配置 斜杠结尾
|
||||
imagePath: /www/wwwroot/crmebimage/ # 服务器图片路径配置 斜杠结尾
|
||||
asyncConfig: true #是否同步config表数据到redis
|
||||
|
||||
server:
|
||||
|
||||
@@ -104,7 +104,9 @@ mybatis-plus:
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
|
||||
|
||||
# 行为验证码
|
||||
# 行为验证码(captcha.enabled: false 可关闭验证,便于测试)
|
||||
captcha:
|
||||
enabled: false
|
||||
aj:
|
||||
captcha:
|
||||
type: default # 验证码类型
|
||||
|
||||
Reference in New Issue
Block a user