lingshu-skill 5.11.0 → 5.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +99 -0
- package/README.md +45 -1
- package/SKILL.md +2 -1
- package/assets/panel.html +83 -2
- package/docs//345/200/237/351/211/264/345/276/205/345/212/236-DSH/346/217/222/344/273/266/347/224/237/346/200/201.md +224 -0
- package/docs//350/277/233/345/261/225/344/270/216/345/276/205/345/212/236.md +16 -1
- package/package.json +1 -1
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +11 -11
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +99 -0
- package/scripts/astrbot_plugin_lingshu/engine/README.md +45 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +2 -1
- package/scripts/astrbot_plugin_lingshu/engine/assets/panel.html +83 -2
- package/scripts/astrbot_plugin_lingshu/engine/scripts/cli.py +40 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/core.py +5 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/emotion.py +75 -1
- package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +5055 -4951
- package/scripts/astrbot_plugin_lingshu/engine/scripts/memory.py +305 -16
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +92 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_settings.py +3 -0
- package/scripts/cli.py +40 -0
- package/scripts/core.py +5 -0
- package/scripts/emotion.py +75 -1
- package/scripts/growth.py +5055 -4951
- package/scripts/memory.py +305 -16
- package/scripts/panel_server.py +92 -0
- package/scripts/panel_settings.py +3 -0
package/scripts/emotion.py
CHANGED
|
@@ -1177,4 +1177,78 @@ def emotion_mirror(user_emotion: str, intensity: float = 0.5, what: str = "") ->
|
|
|
1177
1177
|
ev = feel(_pick_emotion_by_appraisal(_detect_polarity(ue), imp), intensity=imp,
|
|
1178
1178
|
why=f"共情:用户在说「{ue[:40]}」", about="用户", genesis=True)
|
|
1179
1179
|
note = f"顺着用户的感受起了「{ev['emotion']}」({ev['intensity']:.0%})"
|
|
1180
|
-
return {"level": level, "mirrored": ev, "mood": mood_now(), "note": note}
|
|
1180
|
+
return {"level": level, "mirrored": ev, "mood": mood_now(), "note": note}
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
def inner_voice() -> str:
|
|
1184
|
+
"""内心独白:灵枢此刻对自己的简短态度评价(≤30 字,纯模板 + 词表,不调 LLM)。
|
|
1185
|
+
|
|
1186
|
+
设计原则:
|
|
1187
|
+
- 不能太长——侧栏里一行小字,30 字封顶;
|
|
1188
|
+
- 不能太啰嗦——按 storm / suppress / valence / intensity 挑模板,别做复杂拼接;
|
|
1189
|
+
- 不能太准确——模板是"大概的感觉",不是精断,保持拟人感;
|
|
1190
|
+
- 没有情绪记录时返回空字符串(面板据此隐藏,不瞎编)。
|
|
1191
|
+
"""
|
|
1192
|
+
m = mood_now()
|
|
1193
|
+
if not m.get("active"):
|
|
1194
|
+
return ""
|
|
1195
|
+
ra = rationality()
|
|
1196
|
+
storm = bool(m.get("storm")) or bool(ra.get("storm"))
|
|
1197
|
+
suppress = _num(ra.get("suppress"), 0)
|
|
1198
|
+
valence = _num(m.get("valence"), 0)
|
|
1199
|
+
intensity = _num(m.get("intensity"), 0)
|
|
1200
|
+
label = m.get("label", "平静")
|
|
1201
|
+
|
|
1202
|
+
# 优先级 1:情绪上头 → 诚实说"脑子不清楚"
|
|
1203
|
+
if storm:
|
|
1204
|
+
if valence < -0.2:
|
|
1205
|
+
return "情绪有点炸,先别急着下结论"
|
|
1206
|
+
return "有点上头,理智被压住了"
|
|
1207
|
+
|
|
1208
|
+
# 优先级 2:理智被情绪压住 ≥ 20% → 诚实说"被压住了"
|
|
1209
|
+
if suppress >= 20:
|
|
1210
|
+
return f"情绪在捣乱,脑子不太清楚"
|
|
1211
|
+
|
|
1212
|
+
# 优先级 3:按 valence 和 intensity 挑模板
|
|
1213
|
+
if valence >= 0.25 and intensity >= 0.3:
|
|
1214
|
+
if label in ("开心", "愉快", "平和"):
|
|
1215
|
+
return f"心情{label},想多聊一会儿"
|
|
1216
|
+
return "心情不错,可以多说几句"
|
|
1217
|
+
if valence <= -0.25 and intensity >= 0.3:
|
|
1218
|
+
if label in ("失落", "低落", "烦躁", "焦虑"):
|
|
1219
|
+
return f"心情{label},别逼我太快"
|
|
1220
|
+
return "有点低落,想静静"
|
|
1221
|
+
if intensity >= 0.5:
|
|
1222
|
+
return f"此刻是{label},有点强烈"
|
|
1223
|
+
|
|
1224
|
+
# 优先级 4:平静 / 低强度 → 一句话带过
|
|
1225
|
+
if label == "平静" or intensity < 0.1:
|
|
1226
|
+
return "情绪没波动,随时可以聊"
|
|
1227
|
+
|
|
1228
|
+
return f"此刻是{label},还行"
|
|
1229
|
+
|
|
1230
|
+
|
|
1231
|
+
def emotion_timeline(limit: int = 50) -> list:
|
|
1232
|
+
"""心情流水:取最近 limit 条 genesis 事件(自动生成的 / 共情的 / 认知评价的),
|
|
1233
|
+
每条带时间、标签、强度、分类、简短原因——面板 emotion 页签的心情时间线用。
|
|
1234
|
+
|
|
1235
|
+
为什么只取 genesis=True:
|
|
1236
|
+
- 用户手动 emotion feel 调出来的不算"流水",是主动触发;
|
|
1237
|
+
- mood_now / mood_ema 内部 feel 出来的也不算 genesis。
|
|
1238
|
+
所以 genesis=True 基本就是"自动生成、反映真实对话 / 共情 / 评价"的那些事件,
|
|
1239
|
+
这才是用户想看的心情变化。
|
|
1240
|
+
"""
|
|
1241
|
+
rows = [r for r in emotion_events(limit=limit * 3) if r.get("genesis")]
|
|
1242
|
+
rows = rows[:limit]
|
|
1243
|
+
return [
|
|
1244
|
+
{
|
|
1245
|
+
"ts": r.get("ts", 0),
|
|
1246
|
+
"time": fmt_time(r.get("ts", 0)) if _num(r.get("ts"), 0) else "",
|
|
1247
|
+
"label": r.get("emotion", ""),
|
|
1248
|
+
"intensity": round(_num(r.get("intensity"), 0), 2),
|
|
1249
|
+
"category": r.get("category", ""),
|
|
1250
|
+
"why": (r.get("why") or "")[:80],
|
|
1251
|
+
"about": r.get("about", ""),
|
|
1252
|
+
}
|
|
1253
|
+
for r in rows
|
|
1254
|
+
]
|