fix model mismatch: validate selected model exists on custom API, fallback to default if not
This commit is contained in:
parent
fd4cf9684b
commit
f4f6ae6a9c
1 changed files with 21 additions and 1 deletions
|
|
@ -80,9 +80,29 @@ export async function getAPIConfig() {
|
|||
|
||||
if (customBaseURL && customAPIKey) {
|
||||
// Import model functions to get the currently selected model
|
||||
const { getSelectedModel } = await import("./models.js");
|
||||
const { getSelectedModel, modelRegistry } = await import("./models.js");
|
||||
const selectedModel = getSelectedModel();
|
||||
|
||||
// Check if the selected model is from the custom API endpoint
|
||||
const selectedModelEntry = Object.entries(modelRegistry).find(([uniqueId, data]) =>
|
||||
data.modelName === selectedModel && data.endpointId === customBaseURL
|
||||
);
|
||||
|
||||
if (!selectedModelEntry) {
|
||||
console.warn("⚠️ Selected model not available on custom API, falling back to default");
|
||||
// Return default configuration instead
|
||||
console.log("🏠 Using DEFAULT Hermes API (model mismatch)");
|
||||
return {
|
||||
isCustom: false,
|
||||
endpoints: VLLM_ENDPOINTS,
|
||||
model: MODEL,
|
||||
apiKey: API_KEY,
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
console.log("🔧 Using CUSTOM API:", {
|
||||
endpoint: customBaseURL,
|
||||
model: selectedModel,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue