| | |
| | | } |
| | | |
| | | Map<String, Object> llmOptions = aiBot.getLlmOptions(); |
| | | String systemPrompt = llmOptions != null ? (String) llmOptions.get("systemPrompt") : null; |
| | | AiLlm aiLlm = aiLlmService.getById(aiBot.getLlmId()); |
| | | |
| | | if (aiLlm == null) { |
| | |
| | | aiBotConversationMessageService); |
| | | |
| | | final HistoriesPrompt historiesPrompt = new HistoriesPrompt(); |
| | | if (llmOptions.get("systemPrompt") != null) { |
| | | historiesPrompt.setSystemMessage(SystemMessage.of((String) llmOptions.get("systemPrompt"))); |
| | | if (systemPrompt != null) { |
| | | historiesPrompt.setSystemMessage(SystemMessage.of(systemPrompt)); |
| | | } |
| | | |
| | | historiesPrompt.setMemory(memory); |
| | | |
| | | HumanMessage humanMessage = new HumanMessage(prompt); |
| | |
| | | } |
| | | |
| | | Map<String, Object> llmOptions = aiBot.getLlmOptions(); |
| | | String systemPrompt = llmOptions != null ? (String) llmOptions.get("systemPrompt") : null; |
| | | |
| | | AiLlm aiLlm = aiLlmService.getById(aiBot.getLlmId()); |
| | | if (aiLlm == null) { |
| | | return createResponse(stream, JSON.toJSONString(errorRespnseMsg(5, "LLM不存在"))); |
| | |
| | | Llm llm = aiLlm.toLlm(); |
| | | AiBotExternalMessageMemory messageMemory = new AiBotExternalMessageMemory(messages); |
| | | HistoriesPrompt historiesPrompt = new HistoriesPrompt(); |
| | | if (llmOptions.get("systemPrompt") != null) { |
| | | historiesPrompt.setSystemMessage(SystemMessage.of((String) llmOptions.get("systemPrompt"))); |
| | | if (systemPrompt != null) { |
| | | historiesPrompt.setSystemMessage(SystemMessage.of(systemPrompt)); |
| | | } |
| | | historiesPrompt.setMemory(messageMemory); |
| | | |