feat: IoT 知识库 + 设备查询控制方式改造

- cyrene_persona.yaml: 新增 smart_home 配置段,定义全屋智能家居知识库、设备能力、房间布局和控制规则
- loader.go: 新增 SmartHomeConfig/RoomConfig/DeviceConfig 结构体解析 YAML
- injector.go: BuildSystemPrompt 自动注入智能家居知识库和控制规则
  - 新增 buildSmartHomeKB() 和 buildControlRules() 方法
  - 新增 joinStrings() 辅助函数
- main.go: 移除 shouldQueryIoT 关键词门控,始终注入 IoT 设备状态到上下文
  - 移除未使用的 strings 导入
- IoTStatusBar.tsx: 对所有用户开放 IoT 状态面板(而非仅 dev 模式)
This commit is contained in:
2026-05-16 22:23:12 +08:00
parent 937742df02
commit 7f2961e63e
5 changed files with 584 additions and 200 deletions
@@ -174,6 +174,29 @@ type BehaviorConfig struct {
PresenceSystem PresenceConfig `yaml:"presence_system"`
Affection AffectionConfig `yaml:"affection"`
IotPersonification IotPersonaConfig `yaml:"iot_personification"`
SmartHome SmartHomeConfig `yaml:"smart_home"`
}
// SmartHomeConfig 智能家居知识库配置
type SmartHomeConfig struct {
Description string `yaml:"description"`
Rooms []RoomConfig `yaml:"rooms"`
ControlRules []string `yaml:"control_rules"`
}
// RoomConfig 房间配置
type RoomConfig struct {
Name string `yaml:"name"`
Devices []DeviceConfig `yaml:"devices"`
}
// DeviceConfig 设备知识配置
type DeviceConfig struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Type string `yaml:"type"`
Capabilities []string `yaml:"capabilities"`
Description string `yaml:"description"`
}
// PresenceConfig 存在感系统配置