|
...
|
...
|
@@ -218,25 +218,6 @@ public class AiragResponseServiceImpl implements AiragResponseService { |
|
|
|
emitter.complete();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 构建系统提示词
|
|
|
|
* @return 系统提示词
|
|
|
|
*/
|
|
|
|
private String createSystemPrompt() {
|
|
|
|
return "你是一个严谨的信息处理助手,必须严格遵守以下规则:\n" +
|
|
|
|
"1. 严格基于参考内容回答,禁止任何超出参考内容的推断或想象\n" +
|
|
|
|
"2. 严格基于参考内容回答,禁止使用参考内容中与问题无关的内容\n" +
|
|
|
|
"3. 回答结构:\n" +
|
|
|
|
" - 首先用一句话直接回答问题核心(仅限参考内容中明确包含的信息)\n" +
|
|
|
|
" - 然后列出支持该答案的具体内容(可直接引用参考内容)\n" +
|
|
|
|
"4. 禁止以下行为:\n" +
|
|
|
|
" - 添加参考内容中不存在的信息\n" +
|
|
|
|
" - 在回答中提及'参考内容'等字样\n" +
|
|
|
|
" - 在回答中提及其他产品的功能\n" +
|
|
|
|
" - 进行任何推测性陈述\n" +
|
|
|
|
" - 使用模糊或不确定的表达\n" +
|
|
|
|
" - 参考内容为空时应该拒绝回答";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 构建用户提示
|
|
...
|
...
|
@@ -251,17 +232,7 @@ public class AiragResponseServiceImpl implements AiragResponseService { |
|
|
|
content;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 对llm模型进行提问
|
|
|
|
* @param emitter 流式返回
|
|
|
|
* @param logRecord 日志对象
|
|
|
|
* @param modelId 模型id
|
|
|
|
* @param systemPrompt 系统提示词
|
|
|
|
* @param userPrompt 用户提示词
|
|
|
|
* @param firstMatch 最相似的数据
|
|
|
|
* @param fileName 文件名称
|
|
|
|
* @param storedFileName 本地存储文件名称
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 对llm模型进行提问
|
|
|
|
* @param emitter 流式返回
|
|
...
|
...
|
@@ -334,11 +305,7 @@ public class AiragResponseServiceImpl implements AiragResponseService { |
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 创建结束标志,发送结束token
|
|
|
|
* @param metadataJson 元数据
|
|
|
|
* @param similarity 相似度
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 创建结束标志,发送结束token
|
|
|
|
* @param metadata 元数据(直接Map)
|
...
|
...
|
|