A discord bot for generating art with artificial intelligence
/dream prompt: 1girl, solo, blonde hair, twintails, blue eyes, blue dress
Here are some examples of possible images generated using the bot:
- Slash commands and rich embeds
- Immediate previews for completed images
- Navigation buttons for mobile devices
- Buttons for generating more images, modifying prompts from previous generations and enhancing images
- Allows user to change most parameters available in WebUI
- Negative prompt
- Model
- Sampler
- Number of steps
- Classifier-free guidance scale
- Seed
- Width and height
- Variation seed and strength
- Highres-fix scale and method
- Support for img2img
{prompt1 | prompt2 | prompt3}
syntax allows to change parts of the prompt for each image in a batch- Upscaling with
/upscale
command - Retrieves image generation parameters from generated images with
/metadata
command - Can guess which tags best describe an image through the
/interrogate
command
Soph works by communicating with Stable Diffusion WebUI API to generate images using artificial intelligence. This can be achieved by running WebUI locally on the same machine, on the same network or over the internet.
Soph prioritizes UX and being a first-class Discord citizen, and as such uses slash commands and rich embeds with proper multiple image support rather than baking all results into a single image grid, sending each result as a separate image attachment or only displaying one image at a time.
Individual images are sent as soon as they're ready rather than only sending the entire batch at once or showing multiple unfinished images at the same time, that way we can ensure the user gets useful and immediate feedback of their generation request.
/dream <prompt>
- Also accepts the following optional arguments:
<negative> <batch> <sampler> <steps> <width> <height> <cfg> <highres-fix> <hr-scale> <image> <denoising> <scale-latent>
- Also accepts the following optional arguments:
/metadata <image>
/interrogate <image> <model>
/upscale <image>
- Also accepts the following optional arguments:
<model> <resize> <secondary-model> <mix>
- Also accepts the following optional arguments:
/help
/ping
-
Install https://github.com/AUTOMATIC1111/stable-diffusion-webui and its dependencies
- You can also use https://github.com/lllyasviel/stable-diffusion-webui-forge/ instead
-
Add
--api
to WebUI's commandline arguments -
Install NodeJS
-
Run
git clone https://github.com/TiagoMarinho/Soph
to clone Soph's repo -
Create a new Discord application in the Discord Developer Portal
-
Copy the token and client id of your new discord application and put it in a new file inside Soph's root folder,
Soph/config.json
, like this:{ "token": "TOKEN HERE", "clientId": "CLIENT ID HERE", "cacheChannelId": "SEE NEXT STEP" }
-
Add a channel ID in the above
config.json
file for a chat your application has access to, so that it can use as a cache for the images. Every image generated with the bot will be sent in this chat first. -
Install dependencies by running
npm install
inside Soph's root folder -
Run
npm run deploy
inside Soph's root folder to register slash commands for the bot.
- Launch WebUI and wait for it to finish loading
- Run
node .
inside Soph's root folder to launch Soph
Contributions, even in the form of creating new issues, are more than welcome!
Here's a basic overview of the project structure for new contributors to get used to the code base:
src/main.js
is the entry point- Commands are folders in
src/commands/<category>/
src/commands/<category>/<command name>/main.js
contains the code that runs when the user executes said commandsrc/shared/generate.js
is where the relevant generation functions are called from, and where the response is built
Unabled to run Stable Diffusion but still want to contribute? You can install EdoanR's "a1111-fake-webui-api" to mimic the Stable Diffusion WebUI API to develop Soph without having to actually run the AI.