2026-01-06 09:44:14 -05:00
|
|
|
// Import directly from file to avoid pulling in server-side dependencies via index.js
|
|
|
|
|
export {
|
2026-01-04 21:58:59 -05:00
|
|
|
PROVIDER_MODELS,
|
|
|
|
|
getProviderModels,
|
|
|
|
|
getDefaultModel,
|
|
|
|
|
isValidModel as isValidModelCore,
|
|
|
|
|
findModelName,
|
|
|
|
|
getModelTargetFormat,
|
2026-04-06 23:06:55 -04:00
|
|
|
getModelStrip,
|
2026-01-04 21:58:59 -05:00
|
|
|
PROVIDER_ID_TO_ALIAS,
|
2026-05-03 03:57:33 -04:00
|
|
|
getModelsByProviderId,
|
|
|
|
|
getModelUpstreamId,
|
|
|
|
|
getModelQuotaFamily
|
2026-01-06 09:44:14 -05:00
|
|
|
} from "open-sse/config/providerModels.js";
|
2026-01-04 21:58:59 -05:00
|
|
|
|
2026-02-02 07:45:12 -05:00
|
|
|
import { AI_PROVIDERS, isOpenAICompatibleProvider } from "./providers.js";
|
2026-01-06 09:44:14 -05:00
|
|
|
import { PROVIDER_MODELS as MODELS } from "open-sse/config/providerModels.js";
|
2026-01-04 21:58:59 -05:00
|
|
|
|
|
|
|
|
// Providers that accept any model (passthrough)
|
|
|
|
|
const PASSTHROUGH_PROVIDERS = new Set(
|
|
|
|
|
Object.entries(AI_PROVIDERS)
|
|
|
|
|
.filter(([, p]) => p.passthroughModels)
|
|
|
|
|
.map(([key]) => key)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Wrap isValidModel with passthrough providers
|
|
|
|
|
export function isValidModel(aliasOrId, modelId) {
|
2026-02-02 07:45:12 -05:00
|
|
|
if (isOpenAICompatibleProvider(aliasOrId)) return true;
|
2026-01-04 21:58:59 -05:00
|
|
|
if (PASSTHROUGH_PROVIDERS.has(aliasOrId)) return true;
|
|
|
|
|
const models = MODELS[aliasOrId];
|
|
|
|
|
if (!models) return false;
|
|
|
|
|
return models.some(m => m.id === modelId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Legacy AI_MODELS for backward compatibility
|
|
|
|
|
export const AI_MODELS = Object.entries(MODELS).flatMap(([alias, models]) =>
|
|
|
|
|
models.map(m => ({ provider: alias, model: m.id, name: m.name }))
|
|
|
|
|
);
|
refactor(app): DRY pass — split large files, extract shared utils
S1: delete page.new.js (1724L abandoned) + remove dead getAntigravityProjectId
S2: split large files by natural seams
- usage.js → usage/{github,google,claude,codex,kiro,minimax,misc,shared}.js
- media-providers page → components/{Embedding,Tts,Generic,Stt}ExampleCard.js
- EndpointPageClient → endpointConstants.js + endpointPing.js + components/
- tokenRefresh.js → tokenRefresh/{dedup,providers}.js
- ProviderLimits/index.js: 16 pure fn + 9 constants → utils.js
- oauth/providers.js: 7 pure helpers → providerHelpers.js
S3: shared utils
- getModelKind(m, fallback) → shared/constants/models.js (replaces 20× m.kind||m.type)
- getStatusVariant → shared/utils/connectionStatus.js (dedup ConnectionRow/ConnectionsCard)
- sseChunk → open-sse/utils/sse.js (dedup grok-web/perplexity-web)
- fetchWithTimeout → usage/shared.js (replace 4× AbortController pattern in google.js)
fix: enableObservability2 field name in requestDetailsRepo
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 08:31:09 -04:00
|
|
|
|
|
|
|
|
export const getModelKind = (m, fallback = null) => m?.kind || m?.type || fallback;
|
2026-06-15 07:18:04 -04:00
|
|
|
|
|
|
|
|
// Capacity metadata for UI badges — icon + label + color per capability.
|
|
|
|
|
export const CAPACITY_META = {
|
|
|
|
|
vision: { icon: "visibility", label: "Vision", desc: "Supports image input", color: "text-blue-500" },
|
|
|
|
|
// search: temporarily hidden (feature not wired yet)
|
|
|
|
|
reasoning: { icon: "neurology", label: "Reasoning", desc: "Supports reasoning / thinking", color: "text-amber-500" },
|
|
|
|
|
};
|