Merge remote-tracking branch 'origin/master'

This commit is contained in:
limin 2024-12-31 16:42:50 +08:00
commit e79d8c8956
6 changed files with 193 additions and 7 deletions

View File

@ -78,7 +78,7 @@ public class KnowledgeBaseController {
}
@GetMapping("/list")
@Operation(summary = "获得知识库分页")
@Operation(summary = "获得知识库列表,下拉菜单")
@PreAuthorize("@ss.hasPermission('llm:knowledge-base:query')")
public CommonResult<List<KnowledgeBaseRespVO>> getKnowledgeBaseList() {
List<KnowledgeBaseDO> list = knowledgeBaseService.getKnowledgeBaseList();

View File

@ -59,9 +59,12 @@ public class LLMBackendProperties {
@NotNull(message = "登录 POST")
private String login;
@NotNull(message = "模型列表 GET")
private String modelList;
@NotNull(message = "基础模型列表 GET")
private String baseModelList;
@NotNull(message = "大模型聊天 POST")
private String modelCompletions;
@NotNull(message = "创建微调任务 POST")
private String finetuningCreate;
}

View File

@ -0,0 +1,55 @@
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 org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;
/**
* 模型对话相关接口
*/
@Service
public class DialogueHttpService {
@Resource
private LLMBackendProperties llmBackendProperties;
/**
* 登录 POST
*/
public String login(Map<String, String> headers, String body){
String login = llmBackendProperties.getLogin();
String res = HttpUtils.post(login, headers, body);
return res;
}
/**
* 大模型列表 GET
*/
public String modelsList(Map<String, String> headers){
String modelsList = llmBackendProperties.getModelsList();
String res = HttpUtils.get(modelsList, headers);
return res;
}
/**
* 基础模型列表 GET
*/
public String baseModelList(Map<String, String> headers){
String baseModelList = llmBackendProperties.getBaseModelList();
String res = HttpUtils.get(baseModelList, headers);
return res;
}
/**
* 模型对话 POST
*/
public String modelCompletions(Map<String, String> headers, String body){
String finetuningCreate = llmBackendProperties.getModelCompletions();
String res = HttpUtils.post(finetuningCreate, headers, body);
return res;
}
}

View File

@ -13,6 +13,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;
/**
* rag相关接口
*/
@Service
public class RagHttpService {
@ -83,5 +86,4 @@ public class RagHttpService {
return res;
}
}

View File

@ -0,0 +1,124 @@
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 com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;
/**
* 训练相关接口
*/
@Service
public class TrainHttpService {
@Resource
private LLMBackendProperties llmBackendProperties;
/**
* 训练集列表 GET
*/
public String datasetList(Map<String, String> headers){
String datasetList = llmBackendProperties.getDatasetList();
String res = HttpUtils.get(datasetList, headers);
return res;
}
/**
* 上传训练集 POST
*/
public String datasetCreate(Map<String, String> headers, String body){
String datasetCreate = llmBackendProperties.getDatasetCreate();
String res = HttpUtils.post(datasetCreate, headers, body);
return res;
}
/**
* 删除训练集 DELETE
*/
public String datasetDelete(Map<String,String> headers){
String datasetDelete = llmBackendProperties.getDatasetDelete();
String res = HttpUtils.del(datasetDelete, headers);
return res;
}
/**
* 训练集标注 GET
*/
public String annotationTaskList(Map<String, String> headers){
String annotationTaskList = llmBackendProperties.getAnnotationTaskList();
String res = HttpUtils.get(annotationTaskList, headers);
return res;
}
/**
* 标注信息 GET
*/
public String annotationTask(Map<String, String> headers){
String annotationTask = llmBackendProperties.getAnnotationTask();
String res = HttpUtils.get(annotationTask, headers);
return res;
}
/**
* 保存标注 POST
*/
public String annotationTaskSave(Map<String, String> headers, String body){
String annotationTaskSave = llmBackendProperties.getAnnotationTaskSave();
String res = HttpUtils.post(annotationTaskSave, headers, body);
return res;
}
/**
* 大模型列表 GET
*/
public String modelsList(Map<String, String> headers){
String modelsList = llmBackendProperties.getModelsList();
String res = HttpUtils.get(modelsList, headers);
return res;
}
/**
* 基础模型列表 GET
*/
public String baseModelList(Map<String, String> headers){
String baseModelList = llmBackendProperties.getBaseModelList();
String res = HttpUtils.get(baseModelList, headers);
return res;
}
/**
* 登录 POST
*/
public String login(Map<String, String> headers, String body){
String login = llmBackendProperties.getLogin();
String res = HttpUtils.post(login, headers, body);
return res;
}
/**
* 创建微调任务 POST
*/
public String finetuningCreate(Map<String, String> headers, String body){
String finetuningCreate = llmBackendProperties.getFinetuningCreate();
String res = HttpUtils.post(finetuningCreate, headers, body);
return res;
}
/**
* 模型对话 POST
*/
public String modelCompletions(Map<String, String> headers, String body){
String finetuningCreate = llmBackendProperties.getModelCompletions();
String res = HttpUtils.post(finetuningCreate, headers, body);
return res;
}
}

View File

@ -236,10 +236,12 @@ llm:
models_list: http://localhost:8123/api/models
# 登录 POST
login: http://localhost:8123/login
# 创建微调任务 POST
finetuning_create: http://localhost:8123/api/finetuning
#### 大模型对话
# 模型列表 GET
model_list: http://api.xhllm.xinnuojinzhi.com/model/v1/models
# 基础模型列表 GET
base_model_list: http://api.xhllm.xinnuojinzhi.com/model/v1/models
# 模型对话 POST
model_completions: http://api.xhllm.xinnuojinzhi.com/model/v1/chat/completions
@ -259,4 +261,4 @@ iot:
# 保持连接
keepalive: 60
# 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息)
clearSession: true
clearSession: true