Skip to content

提示词注入列表 JSON 格式

用于导入导出聊天设定中的提示词注入列表。

顶层结构

json
{
  "version": 1,
  "promptInjectionEntries": []
}
字段类型必填说明
versionnumber固定为 1
promptInjectionEntriesarray提示词条目数组

条目字段

promptInjectionEntries 中每个元素的字段:

字段类型必填默认值说明
titlestring-条目名称
enabledbooleantrue是否启用
depthnumber0注入深度
conditionTypestring"none"条件类型:none / plainText / regex
sourceTypesarray of string条件['user','character','system']搜索来源数组。仅在 conditionType != none 时有意义
recentRoundCountnumber条件8最近轮数。仅在 conditionType != none 时有意义
conditionstring条件""条件文本。仅在 conditionType != none 时有意义
templatestring""注入模板
regexCaseSensitivebooleanfalseregex 条件时有意义,表示是否区分大小写

说明:

  • conditionType == none 时,表示无条件注入。
  • conditionType == plainText 时,condition 使用提示词注入的普通匹配语法,不是简单字面量匹配。
  • conditionType == regex 时,condition 为正则表达式。

条目约束

  • title 不能为空。
  • conditionType == none 时:
  • sourceTypes / recentRoundCount / condition 可省略。
  • conditionType != none 时:
  • sourceTypes 至少需要一个来源。
  • recentRoundCount 必须大于 0
  • condition 不能为空。
  • conditionType == plainText 时,condition 必须是合法普通匹配表达式。
  • conditionType == regex 时,condition 必须是合法正则表达式。
  • template 必须是合法提示词模板。
  • 提示词注入模板支持 {{变量}} / {{expr}} / {{if}} / {{when}}
  • 提示词注入模板不支持 {{set}} / {{command}} / 消息内置变量。
  • {{MatchN}} 仅在 conditionType == regex 时可用。

最小示例

json
{
  "version": 1,
  "promptInjectionEntries": [
    {
      "title": "无条件人格补充",
      "template": "你要记住用户喜欢安静、克制的表达方式。"
    }
  ]
}

完整示例

json
{
  "version": 1,
  "promptInjectionEntries": [
    {
      "title": "无条件设定补充",
      "template": "当前世界观偏现代都市,避免突然引入超自然设定。"
    },
    {
      "title": "普通匹配:吃醋话题",
      "enabled": true,
      "depth": 0,
      "conditionType": "plainText",
      "sourceTypes": ["user", "character"],
      "recentRoundCount": 6,
      "condition": "吃醋 | 嫉妒 | 占有欲",
      "template": "当话题涉及关系竞争时,优先表现细腻的情绪波动,而不是立刻升级冲突。"
    },
    {
      "title": "正则匹配:地点切换",
      "enabled": true,
      "depth": -1,
      "conditionType": "regex",
      "sourceTypes": ["user"],
      "recentRoundCount": 4,
      "condition": "去(海边|学校|咖啡馆)",
      "template": "当前用户提到了地点 {{Match1}},回复中应自然带入该场景的环境细节。",
      "regexCaseSensitive": false
    }
  ]
}

AI 生成约束

  • 每条 title 不能为空。
  • conditionType != none
  • 必须同时考虑 sourceTypesrecentRoundCountcondition 三个字段。
  • recentRoundCount 必须大于 0
  • 普通匹配使用提示词注入的普通匹配语法,不要误写成场景规则那种简单 A|B|C 字面量匹配。
  • 若模板使用 {{Match1}} 等捕获变量,条件类型必须是 regex
  • 不要在模板中写 {{set ...}}{{command ...}}

常见错误

  • 某条 title 为空 → 导入失败
  • conditionType 非法 → 导入失败
  • sourceTypes 不是数组或包含非法值 → 导入失败
  • recentRoundCount <= 0 → 导入失败
  • conditionType != nonecondition 为空 → 导入失败
  • plainText 条件语法非法 → 导入失败并提示解析错误
  • regex 条件不是合法正则 → 导入失败并提示编译错误
  • template 非法或使用了不支持的模板能力 → 导入失败