MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / addModel

Function addModel

ts/workflow-builder/src/utils/modelOperations.ts:16–27  ·  view source on GitHub ↗
(type: ModelType)

Source from the content-addressed store, hash-verified

14};
15
16/** Create a new declared (custom) model of the given type. Returns the new instance. */
17export function addModel(type: ModelType): Model {
18 const id = generateId();
19 const existing = Object.values(useEditorStore.getState().models).map((m) => m.label);
20 const instance: Model = {
21 id,
22 label: uniqueName(LABEL_PREFIX[type], existing),
23 type,
24 arguments: seedDefaultArguments(ModelRegistry.getByType(type)?.parameters ?? []),
25 };
26 useEditorStore.getState().setModels((models) => ({ ...models, [id]: instance }));
27 return instance;
28}
29
30/**

Callers 1

ModelsPanelFunction · 0.90

Calls 4

generateIdFunction · 0.90
uniqueNameFunction · 0.90
seedDefaultArgumentsFunction · 0.90
getByTypeMethod · 0.45

Tested by

no test coverage detected