mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET: DevUI: Use relative URLs for backend API by default (#2005)
* DevUI: Use relative URLs for backend API by default * dotnet format * rebuild application
This commit is contained in:
committed by
GitHub
Unverified
parent
00b67e191b
commit
3d94ae57ed
File diff suppressed because one or more lines are too long
@@ -27,7 +27,7 @@ export function SettingsModal({ open, onOpenChange, onBackendUrlChange }: Settin
|
||||
const [activeTab, setActiveTab] = useState<Tab>("settings");
|
||||
|
||||
// Get current backend URL from localStorage or default
|
||||
const defaultUrl = import.meta.env.VITE_API_BASE_URL || "http://localhost:8080";
|
||||
const defaultUrl = import.meta.env.VITE_API_BASE_URL !== undefined ? import.meta.env.VITE_API_BASE_URL : "";
|
||||
const [backendUrl, setBackendUrl] = useState(() => {
|
||||
return localStorage.getItem("devui_backend_url") || defaultUrl;
|
||||
});
|
||||
|
||||
@@ -61,7 +61,7 @@ interface ConversationApiResponse {
|
||||
const DEFAULT_API_BASE_URL =
|
||||
import.meta.env.VITE_API_BASE_URL !== undefined
|
||||
? import.meta.env.VITE_API_BASE_URL
|
||||
: "http://localhost:8080";
|
||||
: ""; // Default to relative URLs (same host as frontend)
|
||||
|
||||
// Retry configuration for streaming
|
||||
const RETRY_INTERVAL_MS = 1000; // Retry every second
|
||||
@@ -72,12 +72,6 @@ function getBackendUrl(): string {
|
||||
const stored = localStorage.getItem("devui_backend_url");
|
||||
if (stored) return stored;
|
||||
|
||||
// If VITE_API_BASE_URL is explicitly set to empty string, use relative path
|
||||
// This allows the frontend to call the same host it's served from
|
||||
if (import.meta.env.VITE_API_BASE_URL === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return DEFAULT_API_BASE_URL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user