fix: read managed models from provider pools for model lists
This commit is contained in:
parent
465bbaef2b
commit
110720982f
1 changed files with 15 additions and 1 deletions
|
|
@ -100,6 +100,17 @@ function getConfiguredSupportedModels(providerType, providerConfig = {}) {
|
||||||
)].sort((a, b) => a.localeCompare(b));
|
)].sort((a, b) => a.localeCompare(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getConfiguredSupportedModelsFromPool(providerPoolManager, providerType) {
|
||||||
|
if (!providerPoolManager?.providerStatus?.[providerType]) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [...new Set(
|
||||||
|
providerPoolManager.providerStatus[providerType]
|
||||||
|
.flatMap(providerStatus => getConfiguredSupportedModels(providerType, providerStatus.config))
|
||||||
|
)].sort((a, b) => a.localeCompare(b));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the protocol prefix from a given model provider string.
|
* Extracts the protocol prefix from a given model provider string.
|
||||||
* This is used to determine if two providers belong to the same underlying protocol (e.g., gemini, openai, claude).
|
* This is used to determine if two providers belong to the same underlying protocol (e.g., gemini, openai, claude).
|
||||||
|
|
@ -882,7 +893,10 @@ export async function handleModelListRequest(req, res, service, endpointType, CO
|
||||||
} else {
|
} else {
|
||||||
// --- 单提供商逻辑 ---
|
// --- 单提供商逻辑 ---
|
||||||
const toProvider = CONFIG.MODEL_PROVIDER;
|
const toProvider = CONFIG.MODEL_PROVIDER;
|
||||||
const configuredSupportedModels = getConfiguredSupportedModels(toProvider, CONFIG);
|
const pooledSupportedModels = getConfiguredSupportedModelsFromPool(providerPoolManager, toProvider);
|
||||||
|
const configuredSupportedModels = pooledSupportedModels.length > 0
|
||||||
|
? pooledSupportedModels
|
||||||
|
: getConfiguredSupportedModels(toProvider, CONFIG);
|
||||||
|
|
||||||
if (usesManagedModelList(toProvider) && configuredSupportedModels.length > 0) {
|
if (usesManagedModelList(toProvider) && configuredSupportedModels.length > 0) {
|
||||||
logger.info(`[ModelList] Returning configured supported models for ${toProvider}: ${configuredSupportedModels.join(', ')}`);
|
logger.info(`[ModelList] Returning configured supported models for ${toProvider}: ${configuredSupportedModels.join(', ')}`);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue