@narumitw/pi-btw 0.58.0 → 0.58.1
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/index.ts +12 -2
- package/dist/index.ts.map +2 -2
- package/package.json +1 -1
- package/src/btw.ts +13 -2
package/package.json
CHANGED
package/src/btw.ts
CHANGED
|
@@ -146,7 +146,12 @@ export async function resolveBtwModel({
|
|
|
146
146
|
: `falling back to ${fallback}`;
|
|
147
147
|
try {
|
|
148
148
|
const auth = await modelRegistry.getApiKeyAndHeaders(configuredModel);
|
|
149
|
-
if (auth.ok && hasRequestAuth(auth))
|
|
149
|
+
if (auth.ok && hasRequestAuth(auth)) {
|
|
150
|
+
return {
|
|
151
|
+
model: auth.baseUrl ? { ...configuredModel, baseUrl: auth.baseUrl } : configuredModel,
|
|
152
|
+
auth,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
150
155
|
const reason = auth.ok ? "has no request credentials" : auth.error;
|
|
151
156
|
reportWarning(
|
|
152
157
|
`pi-btw model ${settings.model} is unavailable (${reason}); ${fallbackAction}.`,
|
|
@@ -163,7 +168,13 @@ export async function resolveBtwModel({
|
|
|
163
168
|
if (!currentModel) return undefined;
|
|
164
169
|
try {
|
|
165
170
|
const auth = await modelRegistry.getApiKeyAndHeaders(currentModel);
|
|
166
|
-
if (auth.ok && hasRequestAuth(auth))
|
|
171
|
+
if (auth.ok && hasRequestAuth(auth)) {
|
|
172
|
+
// Direct provider streams bypass Pi's request preparation, including OAuth routing.
|
|
173
|
+
return {
|
|
174
|
+
model: auth.baseUrl ? { ...currentModel, baseUrl: auth.baseUrl } : currentModel,
|
|
175
|
+
auth,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
167
178
|
} catch {
|
|
168
179
|
// The caller reports the final lack of an available model.
|
|
169
180
|
}
|