mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-09-16 01:44:57 +00:00
fix: 工作流实体保留字转义 + 千问向量模型厂商映射
1. WorkflowRuntimeNode/WorkflowRuntime: input/output/status 字段加反引号, 修复 MySQL 8.0 保留字导致 MyBatis-Plus SQL 解析异常 (#307) 2. EmbeddingModelFactory: 新增 providerCode→BeanName 映射, qianwen→alibailian,修复千问向量模型找不到 Bean 的问题 (#301) Closes #307 #301 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -27,13 +27,13 @@ public class WorkflowRuntime extends BaseEntity {
|
|||||||
@TableField("workflow_id")
|
@TableField("workflow_id")
|
||||||
private Long workflowId;
|
private Long workflowId;
|
||||||
|
|
||||||
@TableField(value = "input")
|
@TableField(value = "`input`")
|
||||||
private String input;
|
private String input;
|
||||||
|
|
||||||
@TableField(value = "output")
|
@TableField(value = "`output`")
|
||||||
private String output;
|
private String output;
|
||||||
|
|
||||||
@TableField("status")
|
@TableField("`status`")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@TableField("status_remark")
|
@TableField("status_remark")
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ public class WorkflowRuntimeNode extends BaseEntity {
|
|||||||
@TableField("node_id")
|
@TableField("node_id")
|
||||||
private Long nodeId;
|
private Long nodeId;
|
||||||
|
|
||||||
@TableField(value = "input")
|
@TableField(value = "`input`")
|
||||||
private String input;
|
private String input;
|
||||||
|
|
||||||
@TableField(value = "output")
|
@TableField(value = "`output`")
|
||||||
private String output;
|
private String output;
|
||||||
|
|
||||||
@TableField("status")
|
@TableField("`status`")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@TableField("status_remark")
|
@TableField("status_remark")
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class EmbeddingModelFactory {
|
public class EmbeddingModelFactory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 厂商 providerCode → Spring Bean 名称映射
|
||||||
|
* 处理 providerCode 与 @Component 注册名不一致的情况
|
||||||
|
*/
|
||||||
|
private static final Map<String, String> PROVIDER_BEAN_MAPPING = Map.of(
|
||||||
|
"qianwen", "alibailian"
|
||||||
|
);
|
||||||
|
|
||||||
private final ApplicationContext applicationContext;
|
private final ApplicationContext applicationContext;
|
||||||
|
|
||||||
private final IChatModelService chatModelService;
|
private final IChatModelService chatModelService;
|
||||||
@@ -116,8 +124,10 @@ public class EmbeddingModelFactory {
|
|||||||
*/
|
*/
|
||||||
private BaseEmbedModelService createModelInstance(String factory, ChatModelVo config) {
|
private BaseEmbedModelService createModelInstance(String factory, ChatModelVo config) {
|
||||||
try {
|
try {
|
||||||
|
// 解析实际的 Bean 名称(处理 providerCode 与 @Component 注册名不一致的情况)
|
||||||
|
String beanName = PROVIDER_BEAN_MAPPING.getOrDefault(factory, factory);
|
||||||
// 从Spring上下文中获取模型实例
|
// 从Spring上下文中获取模型实例
|
||||||
BaseEmbedModelService model = applicationContext.getBean(factory, BaseEmbedModelService.class);
|
BaseEmbedModelService model = applicationContext.getBean(beanName, BaseEmbedModelService.class);
|
||||||
// 配置模型参数
|
// 配置模型参数
|
||||||
model.configure(config);
|
model.configure(config);
|
||||||
// 增加嵌入模型监听器
|
// 增加嵌入模型监听器
|
||||||
|
|||||||
Reference in New Issue
Block a user