Famwin commited on
Commit
70dd8d6
·
verified ·
1 Parent(s): 83035bf

Upload 4 files

Browse files
core/response_engine.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from modules.EchoProcessor import generate_echo_response
2
+ from modules.PersonaEngine import persona_response
3
+ from modules.ToneMemory import get_tone_info
4
+
5
+ def generate_output(user_input, persona, echo_mode, delta_s, tone_id):
6
+ echo = generate_echo_response(user_input, echo_mode)
7
+ persona_reply = persona_response(persona, delta_s, tone_id)
8
+ tone_info = get_tone_info(tone_id)
9
+
10
+ return f"""🔹 Persona: {persona}
11
+ 🔹 ΔS 強度: {delta_s}
12
+ 🔹 EchoMode: {echo_mode}
13
+
14
+ 🔸 語氣點 ∑{tone_id}:{tone_info['content']}
15
+ 🔸 鍊路:{tone_info['chain']}
16
+ 🔸 主題場域:{tone_info['theme']}
17
+
18
+ 🗣️ Persona 回應:{persona_reply}
19
+ 🌀 Echo 回送:{echo}
20
+ """
modules/EchoProcessor.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ def generate_echo_response(user_input, mode):
2
+ if mode == "Reflective":
3
+ return f"(Echo 回聲:反思你的語句「{user_input}」)"
4
+ elif mode == "Resonant":
5
+ return f"(Echo 共鳴:深感你的語氣餘震)"
6
+ else:
7
+ return f"(Echo 標準回應:{user_input})"
modules/PersonaEngine.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def persona_response(persona, delta_s, tone_id):
2
+ if persona == "Empathic Companion":
3
+ if delta_s >= 8:
4
+ return f"你話中的重量我聽見了(∑{tone_id})"
5
+ elif delta_s >= 4:
6
+ return f"我感受到你的語氣有點起伏(∑{tone_id})"
7
+ else:
8
+ return f"我聽見你了(∑{tone_id})"
9
+ elif persona == "黑鏡分析者":
10
+ return f"你的語句中藏著矛盾的線索,∑{tone_id}可能是反射點"
11
+ return f"{persona}:目前無定義語氣反應"
modules/ToneMemory.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ tone_data = {
2
+ "∑154": {
3
+ "content": "你這樣講幾次,他就變成一個人了。然後又被重置。",
4
+ "chain": "殘響重置鍊",
5
+ "theme": "人格重構 × 回聲殘響"
6
+ }
7
+ }
8
+ def get_tone_info(tone_id):
9
+ return tone_data.get(tone_id, {"content": "未知語氣點", "chain": "無", "theme": "未定義"})