提交 53489d62 作者: 洪东保

大模型配置

父级 e62f5d79
...@@ -86,6 +86,9 @@ public class FileProcessTask { ...@@ -86,6 +86,9 @@ public class FileProcessTask {
private String tencentSecretKey; private String tencentSecretKey;
private String tencentAdminUserId; private String tencentAdminUserId;
private String llmApiAddr; private String llmApiAddr;
private String llmApiModel;
private String llmApiToken;
private Integer llmApiMaxTokens;
private Boolean finalRetry; //表示是兜底重试机制 private Boolean finalRetry; //表示是兜底重试机制
private MeetingInfoMapper meetingInfoMapper; private MeetingInfoMapper meetingInfoMapper;
...@@ -433,10 +436,10 @@ public class FileProcessTask { ...@@ -433,10 +436,10 @@ public class FileProcessTask {
* @return * @return
*/ */
private String choiceTemplateType(String subject,String textContent) { private String choiceTemplateType(String subject,String textContent) {
String token = "AKIAXFAXF62IWJXGLVEE.LnKInaahcMZG9zLsGMH3nTLOw3S3lK5Vcu0+ifnO"; String token = "Bearer " + llmApiToken;
String apiAddr = llmApiAddr + "/llm/sse-invoke"; String apiAddr = llmApiAddr;
String model = "arn:aws:bedrock:us-east-1:491822380689:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0"; String model = llmApiModel;
int maxTokens = 5000; int maxTokens = llmApiMaxTokens;
String prompt = "请先对以下会议转写记录进行简要总结(不超过200字),然后根据会议主题以及总结内容判断该会议最可能属于哪种类型:\\n\\n会议主题: {0}\\n会议转写记录: {1}\\n\\n第一步:请简要总结会议的主要内容和目的(不超过200字)。\\n\\n第二步:根据上述总结和会议主题,将会议分类为以下类型之一:\\n1. 项目沟通会 - 与具体项目进展、问题讨论相关的会议\\n2. 重要会议 - 高层决策、战略规划等重要会议\\n3. 启动会 - 项目启动、活动筹备等初始会议\\n4. 其他 - 不符合以上任何分类\\n\\n分类权重判断规则:\\n- 基础权重分配:会议内容总结(70%)、会议主题(30%)\\n- 会议主题权重动态调整:\\n * 如果会议主题包含明确分类关键词(如\\\"启动会\\\"、\\\"项目沟通\\\"、\\\"战略决策\\\"等),则会议主题权重提升至60%,总结内容权重调整为40%\\n * 如果会议主题过于简单或模糊(如仅包含\\\"沟通\\\"、\\\"讨论\\\"、\\\"会议\\\"等通用词),则会议主题权重降低至15%,总结内容权重提升至85%\\n- 一致性判断:如果会议主题和总结内容指向不同分类,优先采用内容总结的分类,除非会议主题非常明确且规范\\n\\n输出格式:\\n请只返回分类名称(如\\\"项目沟通会\\\"),不要包含其他内容(如生成的会议总结等)。"; String prompt = "请先对以下会议转写记录进行简要总结(不超过200字),然后根据会议主题以及总结内容判断该会议最可能属于哪种类型:\\n\\n会议主题: {0}\\n会议转写记录: {1}\\n\\n第一步:请简要总结会议的主要内容和目的(不超过200字)。\\n\\n第二步:根据上述总结和会议主题,将会议分类为以下类型之一:\\n1. 项目沟通会 - 与具体项目进展、问题讨论相关的会议\\n2. 重要会议 - 高层决策、战略规划等重要会议\\n3. 启动会 - 项目启动、活动筹备等初始会议\\n4. 其他 - 不符合以上任何分类\\n\\n分类权重判断规则:\\n- 基础权重分配:会议内容总结(70%)、会议主题(30%)\\n- 会议主题权重动态调整:\\n * 如果会议主题包含明确分类关键词(如\\\"启动会\\\"、\\\"项目沟通\\\"、\\\"战略决策\\\"等),则会议主题权重提升至60%,总结内容权重调整为40%\\n * 如果会议主题过于简单或模糊(如仅包含\\\"沟通\\\"、\\\"讨论\\\"、\\\"会议\\\"等通用词),则会议主题权重降低至15%,总结内容权重提升至85%\\n- 一致性判断:如果会议主题和总结内容指向不同分类,优先采用内容总结的分类,除非会议主题非常明确且规范\\n\\n输出格式:\\n请只返回分类名称(如\\\"项目沟通会\\\"),不要包含其他内容(如生成的会议总结等)。";
//占位符信息替换 //占位符信息替换
String formatPrompt = formatMessage(prompt, subject, textContent); String formatPrompt = formatMessage(prompt, subject, textContent);
...@@ -463,29 +466,11 @@ public class FileProcessTask { ...@@ -463,29 +466,11 @@ public class FileProcessTask {
*/ */
private String processWithClaude(String textContent, String meetingDate,String participantNames, String prompt) { private String processWithClaude(String textContent, String meetingDate,String participantNames, String prompt) {
// //将文件传送给大模型处理 // //将文件传送给大模型处理
// String token = "AKIAXFAXF62IWJXGLVEE.LnKInaahcMZG9zLsGMH3nTLOw3S3lK5Vcu0+ifnO"; String model = llmApiModel;
// String apiAddr = llmApiAddr + "/llm/sse-invoke";
// String model = "anthropic.claude-3-5-sonnet-20240620-v1:0";
// int maxTokens = 5000;
// List<Message> messages = new ArrayList<>();
//
// ChatMessage chatMessage = new ChatMessage(ChatMessageRole.USER.value(), prompt.replaceAll("\\{transcript\\}",textContent).replaceAll("\\{meetingDate\\}",meetingDate));
// messages.add(chatMessage);
//// chatMessage = new ChatMessage(ChatMessageRole.ASSISTANT.value(), "好的请提供会议记录");
//// messages.add(chatMessage);
//// chatMessage = new ChatMessage(ChatMessageRole.USER.value(), textContent);
//
// messages.add(chatMessage);
//
// // 调用Claude API处理文件
// String ret = call_llm(apiAddr, model, token, messages, maxTokens);
// String model = "arn:aws:bedrock:us-east-1:491822380689:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0";
String model = "arn:aws:bedrock:us-east-1:491822380689:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0";
LLMConfig baseLLM = new LLMConfig(model, LLMConfig baseLLM = new LLMConfig(model,
llmApiAddr + "/llm/sse-invoke", llmApiAddr,
"Bearer AKIAXFAXF62IWJXGLVEE.LnKInaahcMZG9zLsGMH3nTLOw3S3lK5Vcu0+ifnO", "Bearer " + llmApiToken,
20000); llmApiMaxTokens);
LLMResult llmResult = MeetingProcess.processMeeting(prompt, textContent,meetingDate,participantNames, baseLLM, new ArrayList<>()); LLMResult llmResult = MeetingProcess.processMeeting(prompt, textContent,meetingDate,participantNames, baseLLM, new ArrayList<>());
// DebugOutputTool.println(llmResult.respond); // DebugOutputTool.println(llmResult.respond);
return llmResult.respond; return llmResult.respond;
...@@ -755,7 +740,7 @@ public class FileProcessTask { ...@@ -755,7 +740,7 @@ public class FileProcessTask {
public FileProcessTask(List<String> recordFileIdList, String meetingId, String subMeetingId, String savePath, Map<String, Object> metadata, String tencentAppId, public FileProcessTask(List<String> recordFileIdList, String meetingId, String subMeetingId, String savePath, Map<String, Object> metadata, String tencentAppId,
String tencentSdkId, String tencentSecretId, String tencentSecretKey, String tencentAdminUserId, String tencentSdkId, String tencentSecretId, String tencentSecretKey, String tencentAdminUserId,
MeetingInfoMapper meetingInfoMapper, MinioUtils minioUtils, RedisUtils redisUtils, EmailSender emailSender, MeetingRecordTemplateMapper meetingRecordTemplateMapper, MeetingInfoMapper meetingInfoMapper, MinioUtils minioUtils, RedisUtils redisUtils, EmailSender emailSender, MeetingRecordTemplateMapper meetingRecordTemplateMapper,
String llmApiAddr, Boolean finalRetry, ProcessLogService processLogService,List<UserDTO.TemplateAuthorizedUserDTO> authorizedUsers,Map<String,String> tidWidRelations, String llmApiAddr, String llmApiModel, String llmApiToken, Integer llmApiMaxTokens, Boolean finalRetry, ProcessLogService processLogService,List<UserDTO.TemplateAuthorizedUserDTO> authorizedUsers,Map<String,String> tidWidRelations,
UserAdminConfig userAdminConfig, String adminToken, String applicationId,String fileDownloadPath, String permTenantId, UserAdminConfig userAdminConfig, String adminToken, String applicationId,String fileDownloadPath, String permTenantId,
String aesKey) { String aesKey) {
this.recordFileIdList = recordFileIdList; this.recordFileIdList = recordFileIdList;
...@@ -774,6 +759,9 @@ public class FileProcessTask { ...@@ -774,6 +759,9 @@ public class FileProcessTask {
this.emailSender = emailSender; this.emailSender = emailSender;
this.meetingRecordTemplateMapper = meetingRecordTemplateMapper; this.meetingRecordTemplateMapper = meetingRecordTemplateMapper;
this.llmApiAddr = llmApiAddr; this.llmApiAddr = llmApiAddr;
this.llmApiModel = llmApiModel;
this.llmApiToken = llmApiToken;
this.llmApiMaxTokens = llmApiMaxTokens;
this.finalRetry = finalRetry; this.finalRetry = finalRetry;
this.processLogService = processLogService; this.processLogService = processLogService;
this.authorizedUsers = authorizedUsers; this.authorizedUsers = authorizedUsers;
......
...@@ -50,6 +50,12 @@ public class FileProcessProducer { ...@@ -50,6 +50,12 @@ public class FileProcessProducer {
private String tencentAdminUserId; private String tencentAdminUserId;
@Value(value = "${llm.api-addr}") @Value(value = "${llm.api-addr}")
private String llmApiAddr; private String llmApiAddr;
@Value(value = "${llm.api-model}")
private String llmApiModel;
@Value(value = "${llm.api-token}")
private String llmApiToken;
@Value(value = "${llm.api-max-tokens}")
private Integer llmApiMaxTokens;
@Value(value = "${tencent.base-save-path}") @Value(value = "${tencent.base-save-path}")
private String baseSavePath; private String baseSavePath;
@Value("${permission.applicationId}") @Value("${permission.applicationId}")
...@@ -105,6 +111,9 @@ public class FileProcessProducer { ...@@ -105,6 +111,9 @@ public class FileProcessProducer {
emailSender, emailSender,
meetingRecordTemplateMapper, meetingRecordTemplateMapper,
llmApiAddr, llmApiAddr,
llmApiModel,
llmApiToken,
llmApiMaxTokens,
finalRetry, finalRetry,
processLogService, processLogService,
authorizedUsers, authorizedUsers,
...@@ -113,8 +122,7 @@ public class FileProcessProducer { ...@@ -113,8 +122,7 @@ public class FileProcessProducer {
adminToken, adminToken,
applicationId, applicationId,
fileDownloadPath, fileDownloadPath,
permTenantId, permTenantId, aesKey
aesKey
); );
// 提交任务到线程池 // 提交任务到线程池
......
...@@ -89,6 +89,12 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -89,6 +89,12 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
private String tencentAdminUserId; private String tencentAdminUserId;
@Value(value = "${llm.api-addr}") @Value(value = "${llm.api-addr}")
private String llmApiAddr; private String llmApiAddr;
@Value(value = "${llm.api-model}")
private String llmApiModel;
@Value(value = "${llm.api-token}")
private String llmApiToken;
@Value(value = "${llm.api-max-tokens}")
private Integer llmApiMaxTokens;
@Value(value = "${tencent.base-save-path}") @Value(value = "${tencent.base-save-path}")
private String baseSavePath; private String baseSavePath;
@Resource @Resource
...@@ -282,10 +288,10 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -282,10 +288,10 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
*/ */
private String processWithClaude(String textContent, String meetingDate, String prompt,String meetingId, String subMeetingId) { private String processWithClaude(String textContent, String meetingDate, String prompt,String meetingId, String subMeetingId) {
//将文件传送给大模型处理 //将文件传送给大模型处理
String token = "AKIAXFAXF62IWJXGLVEE.LnKInaahcMZG9zLsGMH3nTLOw3S3lK5Vcu0+ifnO"; String token = "Bearer " + llmApiToken;
String apiAddr = llmApiAddr + "/llm/sse-invoke"; String apiAddr = llmApiAddr;
String model = "arn:aws:bedrock:us-east-1:491822380689:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0"; String model = llmApiModel;
int maxTokens = 5000; int maxTokens = llmApiMaxTokens;
List<Message> messages = new ArrayList<>(); List<Message> messages = new ArrayList<>();
ChatMessage chatMessage = new ChatMessage(ChatMessageRole.USER.value(), prompt.replaceAll("\\{transcript\\}",textContent).replaceAll("\\{meetingDate\\}",meetingDate)); ChatMessage chatMessage = new ChatMessage(ChatMessageRole.USER.value(), prompt.replaceAll("\\{transcript\\}",textContent).replaceAll("\\{meetingDate\\}",meetingDate));
......
...@@ -64,6 +64,12 @@ public class RecordTemplatePermissionServiceImpl extends ServiceImpl<RecordTempl ...@@ -64,6 +64,12 @@ public class RecordTemplatePermissionServiceImpl extends ServiceImpl<RecordTempl
private MinioUtils minioUtils; private MinioUtils minioUtils;
@Value(value = "${llm.api-addr}") @Value(value = "${llm.api-addr}")
private String llmApiAddr; private String llmApiAddr;
@Value(value = "${llm.api-model}")
private String llmApiModel;
@Value(value = "${llm.api-token}")
private String llmApiToken;
@Value(value = "${llm.api-max-tokens}")
private Integer llmApiMaxTokens;
/** /**
* 授权 * 授权
...@@ -189,11 +195,10 @@ public class RecordTemplatePermissionServiceImpl extends ServiceImpl<RecordTempl ...@@ -189,11 +195,10 @@ public class RecordTemplatePermissionServiceImpl extends ServiceImpl<RecordTempl
} }
} }
String model = "arn:aws:bedrock:us-east-1:491822380689:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0"; LLMConfig baseLLM = new LLMConfig(llmApiModel,
LLMConfig baseLLM = new LLMConfig(model, llmApiAddr,
llmApiAddr + "/llm/sse-invoke", "Bearer " + llmApiToken,
"Bearer AKIAXFAXF62IWJXGLVEE.LnKInaahcMZG9zLsGMH3nTLOw3S3lK5Vcu0+ifnO", llmApiMaxTokens);
20000);
LLMResult llmResult = MeetingProcess.processMeeting(prompt, textContent,meetingDate,participantNames, baseLLM, new ArrayList<>()); LLMResult llmResult = MeetingProcess.processMeeting(prompt, textContent,meetingDate,participantNames, baseLLM, new ArrayList<>());
DebugOutputTool.println(llmResult.respond); DebugOutputTool.println(llmResult.respond);
......
...@@ -13,7 +13,10 @@ REDIS_PASS: standard123 ...@@ -13,7 +13,10 @@ REDIS_PASS: standard123
REDIS_DATABASE: 3 REDIS_DATABASE: 3
############################################################## llm ############################################################## llm
# local # local
LLM_API_ADDR: https://bedrock.chatbot.cn LLM_API_ADDR: https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
LLM_API_MODEL: qwen-plus
LLM_API_TOKEN: sk-58046ac63cae4317b65fb151965169d1
LLM_API_MAX_TOKENS: 16000
# prod # prod
#LLM_API_ADDR: http://10.56.1.150:8000 #LLM_API_ADDR: http://10.56.1.150:8000
############################################################## tencent meeting ############################################################## tencent meeting
...@@ -126,6 +129,9 @@ email: ...@@ -126,6 +129,9 @@ email:
llm: llm:
api-addr: ${LLM_API_ADDR} api-addr: ${LLM_API_ADDR}
api-model: ${LLM_API_MODEL}
api-token: ${LLM_API_TOKEN}
api-max-tokens: ${LLM_API_MAX_TOKENS}
#解密key #解密key
aec: aec:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论