fix(providers): use /chat/completions for OpenAI test requests

This commit is contained in:
LTbinglingfeng
2026-01-28 00:17:31 +08:00
parent db5fb0d125
commit 8b3c4189f1
3 changed files with 6 additions and 3 deletions

View File

@@ -55,7 +55,10 @@ export const buildOpenAIChatCompletionsEndpoint = (baseUrl: string): string => {
if (trimmed.endsWith('/chat/completions')) {
return trimmed;
}
return trimmed.endsWith('/v1') ? `${trimmed}/chat/completions` : `${trimmed}/v1/chat/completions`;
if (trimmed.endsWith('/v1')) {
return `${trimmed.slice(0, -3)}/chat/completions`;
}
return `${trimmed}/chat/completions`;
};
// 根据 source (apiKey) 获取统计数据 - 与旧版逻辑一致