Skip to content

Commit d65a526

Browse files
committed
WIP improving ai-server docs
1 parent 2f2b723 commit d65a526

File tree

2 files changed

+62
-65
lines changed

2 files changed

+62
-65
lines changed

MyApp/_pages/ai-server/comfy-extension.md

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,31 @@ Since a lot of AI workloads require GPUs or other specialized hardware, the Comf
1313

1414
## Installing the ComfyUI Agent
1515

16-
To install this more easily, [we have put together a Docker image and a Docker Compose file](https://github.com/serviceStack/agent-comfy) that you can use to get started with ComfyUI Agent in AI Server that is already bundled with the pretty simple extension, and all the necessary dependencies.
16+
To install this more easily, you can use the `install.sh` script in the ComfyUI Agent repository. This works the same way as the AI Server installer, and will prompt you for the necessary configuration options.
1717

18-
### Running the ComfyUI Agent
18+
This installer supports both local and remote installations, and will ask you for the necessary configuration options including the Auth Secret for your AI Server instance. The install process will then register the ComfyUI Agent with your AI Server instance, enabling it for the model selections you make during the installation.
1919

20-
To run the ComfyUI Agent, you can use the following steps:
20+
```sh
21+
git clone https://github.com/ServiceStack/agent-comfy.git
22+
cd agent-comfy
23+
cat install.sh | bash
24+
```
2125

22-
1. **Clone the Repository**: Clone the ComfyUI Agent repository from GitHub.
26+
This process will also persist the configuration in the `.env` file in the ComfyUI Agent directory, so you can easily restart the ComfyUI Agent with the same configuration.
2327

24-
```sh
25-
git clone https://github.com/ServiceStack/agent-comfy.git
26-
```
27-
28-
2. **Edit the example.env File**: Update the example.env file with your desired settings.
29-
30-
```sh
31-
cp example.env .env
32-
```
33-
34-
And then edit the `.env` file with your desired settings:
35-
36-
```sh
37-
DEFAULT_MODELS=sdxl-lightning,flux-schnell
38-
API_KEY=your_agent_api_key
39-
HF_TOKEN=your_hf_token
40-
CIVITAI_TOKEN=your_civitai_api_key
41-
```
42-
43-
3. **Run the Docker Compose**: Start the ComfyUI Agent with Docker Compose.
28+
:::info
29+
On the first run, the ComfyUI Agent will download the models you selected during the installation process. This can take some time depending on the size of the models and your internet connection speed.
30+
:::
4431

45-
```sh
46-
docker compose up
47-
```
48-
4932
### .env Configuration
5033

5134
The `.env` file is used to configure the ComfyUI Agent during the initial setup, and is the easiest way to get started.
5235

53-
The keys available in the `.env` file are:
54-
55-
- **DEFAULT_MODELS**: Comma-separated list of models to load on startup. This will be used to automatically download the models and their related dependencies. The full list of options can be found on your AI Server at `/lib/data/media-models.json`.
56-
- **API_KEY**: This is the API key that will be used by your AI Server to authenticate with the ComfyUI. If not provided, there will be no authentication required to access your ComfyUI Agent instance.
57-
- **HF_TOKEN**: This is the Hugging Face token that will be used to authenticate with the Hugging Face API when trying to download models. If not provided, models requiring Hugging Face authentication like those with user agreements will not be downloaded.
58-
- **CIVITAI_TOKEN**: This is the Civitai API key that will be used to authenticate with the Civitai API when trying to download models. If not provided, models requiring Civitai authentication like those with user agreements will not be downloaded.
36+
```sh
37+
DEFAULT_MODELS=sdxl-lightning,text-to-speech,speech-to-text,image-upscale-2x,image-to-text
38+
HF_TOKEN=your_huggingface_token
39+
AGENT_PASSWORD=password-to-restrict-access-to-agent
40+
```
5941

6042
::: info
6143
Models requiring authentication to download are also flagged in the `/lib/data/media-models.json` file.
@@ -66,8 +48,9 @@ Models requiring authentication to download are also flagged in the `/lib/data/m
6648
Once the ComfyUI Agent is running, you can access the ComfyUI Agent instance at [http://localhost:7860](http://localhost:7860) and can be used as a standard ComfyUI.
6749
The AI Server has pre-defined workflows to interact with your ComfyUI Agent instance to generate images, audio, text, and more.
6850

69-
These workflows are found in the AI Server AppHost project under `workflows`. These are templated JSON versions of workflows you save in the ComfyUI web interface.
51+
### Overriding Workflows
7052

71-
### Advanced Configuration
53+
These workflows are found in the AI Server AppHost project under `workflows`. These are templated JSON versions of workflows you save in the ComfyUI web interface.
7254

73-
ComfyUI workflows can be changed or overridden on a per model basis by editing the `workflows` folder in the AI Server AppHost project. Flux Schnell is an example of overriding text-to-image for just a single workflow for which the code can be found in `AiServer/Configure.AppHost.cs`.
55+
You can override these workflows by creating a new JSON file with the same name and path but in the `App_Data/overrides` folder. For example, to override the `text_to_image` workflow, you would create a file at `App_Data/overrides/text_to_image.json`.
56+
This would override all calls that use text-to-image workflow sent to your ComfyUI Agent instance. You can also override just `flux-schnell` by creating a file at `App_Data/overrides/flux1/text_to_image.json`, and Stable Diffusion 3.5 at `App_Data/overrides/sd35/text_to_image.json`.

MyApp/_pages/ai-server/configuration.md

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,48 @@
22
title: Configuring AI Server
33
---
44

5-
AI Server makes orchestration of various AI providers easy by providing a unified gateway to process LLM, AI, and image transformation requests.
6-
It comes with an Admin Portal that allows you to configure your AI providers and generate API keys to control access.
5+
AI Server can be configured in several ways:
76

8-
## Accessing the Admin Portal
7+
- **install.sh Script**: Run the `install.sh` script to set up the AI Server and ComfyUI Agent.
8+
- **.env File**: Update the `.env` file with your API keys and run the AI Server for the first time.
9+
- **Admin Portal**: Use the Admin Portal to add, edit, or remove AI Providers and generate AI Server API keys.
910

10-
Running AI Server will land you on a page showing access to:
11+
## Running the Installer
1112

12-
- **[Admin Portal](http://localhost:5005/admin)**: Centralized management of AI providers and API keys.
13-
- **[Admin UI](http://localhost:5005/admin-ui)**: ServiceStack built in Admin UI to manage your AI Server.
14-
- **[API Explorer](http://localhost:5005/ui)**: Explore and test the AI Server API endpoints in a friendly UI.
15-
- **[AI Server Documentation](https://docs.servicestack.net/ai-server/)**: Detailed documentation on how to use AI Server.
13+
The `install.sh` script is the quickest way to get AI Server up and running with the default configuration. This is ideal for local development and testing.
1614

17-
:::info
18-
The default credentials to access the Admin Portal are `p@55wOrd`, this can be changed in your `.env` file by setting the `AUTH_SECRET` key.
19-
:::
20-
21-
## Configuring AI Providers
15+
To run the installer:
2216

23-
AI Providers are the external LLM based services like OpenAI, Google, Mistral etc that AI Server interacts with to process Chat requests.
17+
```sh
18+
git clone https://github.com/ServiceStack/ai-server.git
19+
cd ai-server
20+
cat install.sh | bash
21+
```
2422

25-
There are two ways to configure AI Providers:
23+
The installer will prompt you to configure your AI Providers and optionally add the ComfyUI Agent.
2624

27-
1. **.env File**: Update the `.env` file with your API keys and run the AI Server for the first time.
28-
2. **Admin Portal**: Use the Admin Portal to add, edit, or remove AI Providers and generate AI Server API keys.
25+
## `.env` Configuration
2926

30-
The provided `install.sh` script will prompt you to configure your AI Providers during the initial setup and populate the same .env file.
27+
The installer populates the `.env` file with the choices you made during the installation script. You can also manually configure the `.env` file with your API keys and settings.
3128

32-
### Using the .env File
29+
```sh
30+
OPENAI_API_KEY=your_openai_api_key
31+
ANTHROPIC_API_KEY=your_anthropic_api_key
32+
AUTH_SECRET=p@55wOrd
33+
ASSETS_BASE_URL=http://localhost:5006
34+
```
3335

34-
The `.env` file is used to configure AI Providers during the initial setup of AI Server, and is the easiest way to get started.
36+
After these values are set in your `.env` file, you can run the AI Server for the first time via docker compose:
3537

36-
The .env file is located in the root of the AI Server repository and contains the following keys:
38+
```sh
39+
docker compose up
40+
```
3741

38-
- **OPENAI_API_KEY**: OpenAI API Key
39-
- **ANTHROPIC_API_KEY**: Anthropic API Key
40-
- **GOOGLE_API_KEY**: Google Cloud API Key
41-
- **OPENROUTER_API_KEY**: OpenRouter API Key
42-
- **MISTRAL_API_KEY**: Mistral API Key
43-
- **GROQ_API_KEY**: GROQ API Key
42+
This will perform an initial setup, saving providers configuration in the SQLite database. From here, you can manage your AI Providers via the [Admin Portal](http://localhost:5006/admin).
4443

45-
Providing the API keys in the .env file will automatically configure the AI Providers when you run the AI Server for the first time.
44+
:::info
45+
The default credentials to access the Admin Portal are `p@55wOrd`, this can be changed in your `.env` file by setting the `AUTH_SECRET` key.
46+
:::
4647

4748
### Using the Admin Portal
4849

@@ -66,6 +67,19 @@ AI Server supports the following AI Providers:
6667
- **GROQ**: GROQ API
6768
- **Ollama**: Ollama API
6869

70+
Media Providers can also be configured in the Admin Portal. These include:
71+
72+
- **ComfyUI**: ComfyUI Agent
73+
- **Image Generation**
74+
- **Text-to-Speech**
75+
- **Speech-to-Text**
76+
- **Video & Image Processing**
77+
- **Replicate**: Replicate API
78+
- **Image Generation**
79+
- **OpenAI**: OpenAI API
80+
- **Image Generation**
81+
- **Text-to-Speech**
82+
6983
## Generating AI Server API Keys
7084

7185
API keys are used to authenticate requests to AI Server and are generated via the Admin Portal.

0 commit comments

Comments
 (0)