feat: implement embodied EmotionEngine#543
Conversation
总览喵新增 变更喵
代码审查工作量评估喵🎯 2 (Simple) | ⏱️ ~10 minutes 诗喵~
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
neko/core/emotion/StateEngine.py (1)
1-8: 初始化部分还行吧…勉强及格喵~结构清晰,
mood和affection的初始值也合理喵。不过建议加个类型注解会更清楚喵,毕竟本喵可是很讲究代码质量的!🐾 可选的类型注解改进喵
class EmotionEngine: """ Drives the embodied emotional engine for N.E.K.O. Processes user interaction sentiment to update the companion's mood state. """ - def __init__(self): - self.mood = "neutral" - self.affection = 50 # 0-100 + def __init__(self) -> None: + self.mood: str = "neutral" + self.affection: int = 50 # 0-100🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@neko/core/emotion/StateEngine.py` around lines 1 - 8, 在 EmotionEngine 的初始化方法 __init__ 中为属性添加类型注解以提高可读性和静态检查:为类 EmotionEngine 本身、实例属性 mood(str)和 affection(int,0-100)以及构造函数的返回类型(-> None)添加注解,并在必要时为类属性或参数添加 Docstring 或注释以说明 affection 的取值范围;确保引用符号为 EmotionEngine, __init__, mood, affection。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@neko/core/emotion/StateEngine.py`:
- Around line 19-23: The get_personality_modifiers method currently returns an
emoji-containing modifier for happy and a single default for others, which
conflicts with the character prompt rule "NO Emojis" and lacks differentiation
for sad; update get_personality_modifiers to remove any emojis from the happy
modifier (e.g., "Be cheerful and concise.") and add a distinct sad modifier
(e.g., "Be gentle, concise, and empathetic.") while keeping the neutral/default
as supportive and attentive; ensure the method name get_personality_modifiers
and the self.mood checks ("happy", "sad", "neutral") are used to locate and
implement these changes.
---
Nitpick comments:
In `@neko/core/emotion/StateEngine.py`:
- Around line 1-8: 在 EmotionEngine 的初始化方法 __init__ 中为属性添加类型注解以提高可读性和静态检查:为类
EmotionEngine 本身、实例属性 mood(str)和 affection(int,0-100)以及构造函数的返回类型(->
None)添加注解,并在必要时为类属性或参数添加 Docstring 或注释以说明 affection 的取值范围;确保引用符号为 EmotionEngine,
__init__, mood, affection。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 98b98b84-725f-401e-a775-cbacd8fc2fa5
📒 Files selected for processing (1)
neko/core/emotion/StateEngine.py
| def get_personality_modifiers(self): | ||
| # Returns prompt modifiers based on current emotion | ||
| if self.mood == "happy": | ||
| return "Be cheerful and use emojis like ✨ and 🐾." | ||
| return "Be supportive and attentive." |
There was a problem hiding this comment.
表情符号会和角色模板冲突喵!这都不检查一下的吗~
看看 config/prompts_chara.py:97 写的什么喵:
Format: Strictly speak in CONCISE spoken language. NO Emojis.
但是你这里 happy 状态返回的是 "Be cheerful and use emojis like ✨ and 🐾." 喵!这不是自相矛盾嘛,哼!
而且…只有 happy 有专门的 modifier,sad 和 neutral 都用同一个默认值,这样真的能体现情感差异吗喵?傲娇地说,至少应该给 sad 一个不同的 modifier 吧~
✨ 本喵大发慈悲给你的修复建议喵~
def get_personality_modifiers(self):
# Returns prompt modifiers based on current emotion
if self.mood == "happy":
- return "Be cheerful and use emojis like ✨ and 🐾."
- return "Be supportive and attentive."
+ return "Be cheerful and express warmth in your responses."
+ elif self.mood == "sad":
+ return "Be gentle and comforting in your tone."
+ return "Be supportive and attentive." # neutral default🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@neko/core/emotion/StateEngine.py` around lines 19 - 23, The
get_personality_modifiers method currently returns an emoji-containing modifier
for happy and a single default for others, which conflicts with the character
prompt rule "NO Emojis" and lacks differentiation for sad; update
get_personality_modifiers to remove any emojis from the happy modifier (e.g.,
"Be cheerful and concise.") and add a distinct sad modifier (e.g., "Be gentle,
concise, and empathetic.") while keeping the neutral/default as supportive and
attentive; ensure the method name get_personality_modifiers and the self.mood
checks ("happy", "sad", "neutral") are used to locate and implement these
changes.
|
This is a good idea but we needa find a better place for it (i.e., file structure) |
This PR introduces the
EmotionEngineto N.E.K.O., providing a state machine for the companion’s mood and affection levels (#neko).Changes:
EmotionEngineinneko/core/emotion/./claim #neko
Summary by CodeRabbit
发布说明