Skip to content

Commit 1d665b9

Browse files
Copilotdavidfowl
andcommitted
Use WithReference for chatapi, update proxy config, and add WithExplicitStart to YARP
Co-authored-by: davidfowl <[email protected]>
1 parent f046730 commit 1d665b9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

AIChat.AppHost/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
.WaitFor(cache);
4949

5050
var frontend = builder.AddViteApp("chatui-fe", "../chatui")
51-
.WithEnvironment("BACKEND_URL", chatapi.GetEndpoint("http"))
52-
.WithOtlpExporter()
51+
.WithReference(chatapi)
5352
.WithEnvironment("BROWSER", "none");
5453

5554
// We use YARP as the static file server and reverse proxy.
@@ -58,8 +57,9 @@
5857
.PublishWithStaticFiles(frontend)
5958
.WithConfiguration(c =>
6059
{
61-
c.AddRoute("/api/{**catch-all}", chatapi.GetEndpoint("http"));
62-
});
60+
c.AddRoute("/api/{**catch-all}", chatapi);
61+
})
62+
.WithExplicitStart();
6363

6464
builder.Build().Run();
6565

chatui/vite.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ export default defineConfig({
1111
port,
1212
proxy: {
1313
'/api': {
14-
target: process.env.BACKEND_URL,
14+
target: process.env.CHATAPI_HTTPS || process.env.CHATAPI_HTTP,
1515
changeOrigin: true,
1616
},
1717
'/api/chat/stream': {
18-
target: process.env.BACKEND_URL,
18+
target: process.env.CHATAPI_HTTPS || process.env.CHATAPI_HTTP,
1919
ws: true,
2020
changeOrigin: true,
2121
}

0 commit comments

Comments
 (0)