fix: parse combo models correctly when returned as objects#11
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the resolveUnderlyingModels function to correctly extract model identifiers from the models array, which may now contain objects. Feedback was provided regarding potential runtime errors if the array contains null values or objects without the expected properties, recommending a safer mapping implementation and an update to the OmniRouteCombo interface for better type safety.
- Replace unsafe 'any' with runtime type narrowing - Handle null/undefined entries in the models array - Filter out unresolvable entries instead of propagating undefined - Keeps backward compatibility with string arrays
|
Thanks @herjarsa for opening this PR and catching the API change so quickly! The crash from I really appreciate you taking the time to debug this and confirm it resolves the problem with standard combos like I've pushed two small atomic commits on top of your branch to harden the implementation before we merge:
The logic is still fully backward-compatible with string arrays, and the build passes cleanly. |
The OmniRoute API /api/combos recent update returns an array of objects for underlying models instead of an array of strings. This caused opencode-omniroute-auth to crash when calling modelId.trim() in splitModelId. This PR adds a map to properly extract the model or id property if it is returned as an object. Confirmed to resolve the issue with standard combos like Combo-FIX recovering access to the full model index.