- AI-Driven Emotional Portraits: Automatically generate character portraits that reflect the emotion in dialogue.
- Modern Web Interface: User-friendly, responsive UI for dialogue browsing and portrait generation.
- Model Selection: Choose from multiple AI models (pixel, cartoon, realistic, etc.) for different art styles.
- Prompt Caching: LLM-generated prompts are cached for efficiency and speed.
- No Image Caching: Every generation is unique, even with the same parameters.
This project proposes the development of an Affect-Responsive Dialogue System for game characters, inspired by the relationship between dialogue, emotional state, and character portrayal as seen in the provided example. The system aims to enable NPCs to dynamically alter their dialogue—and optionally facial expressions or behavior—based on an analyzed emotional state. This creates more immersive and believable interactions.
Example Reference: A character resembling Emily from Stardew Valley says,
"你让我心都碎了……我不能再和你说话了。"
(“you've broken my heart...I can't talk to you anymore.”)Mood Analysis: The dialogue conveys strong negative emotion, reflecting emotional pain and disappointment. Terms like "心都碎了" ("heartbroken") express sadness and betrayal, while the refusal to continue the conversation suggests a state of anger, despair, and emotional withdrawal.
- Main Page:
- Prominently displays the EmoteCraft name and a brief introduction.
- Allows users to select a dialogue group and open the dialogue interface.
- Beautiful Stardew Valley-inspired background.
- Dialogue Page:
- Shows character portrait, dialogue, and navigation.
- Right panel for model/denoise selection and real-time prompt display.
- "Back to Home" button for easy navigation.
- Install dependencies:
pip install flask requests
- Prepare your data:
- Place dialogue JSON files in
Data/dialogue/Chinese/. - Place character avatars in
input3/. - Place your background image in
static/images/stardew_bg.png.
- Place dialogue JSON files in
- Start ComfyUI:
- Make sure you have a ComfyUI environment running at
127.0.0.1:8188(default port) for image generation to work.
- Make sure you have a ComfyUI environment running at
- Run the app:
python app.py
- Open your browser and visit
http://localhost:5000.
To enable AI prompt generation, you need to configure your LLM (Large Language Model) API credentials. Set the following environment variables before running the app:
LLM_API_BASE— The base URL of your LLM API (e.g., OpenAI-compatible endpoint)LLM_API_KEY— Your API key/tokenLLM_MODEL_NAME— The model name to use (e.g.,gpt-3.5-turbo,deepseek-chat)
Example (Linux/macOS):
export LLM_API_BASE="https://api.openai.com/v1"
export LLM_API_KEY="sk-xxxxxxx"
export LLM_MODEL_NAME="gpt-3.5-turbo"Example (Windows CMD):
set LLM_API_BASE=https://api.openai.com/v1
set LLM_API_KEY=sk-xxxxxxx
set LLM_MODEL_NAME=gpt-3.5-turboThis project is licensed under the MIT License.
We welcome feedback, suggestions, and contributions!
- GitHub Repository Issues Page: For bug reports, feature requests, and discussions, please submit on the [Issues]