@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 CHANGED
@@ -2998,7 +2998,12 @@ async function resolveBtwModel({
2998
2998
  const fallbackAction = sameAsCurrent ? "no distinct current model is available" : `falling back to ${fallback}`;
2999
2999
  try {
3000
3000
  const auth = await modelRegistry.getApiKeyAndHeaders(configuredModel);
3001
- if (auth.ok && hasRequestAuth(auth)) return { model: configuredModel, auth };
3001
+ if (auth.ok && hasRequestAuth(auth)) {
3002
+ return {
3003
+ model: auth.baseUrl ? { ...configuredModel, baseUrl: auth.baseUrl } : configuredModel,
3004
+ auth
3005
+ };
3006
+ }
3002
3007
  const reason = auth.ok ? "has no request credentials" : auth.error;
3003
3008
  reportWarning(
3004
3009
  `pi-btw model ${settings.model} is unavailable (${reason}); ${fallbackAction}.`
@@ -3014,7 +3019,12 @@ async function resolveBtwModel({
3014
3019
  if (!currentModel) return void 0;
3015
3020
  try {
3016
3021
  const auth = await modelRegistry.getApiKeyAndHeaders(currentModel);
3017
- if (auth.ok && hasRequestAuth(auth)) return { model: currentModel, auth };
3022
+ if (auth.ok && hasRequestAuth(auth)) {
3023
+ return {
3024
+ model: auth.baseUrl ? { ...currentModel, baseUrl: auth.baseUrl } : currentModel,
3025
+ auth
3026
+ };
3027
+ }
3018
3028
  } catch {
3019
3029
  }
3020
3030
  return void 0;