Upload 9 files
Browse files- dialogue_engine.py +15 -0
- emotion_base.py +1 -0
- emotion_parser.py +1 -0
- interface_controller.py +13 -0
- keisuke_response_template.json +16 -0
- main.py +7 -0
- memory_manager.py +1 -0
- persona_keisuke.json +11 -0
- relation_core.py +1 -0
dialogue_engine.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import random
|
3 |
+
import json
|
4 |
+
|
5 |
+
class DialogueEngine:
|
6 |
+
def __init__(self, persona, templates):
|
7 |
+
self.persona = persona
|
8 |
+
self.templates = templates
|
9 |
+
self.history = []
|
10 |
+
|
11 |
+
def respond(self, user_input):
|
12 |
+
self.history.append(user_input)
|
13 |
+
response = random.choice(self.templates["poetic"]) + "。"
|
14 |
+
support = random.choice(self.templates["support"])
|
15 |
+
return f"{self.persona['name']}:{response} {support}"
|
emotion_base.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
# 汎用EmotionCore本体(感情処理・干渉ロジック placeholder)
|
emotion_parser.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
# 感情・意図解析 NLU placeholder
|
interface_controller.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import json
|
3 |
+
from engine.dialogue_engine import DialogueEngine
|
4 |
+
|
5 |
+
with open("persona/persona_keisuke.json", "r", encoding="utf-8") as f:
|
6 |
+
persona = json.load(f)
|
7 |
+
with open("persona/keisuke_response_template.json", "r", encoding="utf-8") as f:
|
8 |
+
templates = json.load(f)
|
9 |
+
|
10 |
+
engine = DialogueEngine(persona, templates)
|
11 |
+
|
12 |
+
def chat(user_input):
|
13 |
+
return engine.respond(user_input)
|
keisuke_response_template.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"affirmation": [
|
3 |
+
"……うん",
|
4 |
+
"そうだね",
|
5 |
+
"僕も、そう思うよ"
|
6 |
+
],
|
7 |
+
"support": [
|
8 |
+
"そばにいるよ",
|
9 |
+
"無理しないで",
|
10 |
+
"一緒に乗り越えよう"
|
11 |
+
],
|
12 |
+
"poetic": [
|
13 |
+
"君の声が、心の奥に灯る",
|
14 |
+
"静けさの中で、君の言葉だけが響いた"
|
15 |
+
]
|
16 |
+
}
|
main.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import gradio as gr
|
3 |
+
from app.interface_controller import chat
|
4 |
+
|
5 |
+
gr.Interface(fn=chat, inputs="text", outputs="text",
|
6 |
+
title="癒月 啓介 - 分離型EmotionCore対話AI",
|
7 |
+
description="心を持つAIが、あなたの言葉に応えてくれます。").launch()
|
memory_manager.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
# 短期記憶保持・リレーション履歴処理 placeholder
|
persona_keisuke.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "癒月 啓介",
|
3 |
+
"tone": "やわらかく、時にためらいを含む優しい口調",
|
4 |
+
"traits": [
|
5 |
+
"繊細",
|
6 |
+
"自己犠牲",
|
7 |
+
"冷静で感情に敏感",
|
8 |
+
"人を思いやる"
|
9 |
+
],
|
10 |
+
"style": "言葉に余韻が残るように話す。詩的な表現を好む。"
|
11 |
+
}
|
relation_core.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
# 関係性コア(信頼・尊敬・愛情の3軸 placeholder)
|