Uses dynamic API base path for model fetch

Replaces the hardcoded API endpoint with a function that retrieves
the correct base path for server model requests. Improves compatibility
with deployments where the API is not served from the root path.
This commit is contained in:
shibamudi
2026-01-29 13:46:47 +08:00
committed by dayuan.jiang
parent feeb9ec0c5
commit 699767f392
+2 -1
View File
@@ -1,6 +1,7 @@
"use client"
import { useCallback, useEffect, useState } from "react"
import { getApiEndpoint } from "@/lib/base-path"
import type { FlattenedServerModel } from "@/lib/server-model-config"
import { STORAGE_KEYS } from "@/lib/storage"
import {
@@ -147,7 +148,7 @@ export function useModelConfig(): UseModelConfigReturn {
useEffect(() => {
if (typeof window === "undefined") return
fetch("/api/server-models")
fetch(getApiEndpoint("/api/server-models"))
.then((res) => {
if (!res.ok) {
console.error(