import configManager from './index.js';
import { ConfigModelProvider } from './types.js';

export const getConfiguredModelProviders = (): ConfigModelProvider[] => {
  return configManager.getConfig('modelProviders', []);
};

export const getConfiguredModelProviderById = (
  id: string,
): ConfigModelProvider | undefined => {
  return getConfiguredModelProviders().find((p) => p.id === id) ?? undefined;
};

export const getSearxngURL = () =>
  process.env.SEARXNG_URL?.trim() ?? configManager.getConfig('search.searxngURL', '');

export const isEnvOnlyMode = (): boolean => configManager.isEnvOnlyMode();
