Files changed (1) hide show
  1. app.py +34 -12
app.py CHANGED
@@ -1,26 +1,48 @@
1
  import gradio as gr
2
 
3
- # Simple simulation of EchoLoop × PersonaStack
4
- persona_state = {"current": "Calm Analyst"}
5
 
6
- def language_soul_response(user_input, echo_feedback, switch_persona):
7
- if switch_persona:
8
- persona_state["current"] = switch_persona
9
- response = f"[{persona_state['current']}] You said: '{user_input}'"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  if echo_feedback:
11
- response += f" | Reflecting on echo: '{echo_feedback}'"
 
12
  return response
13
 
 
14
  iface = gr.Interface(
15
  fn=language_soul_response,
16
  inputs=[
17
- gr.Textbox(label="User Input"),
18
- gr.Textbox(label="Echo Feedback (Optional)"),
19
- gr.Textbox(label="Switch Persona (Optional)")
 
20
  ],
21
  outputs="text",
22
- title="LanguageSoul v2.5 Demo",
23
- description="EchoLoop × PersonaStack Module Simulation (Full Text Version)"
24
  )
25
 
26
  iface.launch()
 
 
1
  import gradio as gr
2
 
3
+ # 語魂系統模擬狀態
4
+ persona_state = {"current": "共感回應者"}
5
 
6
+ # 下拉選單選項
7
+ persona_options = [
8
+ "共感回應者",
9
+ "批判映鏡者",
10
+ "沉默觀察者",
11
+ "幽默打斷者",
12
+ "系統人格"
13
+ ]
14
+
15
+ context_options = [
16
+ "客服安撫情境",
17
+ "羞恥自洩鍊",
18
+ "語氣誤判修復",
19
+ "自責循環拆解"
20
+ ]
21
+
22
+ def language_soul_response(user_input, echo_feedback, selected_persona, context_scenario):
23
+ if selected_persona:
24
+ persona_state["current"] = selected_persona
25
+ # 模擬語氣回應輸出
26
+ response = f"[{persona_state['current']} / {context_scenario}]
27
+ 你說:『{user_input}』"
28
  if echo_feedback:
29
+ response += f"
30
+ 🪞 回聲映照:『{echo_feedback}』"
31
  return response
32
 
33
+ # 建立 Gradio 介面
34
  iface = gr.Interface(
35
  fn=language_soul_response,
36
  inputs=[
37
+ gr.Textbox(label="使用者輸入"),
38
+ gr.Textbox(label="回聲回饋(可選)"),
39
+ gr.Dropdown(choices=persona_options, label="選擇代理人模式", value="共感回應者"),
40
+ gr.Dropdown(choices=context_options, label="語氣情境類型", value="客服安撫情境")
41
  ],
42
  outputs="text",
43
+ title="🧠 語魂系統 v2.6 模擬介面",
44
+ description="模擬 EchoLoop × PersonaStack 回應邏輯,可調整語境與代理人模式。"
45
  )
46
 
47
  iface.launch()
48
+