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:
@@ -1,6 +1,6 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from .models import WorldState, AgentState, GlobalMeter
|
||||
from .models import WorldState, AgentState, GlobalMeter, Stance
|
||||
|
||||
STATE_FILE = Path(__file__).parent.parent / "state.json"
|
||||
|
||||
@@ -12,8 +12,18 @@ def get_default_state() -> WorldState:
|
||||
weather="sunny",
|
||||
town_mood=0,
|
||||
agents={
|
||||
"alice": AgentState(emotion="calm", goal="探索小镇", memory=[]),
|
||||
"bob": AgentState(emotion="calm", goal="与人交流", memory=[]),
|
||||
"alice": AgentState(
|
||||
emotion="calm",
|
||||
goal="探索小镇",
|
||||
memory=[],
|
||||
stance=Stance(optimism=0.6, fear=0.4),
|
||||
),
|
||||
"bob": AgentState(
|
||||
emotion="calm",
|
||||
goal="与人交流",
|
||||
memory=[],
|
||||
stance=Stance(optimism=0.4, fear=0.6),
|
||||
),
|
||||
},
|
||||
events=[],
|
||||
global_meter=GlobalMeter(value=0, threshold=100, cooldown=0),
|
||||
|
||||
Reference in New Issue
Block a user