update README.md
This commit is contained in:
parent
37277e0282
commit
74005e65d6
88
README.md
88
README.md
@ -1,63 +1,57 @@
|
||||
# Wolf Chat Bot
|
||||
# Wolf Chat - Last War Game Automated Chat Assistant
|
||||
|
||||
A specialized chat assistant that integrates with the "Last War-Survival Game" by monitoring the game's chat window using screen recognition technology.
|
||||
## Project Overview
|
||||
|
||||
## Overview
|
||||
Wolf Chat is a chatbot assistant designed specifically for integration with "Last War-Survival Game," using screen recognition technology to monitor the game's chat window and automatically respond to messages containing keywords.
|
||||
|
||||
This project implements an AI assistant that:
|
||||
- Monitors the game chat window using computer vision
|
||||
- Detects messages containing keywords ("wolf" or "Wolf")
|
||||
- Processes requests through a language model
|
||||
- Automatically responds in the game chat
|
||||
This bot will:
|
||||
- Automatically monitor the game chat window
|
||||
- Detect chat messages containing the keywords "wolf" or "Wolf"
|
||||
- Generate responses using a language model
|
||||
- Automatically input responses into the game chat interface
|
||||
|
||||
The code is developed in English, but supports Traditional Chinese interface and logs for broader accessibility.
|
||||
## Main Features
|
||||
|
||||
## Features
|
||||
- **Language Model Integration**: Supports OpenAI API or compatible AI services for intelligent response generation
|
||||
- **MCP Framework**: Modular Capability Provider architecture supporting extended functionality and tool calls
|
||||
- **Persona System**: Provides detailed character definition for personality-driven responses
|
||||
- **Chat Logging**: Automatically saves conversation history for contextual understanding
|
||||
|
||||
- **Image-based Chat Monitoring**: Uses OpenCV and PyAutoGUI to detect chat bubbles and keywords
|
||||
- **Language Model Integration**: Uses GPT models or compatible AI services
|
||||
- **MCP Framework**: Integrates with Modular Capability Provider for extensible features
|
||||
- **Persona System**: Supports detailed character persona definition
|
||||
- **Automated UI Interaction**: Handles copy/paste operations and menu navigation
|
||||
|
||||
## Requirements
|
||||
## System Requirements
|
||||
|
||||
- Python 3.8+
|
||||
- OpenAI API key or compatible service
|
||||
- MCP Framework
|
||||
- Game client ("Last War-Survival Game")
|
||||
- OpenCV, PyAutoGUI, and other dependencies (see requirements.txt)
|
||||
|
||||
## Installation
|
||||
## Installation Guide
|
||||
|
||||
1. Clone this repository:
|
||||
```
|
||||
git clone [repository-url]
|
||||
cd dandan
|
||||
```
|
||||
1. **Download Method**:
|
||||
- Download the ZIP file directly from GitHub (click the green "Code" button, select "Download ZIP")
|
||||
- Extract to a folder of your choice
|
||||
|
||||
2. Install required packages:
|
||||
2. **Install Dependencies**:
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
3. Create a `.env` file with your API keys:
|
||||
3. **Create a `.env` file** with your API keys:
|
||||
```
|
||||
OPENAI_API_KEY=your_api_key_here
|
||||
EXA_API_KEY=your_exa_key_here
|
||||
```
|
||||
|
||||
4. Capture required UI template images (see "UI Setup" section)
|
||||
4. **Capture necessary UI template images** (see "UI Setup" section below)
|
||||
|
||||
## Configuration
|
||||
## Configuration Settings
|
||||
|
||||
1. **API Settings**: Edit `config.py` to set up your preferred language model provider:
|
||||
1. **API Settings**: Edit `config.py` to set your preferred language model provider:
|
||||
```python
|
||||
OPENAI_API_BASE_URL = "https://openrouter.ai/api/v1" # Or other compatible provider
|
||||
LLM_MODEL = "deepseek/deepseek-chat-v3-0324" # Or other model
|
||||
```
|
||||
|
||||
2. **MCP Servers**: Configure MCP servers in `config.py`:
|
||||
2. **MCP Servers**: Configure MCP servers in `config.py` (if using this feature):
|
||||
```python
|
||||
MCP_SERVERS = {
|
||||
"exa": { "command": "cmd", "args": [...] },
|
||||
@ -70,26 +64,32 @@ The code is developed in English, but supports Traditional Chinese interface and
|
||||
WINDOW_TITLE = "Last War-Survival Game"
|
||||
```
|
||||
|
||||
4. **Chat Persona**: Customize `persona.json` to define the bot's personality
|
||||
4. **Chat Persona**: Customize `persona.json` to define the bot's personality traits
|
||||
|
||||
## UI Setup
|
||||
|
||||
The system requires template images of UI elements to function properly:
|
||||
|
||||
1. Run the window setup script to position your game window:
|
||||
1. **Run the window setup script** to position your game window:
|
||||
```
|
||||
python window-setup-script.py --launch
|
||||
```
|
||||
|
||||
2. Capture the following UI elements and save them to the `templates` folder:
|
||||
2. **Capture the following UI elements** and save them to the `templates` folder:
|
||||
- Chat bubble corners (regular and bot)
|
||||
- Keywords "wolf" and "Wolf"
|
||||
- Menu elements like "Copy" button
|
||||
- Profile and user detail page elements
|
||||
- **Capitol icon in the Profile page** (critical!)
|
||||
|
||||
Screenshot names should match the constants defined in `ui_interaction.py`.
|
||||
|
||||
## Usage
|
||||
3. **Window Monitor Tool**: Use the following command to start window monitoring, ensuring the game window stays on top:
|
||||
```
|
||||
python window-monitor-script.py
|
||||
```
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
1. Start the game client
|
||||
|
||||
@ -100,25 +100,21 @@ The system requires template images of UI elements to function properly:
|
||||
|
||||
3. The bot will start monitoring the chat for messages containing "wolf" or "Wolf"
|
||||
|
||||
4. When detected, it will:
|
||||
4. When a keyword is detected, it will:
|
||||
- Copy the message content
|
||||
- Get the sender's name
|
||||
- Process the request using the language model
|
||||
- Automatically send a response in chat
|
||||
- Automatically send a response in the chat
|
||||
|
||||
## How It Works
|
||||
## Hotkeys
|
||||
|
||||
1. **Monitoring**: The UI thread continuously scans the screen for chat bubbles
|
||||
2. **Detection**: When a bubble with "wolf" keyword is found, the message is extracted
|
||||
3. **Processing**: The message is sent to the language model with the persona context
|
||||
4. **Response**: The AI generates a response based on the persona
|
||||
5. **Interaction**: The system automatically inputs the response in the game chat
|
||||
- **F7**: Clear recently processed conversation history
|
||||
- **F8**: Pause/resume the script's main functions (UI monitoring, LLM interaction)
|
||||
- **F9**: Trigger the script's normal shutdown process
|
||||
|
||||
## Developer Tools
|
||||
|
||||
- **Window Setup Script**: Helps position the game window for UI template capture
|
||||
- **UI Interaction Debugging**: Can be tested independently by running `ui_interaction.py`
|
||||
- **Persona Customization**: Edit `persona.json` to change the bot's character
|
||||
- **LLM Debug Script** (`test/llm_debug_script.py`): Bypasses the UI interaction layer to directly interact with the language model for debugging, useful for testing prompts and MCP tool calls
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@ -126,4 +122,4 @@ The system requires template images of UI elements to function properly:
|
||||
- **MCP Connection Errors**: Check server configurations in `config.py`
|
||||
- **API Errors**: Verify your API keys in the `.env` file
|
||||
- **UI Automation Failures**: Update template images to match your client's appearance
|
||||
|
||||
- **Window Position Issues**: Ensure the game window stays in the correct position, use `window-monitor-script.py`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user