feat: support reverse-proxy URL subpaths (llama-swap, SwarmUI) (#1122)

This commit is contained in:
Will Miao
2026-09-24 08:04:00 +08:00
parent 755e1a5bca
commit 2f9bd3ee7d
42 changed files with 731 additions and 103 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
import { app } from "../../scripts/app.js";
import { lmUrl } from "./base_path.js";
// ============================================================================
// Setting IDs and Defaults
@@ -55,7 +56,7 @@ const loadWorkflowOptions = async () => {
return;
}
try {
const response = await fetch("/api/lm/example-workflows");
const response = await fetch(lmUrl("/api/lm/example-workflows"));
const data = await response.json();
if (data.success && data.workflows) {
workflowOptionsFull = data.workflows;
@@ -81,7 +82,7 @@ const loadTemplateWorkflow = async (templateName) => {
const workflow = workflowOptionsFull.find((w) => w.label === templateName);
if (workflow && workflow.value) {
const workflowResponse = await fetch(
`/api/lm/example-workflows/${encodeURIComponent(workflow.value)}`
lmUrl(`/api/lm/example-workflows/${encodeURIComponent(workflow.value)}`)
);
const workflowData = await workflowResponse.json();
if (workflowData.success && workflowData.workflow) {