fix model refresh: include custom endpoint in model fetching when checkbox is checked regardless of current model routing
This commit is contained in:
parent
8b0fe6d2ac
commit
04e7e71e2e
1 changed files with 13 additions and 8 deletions
|
|
@ -42,13 +42,15 @@ export async function fetchModelsFromEndpoints() {
|
|||
// Collect endpoints to fetch from
|
||||
const endpointsToFetch = [...VLLM_ENDPOINTS];
|
||||
|
||||
// Add custom API endpoint if configured
|
||||
const apiConfig = await getAPIConfig();
|
||||
if (apiConfig.isCustom) {
|
||||
console.log("🔧 Adding custom API endpoint to model fetch:", apiConfig.endpoint);
|
||||
// Add custom API endpoint if the checkbox is checked (regardless of current model routing)
|
||||
const useCustomAPI = localStorage.getItem("useCustomAPI") === "true";
|
||||
const customBaseURL = localStorage.getItem("customBaseURL");
|
||||
|
||||
if (useCustomAPI && customBaseURL) {
|
||||
console.log("🔧 Adding custom API endpoint to model fetch:", customBaseURL);
|
||||
endpointsToFetch.push({
|
||||
id: apiConfig.endpoint,
|
||||
url: apiConfig.endpoint
|
||||
id: customBaseURL,
|
||||
url: customBaseURL
|
||||
});
|
||||
} else {
|
||||
console.log("🏠 No custom API configured, using default endpoints only");
|
||||
|
|
@ -64,8 +66,11 @@ export async function fetchModelsFromEndpoints() {
|
|||
};
|
||||
|
||||
// Add authorization for custom API
|
||||
if (endpoint.id === apiConfig.endpoint && apiConfig.isCustom) {
|
||||
headers["Authorization"] = `Bearer ${apiConfig.apiKey}`;
|
||||
if (endpoint.id === customBaseURL && useCustomAPI) {
|
||||
const customAPIKey = localStorage.getItem("customAPIKey");
|
||||
if (customAPIKey) {
|
||||
headers["Authorization"] = `Bearer ${customAPIKey}`;
|
||||
}
|
||||
}
|
||||
|
||||
const res = await fetch(`${endpoint.url}/models`, { headers });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue