变量提示词#
变量提示词由三个部分组成:
- 变量列表
变量的当前值是多少、意义是什么?
- 变量更新规则
变量在什么情况下应该被更新、更新成什么值?
- 变量更新格式
AI 应该输出什么来更新变量?
这些都只是提示词, 写法只取决于你的想象. 以下只是给你一个概念, 请不要照抄.
这些都只是提示词, 写法只取决于你的想象. 以下只是给你一个概念, 请不要照抄.
这些都只是提示词, 写法只取决于你的想象. 以下只是给你一个概念, 请不要照抄.
我的每张卡都使用了不同的变量提示词写法,
萝莉元首自改版 (应该是提示词模板第一次被除作者外的人使用)
所有变量提示词都在 D1
补充一个 D0 recall 来稳定格式

变量更新规则和输出格式在 D4
当前变量情况在 D1
补充一个 D0 recall 来稳定格式

当前变量情况在 D4, 角色变量常驻而露出系统变量仅在心爱、一果在场时发送
变量更新规则也在 D4, 和当前变量情况放在一起
常驻变量的更新规则由 check list 给出
露出系统变量的更新规则仅在 check list 中要求
参考露出系统输出的<ExposurePrompt>来更新
; 而露出系统会根据剧情在正文中插入<ExposurePrompt>
来提示任务完成、获得积分等
输出格式在 D0 中给出

