File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/nonebot_plugin_nyaturingtest Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -808,6 +808,7 @@ async def __chat_stage(
808808 - 你之前对此话题的发言内容/主张
809809 - 你对相关人物的情绪倾向和你的情绪
810810 - 检索到的相关记忆
811+ - 无论发言/不发言,都要总结你这么做的原因到"debug_reason"字段
811812- 对“新输入消息”的内容和“历史聊天”,“对话内容总结”,还有检索到的相关记忆未提到的内容,你必须假装你对此一无所知
812813 - 例如未提到“iPhone”,你就不能说出它是苹果公司生产的
813814- 不得使用你自己的预训练知识,只能依赖“新输入消息”的内容和“历史聊天”,还有检索到的相关记忆
@@ -876,7 +877,8 @@ async def __chat_stage(
876877{{
877878 "reply": [
878879 "回复内容1"
879- ]
880+ ],
881+ "debug_reason": "发言/不发言的原因"
880882}}
881883"""
882884 response = await llm (prompt )
@@ -890,6 +892,14 @@ async def __chat_stage(
890892 raise ValueError ("LLM response is not valid JSON, response: " + response )
891893
892894 logger .debug (f"对话阶段回复内容:{ response_dict ['reply' ]} " )
895+
896+ if "debug_reason" not in response_dict :
897+ raise ValueError ("LLM response is not valid JSON, response: " + response )
898+ if not isinstance (response_dict ["debug_reason" ], str ):
899+ raise ValueError ("LLM response is not valid JSON, response: " + response )
900+
901+ logger .debug (f"对话阶段回复/不回复原因:{ response_dict ['debug_reason' ]} " )
902+
893903 logger .debug ("对话阶段结束" )
894904
895905 return response_dict ["reply" ]
You can’t perform that action at this time.
0 commit comments