增加模型工厂的租户ID
This commit is contained in:
parent
a7c8073101
commit
04efc7f95d
@ -58,7 +58,7 @@ public class LLMBackendProperties {
|
||||
|
||||
@NotNull(message = "登录 POST")
|
||||
private String login;
|
||||
private String loginTenantId;
|
||||
private String account;
|
||||
private String loginUsername;
|
||||
private String loginPassword;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.llm.service.http;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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.*;
|
||||
@ -104,10 +105,28 @@ public class TrainHttpService {
|
||||
String res = HttpUtils.post(login, headers, JSON.toJSONString(req));
|
||||
log.info("登录接口返回:{}", res);
|
||||
AigcRespVO aigcRespVO = JSON.parseObject(res, AigcRespVO.class);
|
||||
if (aigcRespVO.isSuccess()){
|
||||
if (aigcRespVO.isSuccess() && aigcRespVO.getData() != null){
|
||||
AigcLoginRespVO aigcLoginRespVO = JSON.parseObject(aigcRespVO.getData().toString(), AigcLoginRespVO.class);
|
||||
headers.put("Authorization", "Bearer " + aigcLoginRespVO.getToken());
|
||||
return aigcLoginRespVO;
|
||||
headers.put("X-Token", aigcLoginRespVO.getToken());
|
||||
AigcAccountRespVO aigcAccountRespVO = account(headers);
|
||||
if (aigcAccountRespVO != null && CollUtil.isNotEmpty(aigcAccountRespVO.getTenants())) {
|
||||
aigcLoginRespVO.setTenantId(aigcAccountRespVO.getTenants().get(0).getId());
|
||||
log.info(" login:{}", aigcAccountRespVO);
|
||||
return aigcLoginRespVO;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public AigcAccountRespVO account(Map<String, String> headers){
|
||||
String account = llmBackendProperties.getAccount();
|
||||
String res = HttpUtils.get(account, headers);
|
||||
log.info(" account:{}", res);
|
||||
AigcRespVO aigcRespVO = JSON.parseObject(res, AigcRespVO.class);
|
||||
if (aigcRespVO.isSuccess() && aigcRespVO.getData() != null){
|
||||
AigcAccountRespVO aigcAccountRespVO = JSON.parseObject(aigcRespVO.getData().toString(), AigcAccountRespVO.class);
|
||||
log.info(" account:{}", aigcAccountRespVO);
|
||||
return aigcAccountRespVO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
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 AigcAccountRespVO {
|
||||
|
||||
// 租户列表,由于JSON中是一个数组,所以这里用List<Tenant>来表示
|
||||
private List<Tenant> tenants;
|
||||
// 电子邮件地址
|
||||
private String email;
|
||||
// 昵称
|
||||
private String nickname;
|
||||
// 语言设置
|
||||
private String language;
|
||||
|
||||
// 嵌套的Tenant类,用于表示租户信息
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class Tenant {
|
||||
|
||||
// 租户ID
|
||||
private String id;
|
||||
// 租户名称
|
||||
private String name;
|
||||
}
|
||||
}
|
@ -11,4 +11,5 @@ public class AigcLoginRespVO {
|
||||
|
||||
private String token;
|
||||
private String username;
|
||||
private String tenantId;
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ llm:
|
||||
models_list: http://localhost:8123/api/models
|
||||
# 登录 POST
|
||||
login: http://aigc.xhllm.xinnuojinzhi.com/api/auth/login
|
||||
login_tenant_id: 5c4e33fb-7ae2-4a48-9a78-fb74e4634d16
|
||||
account: http://aigc.xhllm.xinnuojinzhi.com/api/auth/account
|
||||
login_username: admin
|
||||
login_password: admin
|
||||
# 创建微调任务 POST
|
||||
|
@ -279,7 +279,7 @@ llm:
|
||||
models_list: http://localhost:8123/api/models
|
||||
# 登录 POST
|
||||
login: http://aigc.xhllm.xinnuojinzhi.com/api/auth/login
|
||||
login_tenant_id: 5c4e33fb-7ae2-4a48-9a78-fb74e4634d16
|
||||
account: http://aigc.xhllm.xinnuojinzhi.com/api/auth/account
|
||||
login_username: admin
|
||||
login_password: admin
|
||||
# 创建微调任务 POST
|
||||
|
Loading…
x
Reference in New Issue
Block a user