feat: 添加观点传播系统

- 新增 Stance 数据结构 (optimism/fear)
- 情绪影响 stance (happy→乐观, anxious→恐惧)
- 实现 apply_social_influence 社交影响函数
- 确定性随机选择接触对象
- 单次变化限制 ±0.1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
empty
2025-12-30 10:50:46 +08:00
parent af279bedd9
commit 554d37fd4c
6 changed files with 245 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ from .models import (
)
from .global_events import GLOBAL_EVENT_POOL, GlobalEvent
from .opinions import generate_opinions
from .social_influence import apply_social_influence
MAX_EVENTS = 20
MAX_MEMORY_PER_AGENT = 3
@@ -86,6 +87,9 @@ def process_events(state: WorldState, events: List[Event]) -> WorldState:
# 生成角色对事件的观点
generate_opinions(state)
# 应用社交影响
apply_social_influence(state)
return state
@@ -119,6 +123,9 @@ def check_and_trigger_global_event(
# 生成角色对新事件的观点
generate_opinions(state)
# 应用社交影响
apply_social_influence(state)
result = GlobalEventResult(
triggered=True,
event=global_event.to_info()