@kwirthmagnify/kwirth-common-ai 0.5.39 → 0.5.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/back.js +4 -3
- package/package.json +1 -1
package/dist/back.js
CHANGED
|
@@ -66,10 +66,11 @@ const buildModel = (llm, providers) => {
|
|
|
66
66
|
case 'openrouter': return (0, ai_sdk_provider_1.createOpenRouter)({ apiKey: key })(llm.model);
|
|
67
67
|
case 'anthropic': return (0, anthropic_1.createAnthropic)({ apiKey: key })(llm.model);
|
|
68
68
|
case 'openai-compat': {
|
|
69
|
-
//
|
|
70
|
-
// /chat/completions)
|
|
69
|
+
// baseURL debe terminar en /v1 (el SDK añade el path). Y usamos .chat() → Chat Completions API
|
|
70
|
+
// (/v1/chat/completions): los endpoints OpenAI-compatibles (Huawei MaaS, etc.) NO exponen la
|
|
71
|
+
// Responses API (/v1/responses) → si no, 404 APIG.0101.
|
|
71
72
|
const b = ((_c = prov === null || prov === void 0 ? void 0 : prov.endpoint) !== null && _c !== void 0 ? _c : '').replace(/\/+$/, '');
|
|
72
|
-
return (0, openai_1.createOpenAI)({ apiKey: key, baseURL: b.endsWith('/v1') ? b : `${b}/v1` })(llm.model);
|
|
73
|
+
return (0, openai_1.createOpenAI)({ apiKey: key, baseURL: b.endsWith('/v1') ? b : `${b}/v1` }).chat(llm.model);
|
|
73
74
|
}
|
|
74
75
|
default:
|
|
75
76
|
console.log('Invalid provider type', type);
|