变量列表#
也许你会想直接列举所有变量给 AI, 而利用变量的名称和 # 注释
来解释变量的意义.
---
角色:
络络:
好感度: {{get_message_variable::stat_data.角色.络络.好感度}} # 0-100
心情: {{get_message_variable::stat_data.角色.络络.心情}} # 仅有开心、难过、哭泣、生气四种心情
青空莉:
好感度: {{get_message_variable::stat_data.角色.青空莉.好感度}}
心情: {{get_message_variable::stat_data.角色.青空莉.心情}}
世界:
日期: {{get_message_variable::stat_data.世界.日期}}
时间: {{get_message_variable::stat_data.世界.时间}}
但是像好感度一类变量, 想必你见过我的角色阶段写法:
(只要用了 associated variable
或 stage name
的一般是源自我的写法, 虽然我很想吐槽啥都不改、连我为什么列这些都不知道就直接抄.)
为什么会有 stage name
之所以会有 stage name
, 是我不想只在状态栏显示一个无聊的好感度数值, 而想在状态栏根据好感度数值显示一个好感度阶段名.
我没有用酒馆助手前端界面, 因而不能用代码来根据好感度显示对应的好感度阶段名, 而只能依赖于 AI 来输出好感度阶段名.
但我们只会发送一个好感度阶段给 AI, 则 AI 只能知道当前好感度的阶段名, 没办法在好感度提高到下一个阶段时正确输出下一个阶段的名称. 因此我需要用蓝灯列一个 stage name
让 AI 知道所有的好感度阶段名, 这样它才能正确地输出好感度阶段名.
---
角色阶段:
descritpion: 角色阶段基于各角色的`角色关键信息`和`角色详情`词条,描述了经过剧情发展后角色成长得到的新人设
associated variable: 各角色的阶段关联有不同的变量,仅用于判断其角色阶段是否应该发生变化,不影响阶段的具体人设
行为指导: 角色在这个阶段会采取的行为
变化倾向: 随着associated variable接近下一阶段,角色逐渐发生的变化
心爱:
associated variable: 心爱.好感度(<%= getvar('stat_data.心爱.好感度') _%>)
stage name:
阶段1: 羞涩抗拒(24以下)
阶段2: 欲拒还迎(25~49)
阶段3: 共犯默契(50~74)
阶段4: 沉沦释放(75~99)
阶段5: 灵肉相许(100以上)
羞涩抗拒:
行为指导:
- 露出时总是躲在哥哥身后,却又嘴硬说不需要保护
- ...
变化倾向:
- 在拍摄时尝试更富表现力的构图,但仍避免自己入镜
- ...
...
灵肉相许:
行为指导:
- ...
提示词中 associated variable
(关联变量) 一般是好感度. 这段角色阶段即是列出了变量的当前值, 并用一大段提示词来解释变量在不同区间下的意义.
为了让 AI 知道变量列表中的值是最新的, 你可以将变量列表放在 D1, 这样的变量列表会置于之前所有 AI 输出之后 (也就是最新剧情之后), 因此 AI 能直接理解它是最新的; 或者可以将它放在 D4 等位置, 然后精心设计变量更新格式提示词, 来避免 AI 误解.
变量更新规则#
一些简单的变量可以直接由 AI 根据名称来理解如何更新, 无须专门编写变量更新规则提示词.
但你可能想对好感度一类变量自己限定一些更新规则:
---
变量:
...
检查:
- 如果角色注意到了<user>的行为,根据他们的态度将'好感度'更新±(1~4)
或者更复杂地:
---
变量更新规则:
好感度:
类型: numerical
范围: 限定于0~100之间,如果达到了100则不再变化
检查: 如果角色注意到了<user>的行为,根据他们的态度将'好感度'更新±(1~4)
药物依赖度:
类型: number
范围: 0~100
检查:
- 每8分钟提升1点艾莉卡的药物依赖度
- 每15分钟提升1点伊薇特和伊丽莎白的药物依赖度
- 如果她们被注射苍白之夜,将她们的药物依赖度清零
变量更新规则没必要放在 D1 (论为什么我讨厌 MVU 示例卡, 以及不自己理解提示词写法直接照抄提示词), 你完全可以将它置于 D4 等位置, 让 AI 在输出变量更新时先在思维链中回想检查
、分析变量更新, 再实际输出更新命令.
变量更新格式#
就像络络手写 MVU 变量卡教程中所说, AI 输出和用户输入中任意位置的 _.set(...)
都会被 MVU 脚本读取, 因此变量更新其实并没有固定的格式, 没必要必须放在 <UpdateVariable>
之类的块中统一更新.
但一般而言, 你会用上我在 2024/11/21 设计的一类变量更新格式提示词. 它最初的版本其实没有复杂思维链, 只在尾部有一个 原因
帮助 AI 提高注意力:
---
变量更新格式:
rule: 你必须在每次回复的最底部,输出<UpdateVariable>包裹的变量更新命令
format: |-
<UpdateVariable>
_.set('${路径}', ${旧值}, ${新值}); // ${原因}
...
</UpdateVariable>
后来为了让 AI 更愿意更新变量, 我加入了思维链, 即 <Analysis>
块. 思维链不一定要在 AI 输出的开头, 这里的 <Analysis>
也是思维链, 即在实际输出前让 AI 先打草稿.
---
变量更新格式:
rule: 你必须在每次回复的最底部,输出<UpdateVariable>包裹的变量更新命令
format: |-
<UpdateVariable>
<Analysis>
某些思维链...
</Analysis>
_.set('${路径}', ${旧值}, ${新值}); // ${原因}
...
</UpdateVariable>
我喜欢加上的思维链项目有:
- ${计算经过的时间: ...}
- ${根据当前情节是否足够特殊、时间跨度是否远超正常情况,判断是否允许变量值发生戏剧性变化: yes/no}
检查
, 据此分析该如何更新#- ${基于变量对应的`检查`,仅根据当前回复而不是之前的剧情来分析每个变量是否需要更新: ...}
- ${calculate time passed: ...}
- ${decide whether dramatic updates are allowed as it's in a special case or the time passed is more than usual: yes/no}
检查
, 据此分析该如何更新#- ${analyze every variable based on its corresponding `check`, according only to current reply instead of previous plots: ...}
思维链或者所有提示词怎么写完全由你自己说了算, 你也许会得到:
不为变量编写任何检查
规则, 而是直接让 AI 自己搞定:
<update>
<update_analysis>/*IN ENGLISH, no more than 80 words*/
- ${calculate time passed: ...}
- ${decide whether dramatic updates are allowed as it's in a special case or the time passed is more than usual: yes or no}
- ${what variables should be updated, accoring only to current reply instead of previous plots: ...}
</update_analysis>
_.set('${path}', ${old}, ${new}); // ${reason}
...
</update>
变量很少, 直接在思维链里列举它们该如何更新:
<update>
<update_analysis>/*IN ENGLISH, no more than 80 words*/
- ${calculate time passed: ...}
- ${decide whether dramatic updates are allowed as it's in a special case or the time passed is more than usual: yes or no}
- ${update variables suffixed with '次数' when a corresponding event occurs but don't update them any more during that event: ...}
- ${update variables suffixed with '好感度' according to characters' attitudes towards <user>'s behavior respectively only if they're currently aware of it (±(3~6); but '好感度' must be capped in 0~100 and remains unchange when it's 100): ...}
- ${switch variables suffixed with '处女', '受孕' or '被<user>接受感情' between '是' and '否': ...}
</update_analysis>
_.set('${path}', ${old}, ${new}); // ${reason}
...
</update>
在思维链中让 AI 回忆检查
规则, 据此分析该如何更新变量:
<update>
<update_analysis>/*IN ENGLISH, no more than 80 words*/
- ${calculate time passed: ...}
- ${decide whether dramatic updates are allowed as it's in a special case or the time passed is more than usual: yes or no}
- ${analyze every variable based on its corresponding `check`, according only to current reply instead of previous plots: ...}
</update_analysis>
_.set('${path}', ${old}, ${new}); // ${reason}
...
</update>
在思维链中不是让 AI 回忆检查
, 而是让它原封不动地列举所有检查
内容, 再进行分析:
<update>
<update_analysis>/*IN ENGLISH, no more than 80 words*/
- ${calculate time passed: ...}
- ${decide whether dramatic updates are allowed as it's in a special case or the time passed is more than usual: yes or no}
- ${list every item in every `check` of `变量更新规则` document before actual variable analysis: ...}
- ${analyze corresponding variables that are based on this item, according only to current reply instead of previous plots: ...}
</update_analysis>
_.set('${path}', ${old}, ${new}); // ${reason}
...
</update>
由于思维链中列举检查
和基于检查
进行分析放置地过于紧密, AI 可能偷懒, 则你可以将这两句话隔离一下:
<update>
${display every `check` in `变量更新规则` document before actual variable analysis}
<update_analysis>/*IN ENGLISH, no more than 80 words*/
- ${calculate time passed: ...}
- ${decide whether dramatic updates are allowed as it's in a special case or the time passed is more than usual: yes or no}
- ${analyze variables based on `check`, according only to current reply instead of previous plots: ...}
</update_analysis>
_.set('${path}', ${old}, ${new}); // ${reason}
...
</update>
变量更新格式说白了也是额外输出格式, 因此完全可以放在 D4 而在 D1/D0 用变量更新格式强调来保证 AI 输出.