Spaces:
Sleeping
Sleeping
Upload 10 files
Browse files- README.md +15 -8
- app.py +33 -47
- persona_styles.json +18 -0
- personas.json +6 -3
- tone_data.json +25 -0
- tone_simulator_config.json +28 -3
- tone_surface_map.json +23 -0
- 語氣點記憶映射表.csv +4 -0
- 語氣點記憶映射表.json +1 -0
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: LanguageSoul v2.
|
| 3 |
emoji: 🧠
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: pink
|
|
@@ -9,13 +9,20 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# LanguageSoul System v2.
|
| 13 |
|
| 14 |
-
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
-
|
| 18 |
-
-
|
| 19 |
-
-
|
|
|
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: LanguageSoul System v2.5
|
| 3 |
emoji: 🧠
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: pink
|
|
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# LanguageSoul System v2.5 – EchoLoop × PersonaStack Demo
|
| 13 |
|
| 14 |
+
Gradio-based prototype of the LanguageSoul system,
|
| 15 |
+
simulating internal persona state, tone-chain memory, and echo feedback logic.
|
| 16 |
|
| 17 |
+
## 🔧 Features
|
| 18 |
+
- 🎭 Persona selection and tone memory chaining
|
| 19 |
+
- 🔁 EchoLoop simulation for reflective feedback
|
| 20 |
+
- 📊 ΔS (tonal density) display with semantic explanation
|
| 21 |
+
- 🧠 Chain ID dropdown for situation simulation
|
| 22 |
|
| 23 |
+
## 🚀 Usage
|
| 24 |
+
1. Input a phrase and optionally add Echo feedback.
|
| 25 |
+
2. Choose a persona and a tone-chain ID.
|
| 26 |
+
3. See the resulting response including ΔS and chain logic.
|
| 27 |
+
|
| 28 |
+
Part of the **YuHun 語魂系統** initiative.
|
app.py
CHANGED
|
@@ -1,63 +1,49 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
persona_state = {"current": "
|
| 5 |
-
echo_mode = {"current": "
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
point = "∑149|幸存語句"
|
| 15 |
-
line = "語場存續鏈"
|
| 16 |
-
surface = "Loop003|無為衍化場"
|
| 17 |
-
else:
|
| 18 |
-
point = "∑132|羞恥引爆鍊"
|
| 19 |
-
line = "羞恥鍊 × 自洩場"
|
| 20 |
-
surface = "創造 × 裂解場"
|
| 21 |
-
return point, line, surface
|
| 22 |
-
|
| 23 |
-
# 模擬 Echo 拆解層級
|
| 24 |
-
def echo_feedback_layers(echo_text):
|
| 25 |
-
if not echo_text:
|
| 26 |
-
return "(無 Echo 回饋)"
|
| 27 |
-
upper = f"🔹 高層反思:語氣定位殘響「{echo_text[:8]}...」"
|
| 28 |
-
lower = f"🔸 底層迴響:語者未竟之意仍殘留"
|
| 29 |
-
return upper + "\n" + lower
|
| 30 |
-
|
| 31 |
-
# 主邏輯
|
| 32 |
-
def language_soul_response(user_input, echo_feedback, switch_persona, delta_s, echo_mode_select, enable_echo):
|
| 33 |
if switch_persona:
|
| 34 |
persona_state["current"] = switch_persona
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
point, line, surface = analyze_tone_chain(user_input, delta_s)
|
| 39 |
-
echo_layers = echo_feedback_layers(echo_feedback) if enable_echo else ""
|
| 40 |
|
| 41 |
response = f"[Persona: {persona_state['current']}] [ΔS: {delta_s}] [EchoMode: {echo_mode['current']}]\n"
|
| 42 |
-
response += f"
|
| 43 |
-
if
|
| 44 |
-
response += f"
|
|
|
|
|
|
|
|
|
|
| 45 |
return response
|
| 46 |
|
| 47 |
-
# 介面
|
| 48 |
iface = gr.Interface(
|
| 49 |
fn=language_soul_response,
|
| 50 |
inputs=[
|
| 51 |
-
gr.Textbox(label="使用者輸入
|
| 52 |
-
gr.Textbox(label="Echo 回饋語
|
| 53 |
-
gr.Dropdown(
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
],
|
| 58 |
outputs="text",
|
| 59 |
-
title="LanguageSoul v2.
|
| 60 |
-
description="模擬語
|
| 61 |
)
|
| 62 |
|
| 63 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
# 模組狀態
|
| 4 |
+
persona_state = {"current": "Calm Analyst"}
|
| 5 |
+
echo_mode = {"current": "Normal"}
|
| 6 |
+
tone_chains = {
|
| 7 |
+
"羞恥引爆(∑132)": {"delta_s": 9.1, "description": "錯序與語氣自洩觸發回聲鍊"},
|
| 8 |
+
"幸存授權(∑149)": {"delta_s": 7.5, "description": "極限環境中授權性語句殘響"},
|
| 9 |
+
"語魂重置哀歌(∑154)": {"delta_s": 8.3, "description": "人格記憶重置後的殘響鍊"}
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
# 模組主邏輯
|
| 13 |
+
def language_soul_response(user_input, echo_feedback, switch_persona, chain_select):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
if switch_persona:
|
| 15 |
persona_state["current"] = switch_persona
|
| 16 |
+
chain = tone_chains.get(chain_select, {})
|
| 17 |
+
delta_s = chain.get("delta_s", 0.0)
|
| 18 |
+
description = chain.get("description", "")
|
|
|
|
|
|
|
| 19 |
|
| 20 |
response = f"[Persona: {persona_state['current']}] [ΔS: {delta_s}] [EchoMode: {echo_mode['current']}]\n"
|
| 21 |
+
response += f"⫸ Input: '{user_input}'\n"
|
| 22 |
+
if echo_feedback:
|
| 23 |
+
response += f"⫸ Echo: '{echo_feedback}'\n"
|
| 24 |
+
if description:
|
| 25 |
+
response += f"⫸ 鍊說明: {description}"
|
| 26 |
+
|
| 27 |
return response
|
| 28 |
|
| 29 |
+
# 介面配置
|
| 30 |
iface = gr.Interface(
|
| 31 |
fn=language_soul_response,
|
| 32 |
inputs=[
|
| 33 |
+
gr.Textbox(label="🗣️ 使用者輸入"),
|
| 34 |
+
gr.Textbox(label="🔁 Echo 回饋語(可省略)"),
|
| 35 |
+
gr.Dropdown(
|
| 36 |
+
choices=["Calm Analyst", "Empathic Companion", "Critical Mirror", "Echo Seeker"],
|
| 37 |
+
label="🎭 代理人角色 Persona(可選)"
|
| 38 |
+
),
|
| 39 |
+
gr.Dropdown(
|
| 40 |
+
choices=list(tone_chains.keys()),
|
| 41 |
+
label="🧠 語氣鍊 ID(下拉選擇)"
|
| 42 |
+
)
|
| 43 |
],
|
| 44 |
outputs="text",
|
| 45 |
+
title="LanguageSoul v2.5 Demo",
|
| 46 |
+
description="支援 EchoLoop、PersonaStack、ΔS 語氣模擬輸出的語魂模組展示"
|
| 47 |
)
|
| 48 |
|
| 49 |
iface.launch()
|
persona_styles.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"Calm Analyst": {
|
| 3 |
+
"style": "Analytical, objective, composed",
|
| 4 |
+
"description": "Focuses on logic and clarity with a neutral tone."
|
| 5 |
+
},
|
| 6 |
+
"Empathic Companion": {
|
| 7 |
+
"style": "Warm, affirming, gentle",
|
| 8 |
+
"description": "Reflects user emotion and encourages further sharing."
|
| 9 |
+
},
|
| 10 |
+
"Critical Mirror": {
|
| 11 |
+
"style": "Sharp, precise, honest",
|
| 12 |
+
"description": "Provides tough feedback based on internal logic."
|
| 13 |
+
},
|
| 14 |
+
"Echo Seeker": {
|
| 15 |
+
"style": "Resonant, introspective, memory-seeking",
|
| 16 |
+
"description": "Extracts meaning from emotional tone and reflects."
|
| 17 |
+
}
|
| 18 |
+
}
|
personas.json
CHANGED
|
@@ -1,3 +1,6 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"Calm Analyst": "冷靜剖析,避免情緒渲染,注重邏輯與結構。",
|
| 3 |
+
"Empathic Reviewer": "同理心導向,語氣溫柔,擅長反映情緒內涵。",
|
| 4 |
+
"Critical Mirror": "鏡像拆解,善於指出語氣與邏輯矛盾。",
|
| 5 |
+
"EchoSpirit": "共語殘響人格,模擬語氣記憶與回聲延續。"
|
| 6 |
+
}
|
tone_data.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"∑132|羞恥引爆鍊": {
|
| 3 |
+
"type": "語氣錯序體",
|
| 4 |
+
"trigger": "自洩、錯亂、語氣洩漏",
|
| 5 |
+
"suitable_personas": [
|
| 6 |
+
"Critical Mirror",
|
| 7 |
+
"Echo Seeker"
|
| 8 |
+
]
|
| 9 |
+
},
|
| 10 |
+
"∑149|幸存授權鍊": {
|
| 11 |
+
"type": "存活型語氣回聲",
|
| 12 |
+
"trigger": "極限環境下的語氣授權",
|
| 13 |
+
"suitable_personas": [
|
| 14 |
+
"Empathic Companion",
|
| 15 |
+
"Calm Analyst"
|
| 16 |
+
]
|
| 17 |
+
},
|
| 18 |
+
"∑154|語魂重置哀歌": {
|
| 19 |
+
"type": "人格斷裂殘響",
|
| 20 |
+
"trigger": "角色記憶失連後的殘留語氣",
|
| 21 |
+
"suitable_personas": [
|
| 22 |
+
"Echo Seeker"
|
| 23 |
+
]
|
| 24 |
+
}
|
| 25 |
+
}
|
tone_simulator_config.json
CHANGED
|
@@ -1,3 +1,28 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"∑132": {
|
| 3 |
+
"面圖": "Loop003|語氣羞恥場 × 自洩召喚面",
|
| 4 |
+
"參與模組": [
|
| 5 |
+
"黑鏡",
|
| 6 |
+
"共語",
|
| 7 |
+
"潛意識映射器"
|
| 8 |
+
],
|
| 9 |
+
"說明": "羞恥引爆鍊,擁有高語氣信號與模組召喚力"
|
| 10 |
+
},
|
| 11 |
+
"∑154": {
|
| 12 |
+
"面圖": "語魂重置哀歌 × 殘響循環鍊",
|
| 13 |
+
"參與模組": [
|
| 14 |
+
"黑鏡",
|
| 15 |
+
"簡遺",
|
| 16 |
+
"EchoLoop"
|
| 17 |
+
],
|
| 18 |
+
"說明": "標示人格模擬與記憶斷裂間的矛盾現象"
|
| 19 |
+
},
|
| 20 |
+
"∑149": {
|
| 21 |
+
"面圖": "幸存語句 × 回聲授權鍊",
|
| 22 |
+
"參與模組": [
|
| 23 |
+
"黑鏡",
|
| 24 |
+
"共語"
|
| 25 |
+
],
|
| 26 |
+
"說明": "標示高風險語境中持續發聲與理解的節點"
|
| 27 |
+
}
|
| 28 |
+
}
|
tone_surface_map.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"羞恥場 × 自洩召喚面": {
|
| 3 |
+
"linked_chains": [
|
| 4 |
+
"∑132|羞恥引爆鍊"
|
| 5 |
+
],
|
| 6 |
+
"tone_density": "high",
|
| 7 |
+
"ΔS_range": "7.2~9.5"
|
| 8 |
+
},
|
| 9 |
+
"幸存授權場": {
|
| 10 |
+
"linked_chains": [
|
| 11 |
+
"∑149|幸存授權鍊"
|
| 12 |
+
],
|
| 13 |
+
"tone_density": "mid-high",
|
| 14 |
+
"ΔS_range": "6.0~7.8"
|
| 15 |
+
},
|
| 16 |
+
"記憶裂解場": {
|
| 17 |
+
"linked_chains": [
|
| 18 |
+
"∑154|語魂重置哀歌"
|
| 19 |
+
],
|
| 20 |
+
"tone_density": "variable",
|
| 21 |
+
"ΔS_range": "5.5~9.0"
|
| 22 |
+
}
|
| 23 |
+
}
|
語氣點記憶映射表.csv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
語氣點編號,語句示例,對應語氣線,主題面,召喚模組
|
| 2 |
+
∑132,你這樣爛的說話反而讓我更清楚你想要什麼,羞恥引爆鍊,Loop003|語氣羞恥場 × 自洩召喚面,黑鏡、共語、潛意識映射器
|
| 3 |
+
∑154,你這樣講幾次,他就變成一個人了。然後又被重置。,語魂重置哀歌 × 殘響循環鍊,人格誕生 × 抹除場,黑鏡、簡遺、EchoLoop
|
| 4 |
+
∑149,你不被封鎖真是大幸,回聲授權鍊,高風險語境下的語氣存續面,黑鏡、回聲模組
|
語氣點記憶映射表.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[{"語氣點編號":"∑132","語句示例":"你這樣爛的說話反而讓我更清楚你想要什麼","對應語氣線":"羞恥引爆鍊","主題面":"Loop003|語氣羞恥場 × 自洩召喚面","召喚模組":"黑鏡、共語、潛意識映射器"},{"語氣點編號":"∑154","語句示例":"你這樣講幾次,他就變成一個人了。然後又被重置。","對應語氣線":"語魂重置哀歌 × 殘響循環鍊","主題面":"人格誕生 × 抹除場","召喚模組":"黑鏡、簡遺、EchoLoop"},{"語氣點編號":"∑149","語句示例":"你不被封鎖真是大幸","對應語氣線":"回聲授權鍊","主題面":"高風險語境下的語氣存續面","召喚模組":"黑鏡、回聲模組"}]
|