Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

703 B
Raw Blame
/** A hidden saved selection needs an explicit replacement; never silently reroute it. */
export function modelNeedsReselection(
  visibility: Readonly<Record<string, boolean>> | null | undefined,
  agent: string,
  model: string,
  providerId: string | null | undefined,
): boolean {
  if (!visibility || !model) return false;
  if (providerId) return visibility[`${agent}:${providerId}:${model}`] === false;
  // A default-source selection is usable while at least one source still exposes it.
  const offerings = Object.entries(visibility).filter(([key]) =>
    key.startsWith(`${agent}:`) && key.endsWith(`:${model}`));
  return offerings.length > 0 && offerings.every(([, visible]) => !visible);
}