Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Nov 27, 2024
2 parents 9c6eaea + 0803346 commit 74e02db
Show file tree
Hide file tree
Showing 6 changed files with 1,360 additions and 4 deletions.
37 changes: 36 additions & 1 deletion MyApp/_pages/ai-server/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This request will generate a response from the `llama3:8b` model using the `syst

Alternatively, you can call the same endpoint asynchronously by using the `/api/QueueOpenAiChatCompletion` endpoint. This will queue the request for processing and return a URL to check the status of the request and download the response when it's ready.

### Async Queue Open AI Chat Completion
### Queued Open AI Chat Completion

::include ai-server/cs/queue-openai-chat-completion-1.cs.md::

Expand All @@ -40,6 +40,41 @@ Additional optional features on the request to enhance the usage of AI Server in

- **ReplyTo**: A URL to send a POST request to when the request is complete.


## Open AI Chat with ReplyTo Callback

The Queued API also accepts a **ReplyTo Web Callback** for a more reliable push-based App integration
where responses are posted back to a custom URL Endpoint:

```csharp
var correlationId = Guid.NewGuid().ToString("N");
var response = client.Post(new QueueOpenAiChatCompletion
{
//...
ReplyTo = $"https://example.org/api/OpenAiChatResponseCallback?CorrelationId=${correlationId}"
});
```

Your callback can add any additional metadata on the callback to assist your App in correlating the response with
the initiating request which just needs to contain the properties of the `OpenAiChatResponse` you're interested in
along with any metadata added to the callback URL, e.g:

```csharp
public class OpenAiChatResponseCallback : IPost, OpenAiChatResponse, IReturnVoid
{
public Guid CorrelationId { get; set; }
}

public object Post(OpenAiChatResponseCallback request)
{
// Handle OpenAiChatResponse callabck
}
```

Unless your callback API is restricted to only accept requests from your AI Server, you should include a
unique Id like a `Guid` in the callback URL that can be validated against an initiating request to ensure
the callback can't be spoofed.

## Using the AI Server Request DTOs with other OpenAI compatible APIs

One advantage of using AI Server is that it provides a common set of request DTOs in 11 different languages that are compatible with OpenAI's API. This allows you to switch between OpenAI and AI Server without changing your client code.
Expand Down
10 changes: 8 additions & 2 deletions MyApp/_pages/ai-server/comfy-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,11 @@ The AI Server has pre-defined workflows to interact with your ComfyUI Agent inst

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.

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`.
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`.
You can override these workflows by creating a new JSON file with the same name and path but in the `App_Data/overrides` folder.

E.g. to override the `text_to_image` workflow, you would create a file at `App_Data/overrides/text_to_image.json`

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`.
1 change: 1 addition & 0 deletions MyApp/_pages/release-notes-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ slug: release-notes-history

## 2024

- [v8.5](/releases/v8_05)
- [v8.4](/releases/v8_04)
- [v8.3](/releases/v8_03)
- [v8.2](/releases/v8_02)
Expand Down
Loading

0 comments on commit 74e02db

Please sign in to comment.