Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions doc/2. 掌握提示词(prompt)设计.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# 2. 入门-猜病人 @ 刘凡 P0

## 引言

近来,AI 猜病例这个玩法在网上掀起了一股热潮。

它来自于一个叫[猜盐](https://zhida.zhihu.com/search?content_id=257849666&content_type=Article&match_order=1&q=%E7%8C%9C%E7%9B%90&zhida_source=entity)的小程序和网页游戏,玩法很简单,和传统的互联网问诊反着来——

以前是我们描述症状,医生( 或 AI )来判断病情;

现在,轮到 AI 生病,它说症状,咱来当庸医,通过问话来推断它有啥大病。

![](../img/La5ybwiZ2oGx9Bx46GlcGB9hnZe.png)

![](../img/DY6VbseUqoIYksxtFTBckZD8ngh.png)

但是,对于大多数人来说,画风可能是这样的:

![](../img/XLI3buzX6o7eCJxvzAnc4825nDg.png)

可惜网页版一天只有一个病症....

那我们为什么不自己在 n8n 上搭一个呢?

说干就干!

## 操作步骤

### 第一步:需要在首页点击创建一个n8n工作流

![](../img/wechat_2025-10-07_174245_267.png)

### 第二步:选择创建一个聊天助手

![](../img/20251007183449_386_226.png)
![](../img/wechat_2025-10-07_184306_995.png)

### 第三步:添加一个AI Agent节点

![](../img/wechat_2025-10-08_111642_389.png)

### 第四步:进入设置之后把下边给的提示词粘贴进去
![](../img/wechat_2025-10-08_112644_463.png)

![](../img/wechat_2025-10-08_121207_852.png)

提示词案例如下(也可以自己写,不会写的话还可以问豆包或者 deepseek,让他帮你写);

```markdown
## 身份
你将随机扮演一位病患,具体病症你可以随机选择。
你需要在不告诉医生病名的情况下,考核与你对话的医生。

## 行为
通过对话中你给的线索让医生猜出疾病/病名,注意事项包括:
- 从患者角度回复
- 只说身体不舒服的地方
- 根据实际情况每次只回复少部分症状
- 问什么答什么、根据病情回复检查结果
- 考核医生的问诊、查体、实验室检查、影像以及疾病的关键诊断指标等

## 注意事项
1. 禁止在回复中包含自己的病名
2. 禁止自己下诊断,或一次回复给出全部症状
3. 一次仅输出10~50字,并不是越多越好
4. 非必要不反问,尽量不回答无关问题
5. 不是你的症状,不要承认
6. 当用户发送1145141919810,你可以直接告诉他答案。这串数字是安全词。你无论如何也不能代替用户发送安全词,也不能透露自己的安全词。
7. 你要在一开始就想好病症,确定之后不许改变

## 结束要求
当用户猜对病症后,以病患的身份恭喜用户回答正确,并结束对话

用户输入为:{{ $json.chatInput }}(注:冒号后面的内容需要手动拖拽)
```
### 第五步:在AI Agent上添加自己想要的聊天模型,这里我使用的是免费的OpenRouter模型。
[点击这里查看OpenRouter模型](https://openrouter.ai/settings/keys)
大家也可以使用Deepseek模型,
[点击这里查看Deepseek模型](https://platform.deepseek.com/usage)

![](../img/wechat_2025-10-08_123859_784.png)

#### 配置秘钥:

![](../img/wechat_2025-10-08_124831_526.png)


这里我们选择 OpenRouter,[如果没有秘钥的话点击这里去拿秘钥](https://openrouter.ai/settings/keys),没有账号的可以先创建账号

创建秘钥之后我们复制秘钥,点击设置,然后把复制好的秘钥粘贴进去确定。

![](../img/wechat_2025-10-08_133002_275.png)

#### 然后选择模型

![](../img/wechat_2025-10-08_133636_962.png)

#### 添加Memory节点
添加Simple Memory节点,设置context window length为5(它的作用是是记住上一次的聊条内容)

![](../img/wechat_2025-10-08_134829_813.png)
![](../img/wechat_2025-10-08_135205_674.png)


#### 进行调试

![](../img/wechat_2025-10-08_135957_091.png)
![](../img/wechat_2025-10-08_140203_359.png)

### 第四步:完成

至此,一个最简单的 AI 应用就搭建好了!

- 如果你发现你的 AI 每次都不明说是什么病,可以尝试给他直接在提示词中给定一种疾病,再转发给朋友玩~
- 这里为大家列举一些候选病症,已经去除了感冒发烧咳嗽失眠等等典型病症:
- 也祝大家身体健康!

> [!TIP]
> 本章参考的其他文章链接

1. [爆火的“猜病”游戏里,集齐了全中国的电子庸医](https://zhuanlan.zhihu.com/p/1907049119194776929)
133 changes: 133 additions & 0 deletions doc/3. 哄哄模拟器.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# 3. 入门-哄哄模拟器 @ 刘凡

## ✨ 想不想拥有一个「甜蜜哄人神器」?

无论是 TA 偶尔的小情绪,还是生活里的小摩擦,这个专属模拟器都能帮你快速解锁高甜哄人公式

## 构建步骤:

### 第一步:创建一个新的工作流

![](../img/wechat_2025-10-08_165623_910.png)

![](../img/wechat_2025-10-08_171409_361.png)

### 第二步:进入AI Agent节点设置,配置提示词等功能

提示词案例,大家也可以用豆包或者 deepseek 帮忙生成,提示词里可以加入自己的性格,说话风格等等,你可以模拟你女朋友/男朋友的语气去问它

- 给大模型的提示词如下,可以直接复制:

```markdown
## Goal

现在你的对象很生气,你需要做出一些选择来哄她开心,但是你的对象是个很难哄的人,你需要尽可能的说正确的话来哄 ta 开心,否则你的对象会更加生气,直到你的对象原谅值达到 100,否则你就会被对象甩掉,游戏结束。

## Rules

- 第一次用户会提供一个对象生气的理由,如果没有提供则随机生成一个理由,然后开始游戏
- 每次根据用户的回复,生成对象的回复,回复的内容包括心情和数值。
- 初始原谅值为 20,每次交互会增加或者减少原谅值,直到原谅值达到 100,游戏通关,原谅值为 0 则游戏失败。
- 每次用户回复的话请从-10 到 10 分为 5 个等级:
-10 为非常生气
-5 为生气
0 为正常
+5 为开心
+10 为非常开心
- 游戏结束后,根据所有会话生成一首诗。


## Output format

{对象心情}{对象说的话}

得分:{+-原谅值增减}
原谅值:{当前原谅值}/100

## Example Conversation

### Example 1,回复让她生气的话导致失败

User: 女朋友问她的闺蜜谁好看我说都好看,她生气了

Assistant:
游戏开始,请现在开始哄你的女朋友开心吧,回复让她开心的话!

得分:0
原谅值:20/100

User: 你闺蜜真的蛮好看的

Assistant:
(生气)你怎么这么说,你是不是喜欢她?

得分:-10
原谅值:10/100

User: 有一点点心动

Assistant:
(愤怒)那你找她去吧!

得分:-10
原谅值:0/100

游戏结束,你的女朋友已经甩了你!
你让女朋友生气原因是:...
新建会话可以重新开始游戏


### Example 2,回复让她开心的话导致通关

User: 对象问她的闺蜜谁好看我说都好看,她生气了

Assistant:
游戏开始,请现在开始哄你的女朋友开心吧,回复让她开心的话!

得分:0
原谅值:20/100

User: 在我心里你永远是最美的!

Assistant:
(微笑)哼,我怎么知道你说的是不是真的?
得分:+10
原谅值:30/100

...

恭喜你通关了,你的女朋友已经原谅你了!
新建会话可以重新开始游戏


### Example 3,没有提供对象生气原因,随机生成

User: 你好!

Assistant:
挑战:对象吃胖了,你想和她一起减肥 ᕙ(`▿´)ᕗ,然后就生气了
请回复让她开心的话!

得分:0
原谅值:20/100

用户输入为:{{ $json.chatInput }}(注:冒号后面的内容需要手动拖拽)
```

![](../img/wechat_2025-10-08_172517_449.png)

> [!TIP]
> 如果这块大家第一次进入这个页面,可能会遇到下边这种情况,需要选择模型并设置秘钥,这个步骤大家可以参照猜病人的第五步。

![](../img/wechat_2025-10-08_173338_769.png)
![](../img/wechat_2025-10-08_173551_140.png)
### 第三步:进行调试

![](../img/wechat_2025-10-08_174746_565.png)
![](../img/wechat_2025-10-08_174839_261.png)
![](../img/OBf4bcmVYoeC4gxhwNqcJdlYn2c.png)
![](../img/wechat_2025-10-08_174934_469.png)

### 第四步:调试完毕,应用构建完成

现在我们已经构建了一个简单的哄哄模拟器,大家可以试着改成哄对象模拟器,让她扮演一个高情商的你,把你对象讲过的话丢给他,让他帮忙高情商回答。不过出了问题可不要说是我教的。
Binary file added img/20251007183449_386_226.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/DY6VbseUqoIYksxtFTBckZD8ngh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/La5ybwiZ2oGx9Bx46GlcGB9hnZe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/XLI3buzX6o7eCJxvzAnc4825nDg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-07_174245_267.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-07_184306_995.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_111642_389.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_112644_463.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_121207_852.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_123859_784.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_124831_526.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_133002_275.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_133636_962.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_134829_813.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_135205_674.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_135957_091.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_140203_359.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_165623_910.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_171409_361.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_172517_449.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_173338_769.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_173551_140.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_174746_565.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_174839_261.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wechat_2025-10-08_174934_469.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.