fix: use generic type on resolveModelId to preserve Model<Api> through resolution
resolveModelId narrowed the return type to { id, provider } which lost
the full Model<Api> shape needed by pi.setModel(). Using a generic <T>
preserves the actual type from the registry's getAvailable() call.
This commit is contained in:
parent
5a5cbff64e
commit
f77ce13944
1 changed files with 3 additions and 3 deletions
|
|
@ -143,11 +143,11 @@ export async function selectAndApplyModel(
|
|||
* Resolve a model ID string to a model object from the available models list.
|
||||
* Handles formats: "provider/model", "bare-id", "org/model-name" (OpenRouter).
|
||||
*/
|
||||
function resolveModelId(
|
||||
function resolveModelId<T extends { id: string; provider: string }>(
|
||||
modelId: string,
|
||||
availableModels: Array<{ id: string; provider: string }>,
|
||||
availableModels: T[],
|
||||
currentProvider: string | undefined,
|
||||
): { id: string; provider: string } | undefined {
|
||||
): T | undefined {
|
||||
const slashIdx = modelId.indexOf("/");
|
||||
|
||||
if (slashIdx !== -1) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue