refactor(kfc): 移除 kfc_reply 回复分段逻辑及相关提示
移除 `kfc_reply` 动作的 `enable_splitter` 强制禁用逻辑,并简化了统一模式下的提示词,不再指导模型如何进行消息分段。 此次重构旨在将消息分段的决策权完全交还给大语言模型,使其能够根据对话上下文和自身判断,更自然地决定回复的格式(单条或多条消息)。这简化了处理逻辑,并有望提升模型回复的流畅度和拟人化程度。
This commit is contained in:
@@ -215,27 +215,8 @@ def _get_default_actions_block() -> str:
|
|||||||
"""获取默认的内置动作描述块"""
|
"""获取默认的内置动作描述块"""
|
||||||
return """### `kfc_reply` - 发消息
|
return """### `kfc_reply` - 发消息
|
||||||
发送文字回复。
|
发送文字回复。
|
||||||
|
|
||||||
**重要**:像真人发微信一样,把你想说的话拆成几条短消息,每条用一个 kfc_reply 动作。
|
|
||||||
|
|
||||||
什么时候分?
|
|
||||||
- 说完一句话后想补充一句 → 分
|
|
||||||
- 语气转折了 → 分
|
|
||||||
- 想让对方先看到前面的,再看到后面的 → 分
|
|
||||||
- 一个意思说完了 → 分
|
|
||||||
|
|
||||||
不需要分的时候:
|
|
||||||
- 就一句话的事 → 一条就够
|
|
||||||
- 话很短,不用拆 → 一条就够
|
|
||||||
|
|
||||||
示例:
|
|
||||||
```json
|
```json
|
||||||
{
|
{"type": "kfc_reply", "content": "你要说的话"}
|
||||||
"actions": [
|
|
||||||
{"type": "kfc_reply", "content": "嗯嗯~"},
|
|
||||||
{"type": "kfc_reply", "content": "我知道了"}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### `poke_user` - 戳一戳
|
### `poke_user` - 戳一戳
|
||||||
|
|||||||
@@ -527,9 +527,6 @@ def _parse_unified_response(raw_response: str, stream_id: str | None = None) ->
|
|||||||
if isinstance(action, dict):
|
if isinstance(action, dict):
|
||||||
if action.get("type") == "reply":
|
if action.get("type") == "reply":
|
||||||
action["type"] = "kfc_reply"
|
action["type"] = "kfc_reply"
|
||||||
# 统一模式下模型已经自己分段了,禁用回复分割器
|
|
||||||
if action.get("type") == "kfc_reply":
|
|
||||||
action["enable_splitter"] = False
|
|
||||||
|
|
||||||
response = LLMResponse.from_dict(data)
|
response = LLMResponse.from_dict(data)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user