2026-03-16 22:47:56 -07:00
|
|
|
import { findCatalogTemplate } from "openclaw/plugin-sdk/provider-catalog";
|
|
|
|
|
import { cloneFirstTemplateModel } from "openclaw/plugin-sdk/provider-models";
|
2026-03-15 17:50:16 -07:00
|
|
|
|
|
|
|
|
export const OPENAI_API_BASE_URL = "https://api.openai.com/v1";
|
|
|
|
|
|
2026-03-15 20:58:59 -07:00
|
|
|
export function matchesExactOrPrefix(id: string, values: readonly string[]): boolean {
|
|
|
|
|
const normalizedId = id.trim().toLowerCase();
|
|
|
|
|
return values.some((value) => {
|
|
|
|
|
const normalizedValue = value.trim().toLowerCase();
|
|
|
|
|
return normalizedId === normalizedValue || normalizedId.startsWith(normalizedValue);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-15 17:50:16 -07:00
|
|
|
export function isOpenAIApiBaseUrl(baseUrl?: string): boolean {
|
|
|
|
|
const trimmed = baseUrl?.trim();
|
|
|
|
|
if (!trimmed) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return /^https?:\/\/api\.openai\.com(?:\/v1)?\/?$/i.test(trimmed);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-17 04:20:13 +00:00
|
|
|
export { cloneFirstTemplateModel };
|
|
|
|
|
export { findCatalogTemplate };
|