添加apikey国密sm4加解密,agent configs配置功能
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
package com.labelsys.backend.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.labelsys.backend.util.SM4Util;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("annotation_agent_configs")
|
||||
public class AnnotationAgentConfig {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField("company_id")
|
||||
private Long companyId; // 所属公司ID,来源于annotation_task.company_id
|
||||
|
||||
@TableField("agent_type")
|
||||
private String agentType; // Agent角色: extract(抽取/Analyzer+Regenerator) / verify(校验/Reviewer) / industry(行业识别) / hallucination(幻觉检测)
|
||||
|
||||
@TableField("model_config_id")
|
||||
private Long modelConfigId; // 模型配置来源ID,外键引用sys_config.id,任务启动时从sys_config(config_type=MODEL, status=ENABLED)获取
|
||||
|
||||
@TableField("model_name")
|
||||
private String modelName; // 模型名称快照,如: qwen-max / glm-4 / claude-3-opus
|
||||
|
||||
@TableField("model_url")
|
||||
private String modelUrl; // 模型调用地址快照
|
||||
|
||||
@TableField("model_api_key")
|
||||
private String modelApiKey; // 模型调用密钥快照(需要加密存储)
|
||||
|
||||
@TableField("prompt_config_id")
|
||||
private Long promptConfigId; // Prompt配置来源ID,外键引用sys_config.id,任务启动时从sys_config(config_type=PROMPT, status=ENABLED)获取
|
||||
|
||||
@TableField("prompt_text")
|
||||
private String promptText; // Prompt文本快照,任务执行期间实际使用的提示词
|
||||
|
||||
@TableField(value = "config_snapshot", typeHandler = JacksonTypeHandler.class)
|
||||
private JsonNode configSnapshot; // 完整配置快照JSON,包含temperature、max_tokens等运行时参数
|
||||
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt; // 快照创建时间
|
||||
|
||||
@TableField("llm_type")
|
||||
private String llmType; // LLM类型,如:text, audio, video, image等,默认为'text'
|
||||
|
||||
// Getter和Setter方法
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(Long companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getAgentType() {
|
||||
return agentType;
|
||||
}
|
||||
|
||||
public void setAgentType(String agentType) {
|
||||
this.agentType = agentType;
|
||||
}
|
||||
|
||||
public Long getModelConfigId() {
|
||||
return modelConfigId;
|
||||
}
|
||||
|
||||
public void setModelConfigId(Long modelConfigId) {
|
||||
this.modelConfigId = modelConfigId;
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return modelName;
|
||||
}
|
||||
|
||||
public void setModelName(String modelName) {
|
||||
this.modelName = modelName;
|
||||
}
|
||||
|
||||
public String getModelUrl() {
|
||||
return modelUrl;
|
||||
}
|
||||
|
||||
public void setModelUrl(String modelUrl) {
|
||||
this.modelUrl = modelUrl;
|
||||
}
|
||||
|
||||
public String getModelApiKey() {
|
||||
if (this.modelApiKey != null) {
|
||||
return SM4Util.decryptSafe(this.modelApiKey); // 解密返回
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setModelApiKey(String modelApiKey) {
|
||||
if (modelApiKey != null) {
|
||||
this.modelApiKey = SM4Util.encrypt(modelApiKey); // 加密存储
|
||||
}
|
||||
}
|
||||
|
||||
public Long getPromptConfigId() {
|
||||
return promptConfigId;
|
||||
}
|
||||
|
||||
public void setPromptConfigId(Long promptConfigId) {
|
||||
this.promptConfigId = promptConfigId;
|
||||
}
|
||||
|
||||
public String getPromptText() {
|
||||
return promptText;
|
||||
}
|
||||
|
||||
public void setPromptText(String promptText) {
|
||||
this.promptText = promptText;
|
||||
}
|
||||
|
||||
public JsonNode getConfigSnapshot() {
|
||||
return configSnapshot;
|
||||
}
|
||||
|
||||
public void setConfigSnapshot(JsonNode configSnapshot) {
|
||||
this.configSnapshot = configSnapshot;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(LocalDateTime createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public String getLlmType() {
|
||||
return llmType;
|
||||
}
|
||||
|
||||
public void setLlmType(String llmType) {
|
||||
this.llmType = llmType;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user