对接模型工厂
This commit is contained in:
parent
ea506b84db
commit
f679922eb3
@ -59,6 +59,9 @@ public class LLMBackendProperties {
|
||||
@NotNull(message = "登录 POST")
|
||||
private String login;
|
||||
|
||||
private String loginUsername;
|
||||
private String loginPassword;
|
||||
|
||||
@NotNull(message = "基础模型列表 GET")
|
||||
private String baseModelList;
|
||||
|
||||
|
@ -3,11 +3,10 @@ package cn.iocoder.yudao.module.llm.service.http;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
|
||||
import cn.iocoder.yudao.module.llm.framework.backend.config.LLMBackendProperties;
|
||||
import cn.iocoder.yudao.module.llm.service.http.vo.RagEmbedReqVo;
|
||||
import cn.iocoder.yudao.module.llm.service.http.vo.RagQueryMultipleReqVo;
|
||||
import cn.iocoder.yudao.module.llm.service.http.vo.RagQueryReqVo;
|
||||
import cn.iocoder.yudao.module.llm.service.http.vo.*;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -17,6 +16,7 @@ import java.util.Map;
|
||||
* 训练相关接口
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TrainHttpService {
|
||||
|
||||
@Resource
|
||||
@ -98,10 +98,18 @@ public class TrainHttpService {
|
||||
/**
|
||||
* 登录 POST
|
||||
*/
|
||||
public String login(Map<String, String> headers, String body){
|
||||
public AigcLoginRespVO login(Map<String, String> headers){
|
||||
String login = llmBackendProperties.getLogin();
|
||||
String res = HttpUtils.post(login, headers, body);
|
||||
return res;
|
||||
AigcLoginReqVO req = new AigcLoginReqVO(llmBackendProperties.getLoginUsername(), llmBackendProperties.getLoginPassword());
|
||||
String res = HttpUtils.post(login, headers, JSON.toJSONString(req));
|
||||
log.info("登录接口返回:{}", res);
|
||||
AigcRespVO aigcRespVO = JSON.parseObject(res, AigcRespVO.class);
|
||||
if (aigcRespVO.isSuccess()){
|
||||
AigcLoginRespVO aigcLoginRespVO = JSON.parseObject(aigcRespVO.getData().toString(), AigcLoginRespVO.class);
|
||||
headers.put("Authorization", "Bearer " + aigcLoginRespVO.getToken());
|
||||
return aigcLoginRespVO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.llm.service.http.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AigcLoginReqVO {
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.llm.service.http.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AigcLoginRespVO {
|
||||
|
||||
private String token;
|
||||
private String username;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.llm.service.http.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AigcRespVO {
|
||||
|
||||
private boolean success;
|
||||
private int code;
|
||||
private Object data;
|
||||
private String message;
|
||||
private String traceId;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.llm.service.http.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FineTuningCreateVO {
|
||||
|
||||
private String scenario = "faq";
|
||||
private String fileId = "48fac97c-5a69-4fde-9f77-86f4de2e91eb";
|
||||
private String baseModel;
|
||||
private int trainEpoch;
|
||||
private String suffix;
|
||||
private String remark;
|
||||
private int trainBatchSize;
|
||||
private int evalBatchSize;
|
||||
private int accumulationSteps;
|
||||
private int procPerNode;
|
||||
private double learningRate;
|
||||
private int modelMaxLength;
|
||||
private boolean lora;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.llm.service.http.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FineTuningFileListRespVO {
|
||||
private boolean success;
|
||||
private int code;
|
||||
private ListData data;
|
||||
private String message;
|
||||
private String traceId;
|
||||
|
||||
// 嵌套在顶层类中的 Data 类
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class ListData {
|
||||
private List<FaqFile> list;
|
||||
private int total;
|
||||
}
|
||||
|
||||
// 嵌套在 Data 类中的 FaqFile 类
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class FaqFile {
|
||||
private int size;
|
||||
private String createdAt;
|
||||
private String fileId;
|
||||
private String filename;
|
||||
private String purpose;
|
||||
private String fileType;
|
||||
private int tenantId;
|
||||
private String s3Url;
|
||||
private int lineCount;
|
||||
private int tokenCount;
|
||||
|
||||
}
|
||||
}
|
@ -235,9 +235,13 @@ llm:
|
||||
# 大模型列表 GET
|
||||
models_list: http://localhost:8123/api/models
|
||||
# 登录 POST
|
||||
login: http://localhost:8123/login
|
||||
login: http://aigc.xhllm.xinnuojinzhi.com/api/auth/login
|
||||
login_username: admin
|
||||
login_password: admin
|
||||
# 创建微调任务 POST
|
||||
finetuning_create: http://localhost:8123/api/finetuning
|
||||
finetuning_create: http://aigc.xhllm.xinnuojinzhi.com/api/finetuning
|
||||
# 微调文件列表 GET
|
||||
finetuning_file_list: http://aigc.xhllm.xinnuojinzhi.com/api/files?purpose=fine-tune
|
||||
|
||||
#### 大模型对话
|
||||
# 基础模型列表 GET
|
||||
|
@ -278,9 +278,13 @@ llm:
|
||||
# 大模型列表 GET
|
||||
models_list: http://localhost:8123/api/models
|
||||
# 登录 POST
|
||||
login: http://localhost:8123/login
|
||||
login: http://aigc.xhllm.xinnuojinzhi.com/api/auth/login
|
||||
login_username: admin
|
||||
login_password: admin
|
||||
# 创建微调任务 POST
|
||||
finetuning_create: http://localhost:8123/api/finetuning
|
||||
finetuning_create: http://aigc.xhllm.xinnuojinzhi.com/api/finetuning
|
||||
# 微调文件列表 GET
|
||||
finetuning_file_list: http://aigc.xhllm.xinnuojinzhi.com/api/files?purpose=fine-tune
|
||||
|
||||
#### 大模型对话
|
||||
# 模型列表 GET
|
||||
|
Loading…
x
Reference in New Issue
Block a user