MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / selectRequestedComposerModel

Function selectRequestedComposerModel

desktop/runtime/composer-service.ts:76–96  ·  view source on GitHub ↗
(runtime: PiRuntime, request: ComposerStateRequest)

Source from the content-addressed store, hash-verified

74}
75
76async function selectRequestedComposerModel(runtime: PiRuntime, request: ComposerStateRequest) {
77 const selection = request.composerModelSelection ?? null
78 if (selection?.provider) {
79 const model = runtime.session.modelRegistry.find(selection.provider, selection.id)
80 if (model) return model
81 const [fallbackModel] = await runtime.session.modelRegistry.getAvailable()
82 return fallbackModel ?? runtime.session.model
83 }
84 if (!request.composerUseDefaultModel) return runtime.session.model
85 const defaultComposer = await buildComposerStateSnapshot({
86 projectId: runtime.cwd,
87 composerSessionDir: request.composerSessionDir,
88 })
89 if (!defaultComposer.currentModel) return runtime.session.model
90 return (
91 runtime.session.modelRegistry.find(
92 defaultComposer.currentModel.provider,
93 defaultComposer.currentModel.id,
94 ) ?? runtime.session.model
95 )
96}
97
98async function getRequestedComposerThinkingLevel(
99 runtime: PiRuntime,

Callers 1

Calls 1

Tested by

no test coverage detected