Some checks are pending
E2E / Playwright e2e (push) Waiting to run
- Added support for managing AI models within the AI assistant settings. - Introduced new hosted mail setup component for streamlined email configuration. - Updated environment variables for local development and proxy settings. - Enhanced error handling and user feedback in the chat page for API connectivity issues. - Improved routing for AI-related API calls in the Next.js configuration. - Added documentation for local development and agent management in CLAUDE.md.
24 lines
881 B
TypeScript
24 lines
881 B
TypeScript
/** Public path for OpenWebUI (default /ai). */
|
|
export function resolveAiEmbedBase(publicPath = "/ai"): string {
|
|
const path = (publicPath || "/ai").replace(/\/$/, "") || "/ai"
|
|
const normalized = path.startsWith("/") ? path : `/${path}`
|
|
const origin = process.env.NEXT_PUBLIC_AI_ORIGIN?.trim().replace(/\/$/, "")
|
|
return origin ? `${origin}${normalized}` : normalized
|
|
}
|
|
|
|
export function resolveAiEmbedOrigin(publicPath = "/ai"): string {
|
|
const base = resolveAiEmbedBase(publicPath)
|
|
if (base.startsWith("http://") || base.startsWith("https://")) {
|
|
return new URL(base).origin
|
|
}
|
|
if (typeof window !== "undefined") {
|
|
return window.location.origin
|
|
}
|
|
return ""
|
|
}
|
|
|
|
export function buildAiEmbedUrl(publicPath: string, searchParams: string): string {
|
|
const base = resolveAiEmbedBase(publicPath)
|
|
return searchParams ? `${base}/?${searchParams}` : `${base}/`
|
|
}
|