feat: 添加角色事件评论系统
- 新增 Opinion 模型,记录角色对事件的观点 - 新增 opinions.py,基于规则生成观点(支持5种事件×3种情绪) - 同一事件生命周期内每个 agent 只生成一次观点 - 观点同时记录到 agent.memory - 新增 3 个测试用例 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ from .models import (
|
||||
GlobalEventResult, GlobalEventInfo
|
||||
)
|
||||
from .global_events import GLOBAL_EVENT_POOL, GlobalEvent
|
||||
from .opinions import generate_opinions
|
||||
|
||||
MAX_EVENTS = 20
|
||||
MAX_MEMORY_PER_AGENT = 3
|
||||
@@ -82,6 +83,9 @@ def process_events(state: WorldState, events: List[Event]) -> WorldState:
|
||||
# 更新所有 agent 的 emotion
|
||||
update_emotions(state)
|
||||
|
||||
# 生成角色对事件的观点
|
||||
generate_opinions(state)
|
||||
|
||||
return state
|
||||
|
||||
|
||||
@@ -112,6 +116,9 @@ def check_and_trigger_global_event(
|
||||
# 更新 emotion
|
||||
update_emotions(state)
|
||||
|
||||
# 生成角色对新事件的观点
|
||||
generate_opinions(state)
|
||||
|
||||
result = GlobalEventResult(
|
||||
triggered=True,
|
||||
event=global_event.to_info()
|
||||
|
||||
Reference in New Issue
Block a user