mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-04-05 07:47:31 +00:00
应用增加系统角色提示词
This commit is contained in:
@@ -103,4 +103,9 @@ public class ChatGpts extends BaseEntity {
|
||||
private String modelName;
|
||||
|
||||
|
||||
/**
|
||||
* 模型system
|
||||
*/
|
||||
private String systemPrompt;
|
||||
|
||||
}
|
||||
|
||||
@@ -84,4 +84,14 @@ public class ChatGptsBo extends BaseEntity {
|
||||
*/
|
||||
private String updateIp;
|
||||
|
||||
/**
|
||||
* 模型名称
|
||||
*/
|
||||
private String modelName;
|
||||
|
||||
/**
|
||||
* 模型system
|
||||
*/
|
||||
private String systemPrompt;
|
||||
|
||||
}
|
||||
|
||||
@@ -102,5 +102,10 @@ public class ChatGptsVo implements Serializable {
|
||||
@ExcelProperty(value = "模型名称")
|
||||
private String modelName;
|
||||
|
||||
/**
|
||||
* 模型system
|
||||
*/
|
||||
private String systemPrompt;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public class SseServiceImpl implements ISseService {
|
||||
openAiStreamClient = chatConfig.createOpenAiStreamClient(sysModel.getApiHost(), sysModel.getApiKey());
|
||||
if (StringUtils.isNotEmpty(chatRequest.getAppId())) { // 设置应用的系统角色为描述
|
||||
ChatGptsVo chatGptsVo = chatGptsService.queryById(Long.valueOf(chatRequest.getAppId()));
|
||||
Message sysMessage = Message.builder().content(chatGptsVo.getInfo()).role(Message.Role.SYSTEM).build();
|
||||
Message sysMessage = Message.builder().content(chatGptsVo.getSystemPrompt()).role(Message.Role.SYSTEM).build();
|
||||
messages.add(0,sysMessage);
|
||||
} else {
|
||||
// 模型设置默认提示词
|
||||
|
||||
Reference in New Issue
Block a user