MCPcopy Create free account
hub / github.com/Dimillian/CodexMonitor / findModelByIdOrModel

Function findModelByIdOrModel

src/features/models/hooks/useModels.ts:19–31  ·  view source on GitHub ↗
(
  models: ModelOption[],
  idOrModel: string | null,
)

Source from the content-addressed store, hash-verified

17const CONFIG_MODEL_DESCRIPTION = "Configured in CODEX_HOME/config.toml";
18
19const findModelByIdOrModel = (
20 models: ModelOption[],
21 idOrModel: string | null,
22): ModelOption | null => {
23 if (!idOrModel) {
24 return null;
25 }
26 return (
27 models.find((model) => model.id === idOrModel) ??
28 models.find((model) => model.model === idOrModel) ??
29 null
30 );
31};
32
33const pickDefaultModel = (models: ModelOption[], configModel: string | null) =>
34 findModelByIdOrModel(models, configModel) ??

Callers 2

pickDefaultModelFunction · 0.85
useModelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected