I try to connect openwebui to aspire through docker container using this code like in microsoft docomentation
var openwebui = builder.AddContainer("openwebui", "ghcr.io/open-webui/open-webui", "latest")
.WithHttpEndpoint(3000, 3000, name: "openwebui");
var opnweb = openwebui.GetEndpoint("openwebui");
builder.AddProject<Projects.BlazorApp>("frontend")
.WithReference(opnweb);
In blazor app try to send request to openwebui
@page "/counter"
@rendermode InteractiveServer
@inject IHttpClientFactory HttpClientFactory
<PageTitle>Counter</PageTitle>
<h1>Counter</h1>
<p role="status">Current count: @models</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private string models = "";
private async Task IncrementCount()
{
using var http = HttpClientFactory.CreateClient();
var response = await http.GetAsync("http://openwebui:3000/api/models");
models = await response.Content.ReadAsStringAsync();
}
}
How to connect apps throgh docker container and use it in my application