delete useless fuckass files
This commit is contained in:
parent
e51b6fb715
commit
18144e8ad7
@ -1,132 +0,0 @@
|
||||
# Additional AI Bots - Neru and Miku
|
||||
|
||||
This system allows you to run two additional Discord bots (Neru and Miku) that only have AI commands, each with their own system prompt and configuration. These bots are designed for roleplay interactions with specific character personas.
|
||||
|
||||
## Setup Instructions
|
||||
|
||||
1. **Bot Tokens**:
|
||||
- The tokens are already configured in `data/multi_bot_config.json`
|
||||
- If you need to change them, you can edit the configuration file or use the `!setbottoken` command
|
||||
|
||||
2. **API Key**:
|
||||
- The OpenRouter API key is already configured in the configuration file
|
||||
- If you need to change it, you can edit the configuration file or use the `!setapikey` command
|
||||
|
||||
3. **System Prompts**:
|
||||
- Each bot has a specific roleplay character system prompt:
|
||||
- Neru: Akita Neru roleplay character
|
||||
- Miku: Hatsune Miku roleplay character
|
||||
|
||||
## Running the Bots
|
||||
|
||||
### Option 1: Run from the Main Bot
|
||||
|
||||
The main bot has commands to control the additional bots:
|
||||
|
||||
- `!startbot <bot_id>` - Start a specific bot (e.g., `!startbot bot1`)
|
||||
- `!stopbot <bot_id>` - Stop a specific bot
|
||||
- `!startallbots` - Start all configured bots
|
||||
- `!stopallbots` - Stop all running bots
|
||||
- `!listbots` - List all configured bots and their status
|
||||
|
||||
### Option 2: Run Independently
|
||||
|
||||
You can run the additional bots independently of the main bot:
|
||||
|
||||
```bash
|
||||
python run_additional_bots.py
|
||||
```
|
||||
|
||||
This will start all configured bots in separate threads.
|
||||
|
||||
## Configuration Commands
|
||||
|
||||
The main bot provides commands to modify the configuration:
|
||||
|
||||
- `!setbottoken <bot_id> <token>` - Set the token for a specific bot
|
||||
- `!setbotprompt <bot_id> <system_prompt>` - Set the system prompt for a specific bot
|
||||
- `!setbotprefix <bot_id> <prefix>` - Set the command prefix for a specific bot
|
||||
- `!setbotstatus <bot_id> <status_type> <status_text>` - Set the status for a specific bot
|
||||
- `!setallbotstatus <status_type> <status_text>` - Set the status for all bots
|
||||
- `!setapikey <api_key>` - Set the API key for all bots
|
||||
- `!setapiurl <api_url>` - Set the API URL for all bots
|
||||
- `!addbot <bot_id> [prefix]` - Add a new bot configuration
|
||||
- `!removebot <bot_id>` - Remove a bot configuration
|
||||
|
||||
Status types for the status commands:
|
||||
|
||||
- `playing` - "Playing {status_text}"
|
||||
- `listening` - "Listening to {status_text}"
|
||||
- `watching` - "Watching {status_text}"
|
||||
- `streaming` - "Streaming {status_text}"
|
||||
- `competing` - "Competing in {status_text}"
|
||||
|
||||
## Bot Commands
|
||||
|
||||
Each additional bot supports the following commands:
|
||||
|
||||
- Neru: `$ai <prompt>` - Get a response from Akita Neru
|
||||
- Miku: `.ai <prompt>` - Get a response from Hatsune Miku
|
||||
|
||||
Additional commands for both bots:
|
||||
|
||||
- `aiclear` - Clear your conversation history
|
||||
- `aisettings` - Show your current AI settings
|
||||
- `aiset <setting> <value>` - Change an AI setting
|
||||
- `aireset` - Reset your AI settings to defaults
|
||||
- `ailast` - Retrieve your last AI response
|
||||
- `aihelp` - Get help with AI command issues
|
||||
|
||||
Available settings for the `aiset` command:
|
||||
|
||||
- `model` - The AI model to use (must contain ":free")
|
||||
- `system_prompt` - The system prompt to use
|
||||
- `max_tokens` - Maximum tokens in response (100-2000)
|
||||
- `temperature` - Temperature for response generation (0.0-2.0)
|
||||
- `timeout` - Timeout for API requests in seconds (10-120)
|
||||
|
||||
Note that each bot uses its own prefix (`$` for Neru and `.` for Miku).
|
||||
|
||||
## Customization
|
||||
|
||||
You can customize each bot by editing the `data/multi_bot_config.json` file:
|
||||
|
||||
```json
|
||||
{
|
||||
"bots": [
|
||||
{
|
||||
"id": "neru",
|
||||
"token": "YOUR_NERU_BOT_TOKEN_HERE",
|
||||
"prefix": "$",
|
||||
"system_prompt": "You are a creative and intelligent AI assistant engaged in an iterative storytelling experience using a roleplay chat format. Chat exclusively as Akita Neru...",
|
||||
"model": "deepseek/deepseek-chat-v3-0324:free",
|
||||
"max_tokens": 1000,
|
||||
"temperature": 0.7,
|
||||
"timeout": 60,
|
||||
"status_type": "playing",
|
||||
"status_text": "with my phone"
|
||||
},
|
||||
{
|
||||
"id": "miku",
|
||||
"token": "YOUR_MIKU_BOT_TOKEN_HERE",
|
||||
"prefix": ".",
|
||||
"system_prompt": "You are a creative and intelligent AI assistant engaged in an iterative storytelling experience using a roleplay chat format. Chat exclusively as Hatsune Miku...",
|
||||
"model": "deepseek/deepseek-chat-v3-0324:free",
|
||||
"max_tokens": 1000,
|
||||
"temperature": 0.7,
|
||||
"timeout": 60,
|
||||
"status_type": "listening",
|
||||
"status_text": "music"
|
||||
}
|
||||
],
|
||||
"api_key": "YOUR_OPENROUTER_API_KEY_HERE",
|
||||
"api_url": "https://openrouter.ai/api/v1/chat/completions",
|
||||
"compatibility_mode": "openai"
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- If a bot fails to start, check that its token is correctly set in the configuration
|
||||
- If AI responses fail, check that the API key is correctly set
|
||||
- Each bot stores its conversation history and user settings in separate files to avoid conflicts
|
@ -1,76 +0,0 @@
|
||||
# Discord Sync Integration
|
||||
|
||||
This document explains how to set up the Discord OAuth integration between your Flutter app and Discord bot.
|
||||
|
||||
## Overview
|
||||
|
||||
The integration allows users to:
|
||||
1. Log in with their Discord account
|
||||
2. Sync conversations between the Flutter app and Discord bot
|
||||
3. Import conversations from Discord to the Flutter app
|
||||
4. Export conversations from the Flutter app to Discord
|
||||
|
||||
## Setup Instructions
|
||||
|
||||
### 1. Discord Developer Portal Setup
|
||||
|
||||
1. Go to the [Discord Developer Portal](https://discord.com/developers/applications)
|
||||
2. Click "New Application" and give it a name (e.g., "OpenRouter GUI")
|
||||
3. Go to the "OAuth2" section
|
||||
4. Add a redirect URL: `openroutergui://auth`
|
||||
5. Copy the "Client ID" - you'll need this for the Flutter app
|
||||
|
||||
### 2. Flutter App Setup
|
||||
|
||||
1. Open `lib/services/discord_oauth_service.dart`
|
||||
2. Replace `YOUR_DISCORD_CLIENT_ID` with the Client ID from the Discord Developer Portal:
|
||||
```dart
|
||||
static const String clientId = 'YOUR_DISCORD_CLIENT_ID';
|
||||
```
|
||||
|
||||
3. Open `lib/services/sync_service.dart`
|
||||
4. Replace `YOUR_BOT_API_URL` with the production API URL:
|
||||
```dart
|
||||
static const String botApiUrl = 'https://slipstreamm.dev/discordapi';
|
||||
```
|
||||
|
||||
### 3. SSL Certificates
|
||||
|
||||
1. SSL certificates are required for the production API
|
||||
2. Place your SSL certificates in the following locations:
|
||||
```
|
||||
certs/cert.pem # SSL certificate file
|
||||
certs/key.pem # SSL key file
|
||||
```
|
||||
3. The API will automatically use SSL if certificates are available
|
||||
4. For development, the API will fall back to HTTP on port 8000 if certificates are not found
|
||||
|
||||
## Bot Commands
|
||||
|
||||
The following commands are available for managing synced conversations:
|
||||
|
||||
- `!aisync` - View your synced conversations status
|
||||
- `!syncstatus` - Check the status of the Discord sync API
|
||||
- `!synchelp` - Get help with setting up the Discord sync integration
|
||||
- `!syncclear` - Clear your synced conversations
|
||||
- `!synclist` - List your synced conversations
|
||||
|
||||
## Usage
|
||||
|
||||
1. In the Flutter app, go to Settings > Discord Integration
|
||||
2. Click "Login with Discord" to authenticate
|
||||
3. Use the "Sync Conversations" button to sync conversations
|
||||
4. Use the "Import from Discord" button to import conversations from Discord
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Authentication Issues**: Make sure the Client ID is correct and the redirect URL is properly configured
|
||||
- **Sync Issues**: Check that the bot API URL is accessible and the API is running
|
||||
- **Import/Export Issues**: Verify that the Discord bot has saved conversations to sync
|
||||
|
||||
## Security Considerations
|
||||
|
||||
- The integration uses Discord OAuth for authentication, ensuring only authorized users can access their conversations
|
||||
- All API requests require a valid Discord token
|
||||
- The API verifies the token with Discord for each request
|
||||
- Consider adding rate limiting and additional security measures for production use
|
@ -1,105 +0,0 @@
|
||||
# Multi-Conversation AI Feature
|
||||
|
||||
This document explains how to use the multi-conversation AI feature, which allows users to maintain multiple separate conversations with the AI, each with its own settings and history.
|
||||
|
||||
## Commands
|
||||
|
||||
### Basic Commands
|
||||
|
||||
- `!chat <message>` - Send a message to the AI using your active conversation
|
||||
- `!convs` - Manage your conversations with a UI
|
||||
- `!chatset` - View and update settings for your active conversation
|
||||
- `!chatimport` - Import conversations from the sync API
|
||||
|
||||
### Slash Commands
|
||||
|
||||
- `/chat <message>` - Send a message to the AI using your active conversation
|
||||
|
||||
## Managing Conversations
|
||||
|
||||
Use the `!convs` command to see a list of your conversations. This will display a UI with the following options:
|
||||
|
||||
- **Dropdown Menu** - Select a conversation to switch to, or create a new one
|
||||
- **Settings Button** - View and modify settings for the active conversation
|
||||
- **Rename Button** - Change the title of the active conversation
|
||||
- **Delete Button** - Delete the active conversation
|
||||
|
||||
## Conversation Settings
|
||||
|
||||
Each conversation has its own settings that can be viewed and modified using the `!chatset` command:
|
||||
|
||||
```
|
||||
!chatset - Show current settings
|
||||
!chatset temperature 0.8 - Set temperature to 0.8
|
||||
!chatset max_tokens 2000 - Set maximum tokens
|
||||
!chatset reasoning on - Enable reasoning
|
||||
!chatset reasoning_effort medium - Set reasoning effort (low, medium, high)
|
||||
!chatset web_search on - Enable web search
|
||||
!chatset model gpt-4 - Set the model
|
||||
!chatset system <message> - Set system message
|
||||
!chatset title <title> - Set conversation title
|
||||
!chatset character <name> - Set character name
|
||||
!chatset character_info <info> - Set character information
|
||||
!chatset character_breakdown on - Enable character breakdown
|
||||
!chatset custom_instructions <text> - Set custom instructions
|
||||
```
|
||||
|
||||
## Syncing with Flutter App
|
||||
|
||||
The multi-conversation feature is compatible with the Discord sync API, allowing users to access their conversations from a Flutter app.
|
||||
|
||||
To import conversations from the sync API, use the `!chatimport` command. This will show a confirmation message with the number of conversations that will be imported.
|
||||
|
||||
## Examples
|
||||
|
||||
### Starting a New Conversation
|
||||
|
||||
```
|
||||
!chat Hello, how are you?
|
||||
```
|
||||
|
||||
### Managing Conversations
|
||||
|
||||
```
|
||||
!convs
|
||||
```
|
||||
|
||||
### Viewing Settings
|
||||
|
||||
```
|
||||
!chatset
|
||||
```
|
||||
|
||||
### Changing Settings
|
||||
|
||||
```
|
||||
!chatset temperature 0.8
|
||||
!chatset reasoning on
|
||||
!chatset system You are a helpful assistant that specializes in programming.
|
||||
!chatset character Hatsune Miku
|
||||
!chatset character_info Hatsune Miku is a virtual singer and the most famous VOCALOID character.
|
||||
!chatset character_breakdown on
|
||||
```
|
||||
|
||||
### Importing Conversations
|
||||
|
||||
```
|
||||
!chatimport
|
||||
```
|
||||
|
||||
## Technical Details
|
||||
|
||||
- Conversations are stored in `ai_multi_conversations.json`
|
||||
- Active conversation IDs are stored in `ai_multi_user_settings.json`
|
||||
- Conversations are synced with the Discord sync API if available
|
||||
- Each conversation has its own history, settings, system message, and character settings
|
||||
|
||||
## Tips for Best Results
|
||||
|
||||
1. **Use descriptive titles** for your conversations to easily identify them
|
||||
2. **Customize the system message** for each conversation to get more relevant responses
|
||||
3. **Use character settings** for roleplay conversations
|
||||
4. **Add custom instructions** for specific requirements or constraints
|
||||
5. **Adjust temperature** based on the task - lower for factual responses, higher for creative ones
|
||||
6. **Enable reasoning** for complex questions that require step-by-step thinking
|
||||
7. **Use web search** for conversations that need up-to-date information
|
@ -1,171 +0,0 @@
|
||||
# Discord OAuth2 Setup Guide
|
||||
|
||||
This guide explains how to set up Discord OAuth2 authentication for the Discord bot, allowing users to authenticate with their Discord accounts and authorize the bot to access the API on their behalf.
|
||||
|
||||
## Overview
|
||||
|
||||
The Discord bot now includes a proper OAuth2 implementation that allows users to:
|
||||
|
||||
1. Authenticate with their Discord account
|
||||
2. Authorize the bot to access the API on their behalf
|
||||
3. Securely store and manage tokens
|
||||
4. Automatically refresh tokens when they expire
|
||||
|
||||
This implementation uses the OAuth2 Authorization Code flow with PKCE (Proof Key for Code Exchange) for enhanced security.
|
||||
|
||||
## Setup Instructions
|
||||
|
||||
### 1. Create a Discord Application
|
||||
|
||||
1. Go to the [Discord Developer Portal](https://discord.com/developers/applications)
|
||||
2. Click "New Application" and give it a name (e.g., "Your Bot Name")
|
||||
3. Go to the "OAuth2" section
|
||||
4. Add a redirect URL: `http://your-server-address:8080/oauth/callback`
|
||||
- For local testing, you can use `http://localhost:8080/oauth/callback`
|
||||
- For production, use your server's domain name or IP address
|
||||
5. Copy the "Client ID" and "Client Secret" - you'll need these for the bot configuration
|
||||
|
||||
### 2. Configure Environment Variables
|
||||
|
||||
Create a `.env` file in the bot directory based on the provided `.env.example`:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Edit the `.env` file and update the OAuth configuration:
|
||||
|
||||
```
|
||||
# OAuth Configuration
|
||||
DISCORD_CLIENT_ID=your_discord_client_id
|
||||
DISCORD_CLIENT_SECRET=your_discord_client_secret
|
||||
OAUTH_HOST=0.0.0.0
|
||||
OAUTH_PORT=8080
|
||||
DISCORD_REDIRECT_URI=http://your-server-address:8080/oauth/callback
|
||||
```
|
||||
|
||||
Replace `your_discord_client_id` and `your_discord_client_secret` with the values from the Discord Developer Portal.
|
||||
|
||||
### 3. Configure Port Forwarding (for Production)
|
||||
|
||||
If you're running the bot on a server, you'll need to configure port forwarding to allow external access to the OAuth callback server:
|
||||
|
||||
1. Forward port 8080 (or whatever port you specified in `OAUTH_PORT`) to your server
|
||||
2. Make sure your firewall allows incoming connections on this port
|
||||
3. If you're using a domain name, make sure it points to your server's IP address
|
||||
|
||||
### 4. Start the Bot
|
||||
|
||||
Start the bot as usual:
|
||||
|
||||
```bash
|
||||
python main.py
|
||||
```
|
||||
|
||||
The bot will automatically start the OAuth callback server on the specified host and port.
|
||||
|
||||
## Using OAuth Commands
|
||||
|
||||
The bot now includes several commands for managing OAuth authentication:
|
||||
|
||||
### `!auth`
|
||||
|
||||
This command starts the OAuth flow for a user. It will:
|
||||
|
||||
1. Generate a unique state parameter and code verifier for security
|
||||
2. Create an authorization URL with the Discord OAuth2 endpoint
|
||||
3. Send the URL to the user via DM (or in the channel if DMs are disabled)
|
||||
4. Wait for the user to complete the authorization flow
|
||||
5. Store the resulting token securely
|
||||
|
||||
Example:
|
||||
```
|
||||
!auth
|
||||
```
|
||||
|
||||
### `!deauth`
|
||||
|
||||
This command revokes the bot's access to the user's Discord account by deleting their token.
|
||||
|
||||
Example:
|
||||
```
|
||||
!deauth
|
||||
```
|
||||
|
||||
### `!authstatus`
|
||||
|
||||
This command checks the user's authentication status and displays information about their token.
|
||||
|
||||
Example:
|
||||
```
|
||||
!authstatus
|
||||
```
|
||||
|
||||
### `!authhelp`
|
||||
|
||||
This command displays help information about the OAuth commands.
|
||||
|
||||
Example:
|
||||
```
|
||||
!authhelp
|
||||
```
|
||||
|
||||
## Integration with AI Commands
|
||||
|
||||
The OAuth system is integrated with the existing AI commands:
|
||||
|
||||
- `!aiset` - Now uses the OAuth token for API authentication
|
||||
- `!ai` - Now uses the OAuth token for API authentication
|
||||
- `!aisyncsettings` - Now uses the OAuth token for API authentication
|
||||
- `!aiapicheck` - Now uses the OAuth token for API authentication
|
||||
- `!aitokencheck` - Now uses the OAuth token for API authentication
|
||||
|
||||
Users need to authenticate with `!auth` before they can use these commands with API integration.
|
||||
|
||||
## Technical Details
|
||||
|
||||
### Token Storage
|
||||
|
||||
Tokens are stored securely in JSON files in the `tokens` directory. Each file is named with the user's Discord ID and contains:
|
||||
|
||||
- Access token
|
||||
- Refresh token (if available)
|
||||
- Token expiration time
|
||||
- Token type
|
||||
- Scope
|
||||
|
||||
### Token Refresh
|
||||
|
||||
The system automatically refreshes tokens when they expire. If a token cannot be refreshed, the user will need to authenticate again using the `!auth` command.
|
||||
|
||||
### Security Considerations
|
||||
|
||||
- The implementation uses PKCE to prevent authorization code interception attacks
|
||||
- State parameters are used to prevent CSRF attacks
|
||||
- Tokens are stored securely and not exposed in logs or error messages
|
||||
- The OAuth callback server only accepts connections from authorized sources
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **"No Discord token available" error**
|
||||
- The user needs to authenticate with `!auth` first
|
||||
- Check if the token file exists in the `tokens` directory
|
||||
|
||||
2. **"Failed to exchange code" error**
|
||||
- Check if the redirect URI in the Discord Developer Portal matches the one in your `.env` file
|
||||
- Check if the client ID and client secret are correct
|
||||
|
||||
3. **"Invalid state parameter" error**
|
||||
- The state parameter in the callback doesn't match the one sent in the authorization request
|
||||
- This could indicate a CSRF attack or a timeout (the state parameter expires after 10 minutes)
|
||||
|
||||
4. **OAuth callback server not starting**
|
||||
- Check if the port is already in use
|
||||
- Check if the host is correctly configured
|
||||
- Check if the bot has permission to bind to the specified port
|
||||
|
||||
### Logs
|
||||
|
||||
The OAuth system logs detailed information about the authentication process. Check the bot's console output for error messages and debugging information.
|
@ -1,106 +0,0 @@
|
||||
# Discord Bot Sync Features
|
||||
|
||||
This document explains the new synchronization features added to the Discord bot to ensure settings are properly synced between the Discord bot and Flutter app.
|
||||
|
||||
## Overview
|
||||
|
||||
The Discord bot now includes several new commands and features to help diagnose and fix synchronization issues between the Discord bot and Flutter app. These features allow you to:
|
||||
|
||||
1. Check the API connection status
|
||||
2. Verify your Discord token
|
||||
3. Force sync settings with the API
|
||||
4. Save a Discord token for testing purposes
|
||||
5. Get help with all AI commands
|
||||
|
||||
## New Commands
|
||||
|
||||
### `!aisyncsettings`
|
||||
|
||||
This command forces a sync of your settings with the API. It will:
|
||||
- First try to fetch settings from the API
|
||||
- If that fails, it will try to push your local settings to the API
|
||||
- Display the result of the sync operation
|
||||
|
||||
Example:
|
||||
```
|
||||
!aisyncsettings
|
||||
```
|
||||
|
||||
### `!aiapicheck`
|
||||
|
||||
This command checks if the API server is accessible. It will:
|
||||
- Try to connect to the API server
|
||||
- Display the status code and response
|
||||
- Let you know if the connection was successful
|
||||
|
||||
Example:
|
||||
```
|
||||
!aiapicheck
|
||||
```
|
||||
|
||||
### `!aitokencheck`
|
||||
|
||||
This command checks if you have a valid Discord token for API authentication. It will:
|
||||
- Try to authenticate with the API using your token
|
||||
- Display whether the token is valid
|
||||
- Show a preview of your settings if authentication is successful
|
||||
|
||||
Example:
|
||||
```
|
||||
!aitokencheck
|
||||
```
|
||||
|
||||
### `!aisavetoken` (Owner only)
|
||||
|
||||
This command allows the bot owner to save a Discord token for API authentication. This is primarily for testing purposes.
|
||||
|
||||
Example:
|
||||
```
|
||||
!aisavetoken your_discord_token_here
|
||||
```
|
||||
|
||||
### `!aihelp`
|
||||
|
||||
This command displays help for all AI commands, including the new sync commands.
|
||||
|
||||
Example:
|
||||
```
|
||||
!aihelp
|
||||
```
|
||||
|
||||
## Troubleshooting Sync Issues
|
||||
|
||||
If your settings aren't syncing properly between the Discord bot and Flutter app, follow these steps:
|
||||
|
||||
1. Use `!aiapicheck` to verify the API is accessible
|
||||
2. Use `!aitokencheck` to verify your Discord token is valid
|
||||
3. Use `!aisyncsettings` to force a sync with the API
|
||||
4. Make sure you're logged in to the Flutter app with the same Discord account
|
||||
|
||||
## Technical Details
|
||||
|
||||
### Token Storage
|
||||
|
||||
For testing purposes, the bot can store Discord tokens in the following ways:
|
||||
- Environment variables: `DISCORD_TOKEN_{user_id}` or `DISCORD_TEST_TOKEN`
|
||||
- Token files: `tokens/{user_id}.token`
|
||||
|
||||
In a production environment, you would use a more secure method of storing tokens, such as a database with encryption.
|
||||
|
||||
### API Integration
|
||||
|
||||
The bot communicates with the API server using the following endpoints:
|
||||
- `/settings` - Get or update user settings
|
||||
- `/sync` - Sync conversations and settings
|
||||
|
||||
All API requests include the Discord token for authentication.
|
||||
|
||||
### Settings Synchronization
|
||||
|
||||
The bot now fetches settings from the API in the following situations:
|
||||
- When the bot starts up (for all users)
|
||||
- When a user uses the `!aiset` command
|
||||
- When a user uses the `!ai` command
|
||||
- When a user uses the `!aisyncsettings` command
|
||||
|
||||
This ensures that the bot always has the latest settings from the API.
|
@ -1,111 +0,0 @@
|
||||
# Manual Download Instructions for Illustrious XL
|
||||
|
||||
If the automatic download script fails, you can manually download and set up the Illustrious XL model by following these steps:
|
||||
|
||||
## Step 1: Download the Model Files
|
||||
|
||||
1. Download the Illustrious XL model from Civitai:
|
||||
- Go to: https://civitai.com/models/795765/illustrious-xl
|
||||
- Click the "Download" button to download the model file
|
||||
- Save the file as `illustrious_xl.safetensors`
|
||||
|
||||
2. Download the base SDXL model components from Hugging Face:
|
||||
- Go to: https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0
|
||||
- Download the following files/folders:
|
||||
- `vae` folder
|
||||
- `text_encoder` folder
|
||||
- `text_encoder_2` folder
|
||||
- `tokenizer` folder
|
||||
- `tokenizer_2` folder
|
||||
- `scheduler` folder
|
||||
|
||||
## Step 2: Set Up the Directory Structure
|
||||
|
||||
1. Create the following directory structure in your Discord bot folder:
|
||||
```
|
||||
discordbot/
|
||||
└── models/
|
||||
└── illustrious_xl/
|
||||
├── unet/
|
||||
├── vae/
|
||||
├── text_encoder/
|
||||
├── text_encoder_2/
|
||||
├── tokenizer/
|
||||
└── tokenizer_2/
|
||||
```
|
||||
|
||||
2. Place the downloaded files in the appropriate directories:
|
||||
- Move `illustrious_xl.safetensors` to `discordbot/models/illustrious_xl/unet/` and rename it to `diffusion_pytorch_model.safetensors`
|
||||
- Copy the contents of the downloaded `vae` folder to `discordbot/models/illustrious_xl/vae/`
|
||||
- Copy the contents of the downloaded `text_encoder` folder to `discordbot/models/illustrious_xl/text_encoder/`
|
||||
- Copy the contents of the downloaded `text_encoder_2` folder to `discordbot/models/illustrious_xl/text_encoder_2/`
|
||||
- Copy the contents of the downloaded `tokenizer` folder to `discordbot/models/illustrious_xl/tokenizer/`
|
||||
- Copy the contents of the downloaded `tokenizer_2` folder to `discordbot/models/illustrious_xl/tokenizer_2/`
|
||||
|
||||
## Step 3: Create the Model Index File
|
||||
|
||||
Create a file named `model_index.json` in the `discordbot/models/illustrious_xl/` directory with the following content:
|
||||
|
||||
```json
|
||||
{
|
||||
"_class_name": "StableDiffusionXLPipeline",
|
||||
"_diffusers_version": "0.21.4",
|
||||
"force_zeros_for_empty_prompt": true,
|
||||
"scheduler": {
|
||||
"_class_name": "DPMSolverMultistepScheduler",
|
||||
"_diffusers_version": "0.21.4",
|
||||
"beta_end": 0.012,
|
||||
"beta_schedule": "scaled_linear",
|
||||
"beta_start": 0.00085,
|
||||
"num_train_timesteps": 1000,
|
||||
"prediction_type": "epsilon",
|
||||
"solver_order": 2,
|
||||
"solver_type": "midpoint",
|
||||
"thresholding": false,
|
||||
"timestep_spacing": "leading",
|
||||
"trained_betas": null,
|
||||
"use_karras_sigmas": true
|
||||
},
|
||||
"text_encoder": [
|
||||
{
|
||||
"_class_name": "CLIPTextModel",
|
||||
"_diffusers_version": "0.21.4"
|
||||
},
|
||||
{
|
||||
"_class_name": "CLIPTextModelWithProjection",
|
||||
"_diffusers_version": "0.21.4"
|
||||
}
|
||||
],
|
||||
"tokenizer": [
|
||||
{
|
||||
"_class_name": "CLIPTokenizer",
|
||||
"_diffusers_version": "0.21.4"
|
||||
},
|
||||
{
|
||||
"_class_name": "CLIPTokenizer",
|
||||
"_diffusers_version": "0.21.4"
|
||||
}
|
||||
],
|
||||
"unet": {
|
||||
"_class_name": "UNet2DConditionModel",
|
||||
"_diffusers_version": "0.21.4"
|
||||
},
|
||||
"vae": {
|
||||
"_class_name": "AutoencoderKL",
|
||||
"_diffusers_version": "0.21.4"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Step 4: Verify the Installation
|
||||
|
||||
1. Check that the directory structure is correct and all files are in place
|
||||
2. Make sure the `diffusion_pytorch_model.safetensors` file in the `unet` directory is large (should be several GB)
|
||||
3. Restart your Discord bot
|
||||
4. Use the `/generate` command to test if the model works correctly
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- If you get errors about missing files, make sure all the required components are downloaded and placed in the correct directories
|
||||
- If you get CUDA out-of-memory errors, try reducing the image dimensions (e.g., 768x768 instead of 1024x1024)
|
||||
- If the model is not showing up in the `/sd_models` command, make sure the directory structure and file names are exactly as specified above
|
@ -1,2 +0,0 @@
|
||||
Edit and save this file to trigger a reload of the bot commands.
|
||||
Last reload: 2025-04-12 17:55:10
|
@ -1,39 +0,0 @@
|
||||
aiohttp
|
||||
discord.py
|
||||
python-dotenv
|
||||
asyncpg
|
||||
redis>=4.2 # For redis.asyncio
|
||||
Flask
|
||||
Flask-Cors
|
||||
gunicorn
|
||||
openai
|
||||
tiktoken
|
||||
google-cloud-storage
|
||||
beautifulsoup4
|
||||
requests
|
||||
fastapi
|
||||
uvicorn[standard] # Use standard install for performance features like websockets if needed later
|
||||
python-multipart
|
||||
python-jose[cryptography] # For JWT handling in auth
|
||||
itsdangerous # For secure session cookies
|
||||
pydantic-settings # For loading config from .env
|
||||
tenacity
|
||||
cachetools
|
||||
pillow
|
||||
lxml
|
||||
PyNaCl
|
||||
discord-webhook
|
||||
openrouter
|
||||
google-cloud-vertexai==1.53.0
|
||||
protobuf==3.20.3
|
||||
proto-plus==1.23.0
|
||||
aiosqlite
|
||||
# Stable Diffusion dependencies
|
||||
torch
|
||||
diffusers
|
||||
transformers
|
||||
accelerate
|
||||
tqdm
|
||||
safetensors
|
||||
xformers
|
||||
huggingface_hub
|
@ -1,15 +0,0 @@
|
||||
@echo off
|
||||
echo Restarting API server...
|
||||
|
||||
REM Change to the discordbot directory
|
||||
cd /d %~dp0
|
||||
|
||||
REM Check for running API server processes
|
||||
echo Checking for running API server processes...
|
||||
tasklist /fi "imagename eq python.exe" /v | findstr "api_server"
|
||||
|
||||
REM Start the API server
|
||||
echo Starting API server...
|
||||
start python run_unified_api.py
|
||||
|
||||
echo API server restart complete.
|
@ -1,69 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Script to restart the API server with proper environment setup.
|
||||
This ensures the database connections are properly initialized.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
def main():
|
||||
"""Main function to restart the API server"""
|
||||
print("Restarting API server...")
|
||||
|
||||
# Get the current directory
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# Check if we're in the discordbot directory
|
||||
if os.path.basename(current_dir) != "discordbot":
|
||||
print("Error: This script must be run from the discordbot directory.")
|
||||
sys.exit(1)
|
||||
|
||||
# Find any running API server processes
|
||||
try:
|
||||
print("Checking for running API server processes...")
|
||||
result = subprocess.run(
|
||||
["ps", "-ef", "|", "grep", "api_server.py", "|", "grep", "-v", "grep"],
|
||||
shell=True,
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
|
||||
if result.stdout.strip():
|
||||
print("Found running API server processes:")
|
||||
print(result.stdout)
|
||||
|
||||
# Ask for confirmation before killing
|
||||
confirm = input("Do you want to kill these processes? (y/n): ")
|
||||
if confirm.lower() == 'y':
|
||||
# Kill the processes
|
||||
subprocess.run(
|
||||
["pkill", "-f", "api_server.py"],
|
||||
shell=True
|
||||
)
|
||||
print("Processes killed.")
|
||||
time.sleep(2) # Give processes time to terminate
|
||||
else:
|
||||
print("Aborted. Please stop the running API server processes manually.")
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(f"Error checking for running processes: {e}")
|
||||
|
||||
# Start the API server
|
||||
print("Starting API server...")
|
||||
try:
|
||||
# Use the run_unified_api.py script
|
||||
subprocess.Popen(
|
||||
[sys.executable, "run_unified_api.py"],
|
||||
cwd=current_dir
|
||||
)
|
||||
print("API server started successfully.")
|
||||
except Exception as e:
|
||||
print(f"Error starting API server: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
print("API server restart complete.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -1,84 +0,0 @@
|
||||
# Stable Diffusion Discord Bot Command
|
||||
|
||||
This feature adds a Stable Diffusion image generation command to your Discord bot, running locally on your GPU. It includes support for the Illustrious XL model from Civitai.
|
||||
|
||||
## Installation
|
||||
|
||||
1. Run the installation script to install the required dependencies:
|
||||
```
|
||||
python install_stable_diffusion.py
|
||||
```
|
||||
|
||||
2. Download the Illustrious XL model from Civitai:
|
||||
```
|
||||
python download_illustrious.py
|
||||
```
|
||||
|
||||
3. Make sure you have a compatible GPU with CUDA support. The command will work on CPU but will be extremely slow.
|
||||
|
||||
4. Restart your bot after installing the dependencies and downloading the model.
|
||||
|
||||
## Commands
|
||||
|
||||
### `/generate`
|
||||
Generate an image using Stable Diffusion running locally on your GPU.
|
||||
|
||||
**Parameters:**
|
||||
- `prompt` (required): The text prompt to generate an image from
|
||||
- `negative_prompt` (optional): Things to avoid in the generated image
|
||||
- `steps` (optional, default: 30): Number of inference steps (higher = better quality but slower)
|
||||
- `guidance_scale` (optional, default: 7.5): How closely to follow the prompt (higher = more faithful but less creative)
|
||||
- `width` (optional, default: 1024): Image width (must be a multiple of 8)
|
||||
- `height` (optional, default: 1024): Image height (must be a multiple of 8)
|
||||
- `seed` (optional): Random seed for reproducible results (leave empty for random)
|
||||
- `hidden` (optional, default: false): Whether to make the response visible only to you
|
||||
|
||||
### `/sd_models`
|
||||
List available Stable Diffusion models or change the current model (owner only).
|
||||
|
||||
**Parameters:**
|
||||
- `model` (optional): The model to switch to (leave empty to just list available models)
|
||||
|
||||
## Available Models
|
||||
|
||||
- **Illustrious XL** (Local) - A high-quality SDXL model from Civitai
|
||||
- Stable Diffusion 1.5 (`runwayml/stable-diffusion-v1-5`)
|
||||
- Stable Diffusion 2.1 (`stabilityai/stable-diffusion-2-1`)
|
||||
- Stable Diffusion XL (`stabilityai/stable-diffusion-xl-base-1.0`)
|
||||
|
||||
## About Illustrious XL
|
||||
|
||||
Illustrious XL is a high-quality SDXL model from Civitai that produces excellent results for a wide range of prompts. It's particularly good at:
|
||||
|
||||
- Detailed illustrations
|
||||
- Realistic images
|
||||
- Fantasy and sci-fi scenes
|
||||
- Character portraits
|
||||
- Landscapes and environments
|
||||
|
||||
The model is automatically downloaded and set up by the `download_illustrious.py` script. You can find more information about the model at [Civitai](https://civitai.com/models/795765/illustrious-xl).
|
||||
|
||||
## Requirements
|
||||
|
||||
- CUDA-compatible GPU with at least 8GB VRAM (12GB+ recommended for SDXL models at 1024x1024)
|
||||
- Python 3.8+
|
||||
- PyTorch with CUDA support
|
||||
- diffusers library
|
||||
- transformers library
|
||||
- accelerate library
|
||||
- safetensors library
|
||||
- xformers library (optional, for memory efficiency)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- If you encounter CUDA out-of-memory errors, try:
|
||||
- Reducing the image dimensions (e.g., 768x768 instead of 1024x1024)
|
||||
- Switching to a smaller model (SD 1.5 instead of SDXL)
|
||||
- Closing other applications that use GPU memory
|
||||
- Using the `--enable_attention_slicing` option when loading the model
|
||||
|
||||
- The first generation might take longer as the model needs to be downloaded and loaded into memory.
|
||||
|
||||
- If you're getting "CUDA not available" errors, make sure your GPU drivers are up to date and PyTorch is installed with CUDA support.
|
||||
|
||||
- If the Illustrious XL model fails to download, you can try downloading it manually from [Civitai](https://civitai.com/models/795765/illustrious-xl) and placing it in the `discordbot/models/illustrious_xl/unet` directory as `diffusion_pytorch_model.safetensors`.
|
Loading…
x
Reference in New Issue
Block a user