6 changed files with 126 additions and 38 deletions
-
2client/dist/chatbot-sdk.js.map
-
17src/main/java/com/wok/supportbot/app/AssistantApp.java
-
29src/main/java/com/wok/supportbot/config/RagPromptConfig.java
-
9src/main/resources/application.yml
-
101src/main/resources/static/js/utils.js
-
2src/main/resources/static/sdk/chatbot-sdk.js.map
2
client/dist/chatbot-sdk.js.map
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,29 @@ |
|||||
|
package com.wok.supportbot.config; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* RAG 提示词配置 |
||||
|
* 通过 application.yml 的 knowledge.rag.answer-rules 动态调整 RAG 回答规则(保真护栏),无需改代码重新编译。 |
||||
|
*/ |
||||
|
@Component |
||||
|
@ConfigurationProperties(prefix = "knowledge.rag") |
||||
|
@EnableConfigurationProperties(RagPromptConfig.class) |
||||
|
@Data |
||||
|
public class RagPromptConfig { |
||||
|
|
||||
|
/** |
||||
|
* RAG 回答规则(保真护栏),注入 system 提示词与 ContextualQueryAugmenter 自定义模板。 |
||||
|
* 默认值在「忠于资料、不编造」基础上,强调覆盖全部相关要点、不遗漏步骤。 |
||||
|
* yml 未配置时使用此默认值;yml 配置后覆盖。 |
||||
|
*/ |
||||
|
private String answerRules = """ |
||||
|
- 完整性优先:必须覆盖下方【知识库资料】中所有与用户问题相关的要点,按资料本身的条理分点结构化输出;不得只摘取其中一两段或几条而遗漏其余相关的步骤、条件、注意事项、话术示例。多段资料从不同角度回答同一问题时,需综合全部相关内容作答。 |
||||
|
- 忠于资料:只能依据下方【知识库资料】回答,不得调用模型自身记忆补充资料之外的内容;资料中包含流程、步骤、话术、制度等具体内容时,优先逐字引用或完整转述,不得使用未检索到的诗句、篇名、作者或步骤。 |
||||
|
- 来源对应:回答中每个要点都应能在【知识库资料】中找到对应来源;不得让回答内容与下方引用来源不一致,也不得将多步流程压缩到只剩一两条。 |
||||
|
- 资料不足:如果【知识库资料】中没有用户要求的内容,请明确说明未在当前知识库中检索到足够资料,并提示补充或调整知识库。 |
||||
|
- 排版规范:使用 Markdown 结构化输出——分点用有序或无序列表(`1.` / `-`),不同要点之间空一行分段,涉及多来源或多角度时可用二级标题(`##`)区分;严禁把所有内容挤在一段内。"""; |
||||
|
} |
||||
2
src/main/resources/static/sdk/chatbot-sdk.js.map
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue