fix model endpoint routing: properly route custom endpoint models to custom API with correct credentials
This commit is contained in:
parent
047d1e7856
commit
f939d1c782
1 changed files with 19 additions and 4 deletions
|
|
@ -83,13 +83,28 @@ export async function getAPIConfig() {
|
|||
const { getSelectedModel } = await import("./models.js");
|
||||
const selectedModel = getSelectedModel();
|
||||
|
||||
// Check if the selected model has a registered endpoint - use that instead of custom
|
||||
// Check if the selected model has a registered endpoint
|
||||
const { getSelectedModelEndpoint } = await import("./models.js");
|
||||
const modelEndpoint = getSelectedModelEndpoint();
|
||||
|
||||
// If model has its own endpoint, use that regardless of custom setting
|
||||
if (modelEndpoint && modelEndpoint !== customBaseURL) {
|
||||
console.log("🚀 Model has registered endpoint - using:", modelEndpoint);
|
||||
// If model endpoint matches custom endpoint, use custom API credentials
|
||||
if (modelEndpoint === customBaseURL) {
|
||||
console.log("🔧 Model endpoint matches custom API - using custom credentials");
|
||||
return {
|
||||
isCustom: true,
|
||||
endpoint: customBaseURL,
|
||||
apiKey: customAPIKey,
|
||||
model: selectedModel,
|
||||
headers: {
|
||||
"Authorization": `Bearer ${customAPIKey}`,
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// If model has built-in endpoint (like Hermes), use that with built-in credentials
|
||||
if (modelEndpoint && VLLM_ENDPOINTS.some(ep => ep.url === modelEndpoint)) {
|
||||
console.log("🚀 Model has built-in endpoint - using:", modelEndpoint);
|
||||
return {
|
||||
isCustom: false,
|
||||
endpoint: modelEndpoint,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue