-
Notifications
You must be signed in to change notification settings - Fork 6k
fix(providers): enable inventory refresh for OpenRouter model picker #10641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
abb9ea0
03b97ae
37dd89e
36ae8ff
44fbeab
2784cb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -233,8 +233,11 @@ impl Provider for OpenRouterProvider { | |
| &self.name | ||
| } | ||
|
|
||
| /// Fetch supported models from OpenRouter API (only models with tool support) | ||
| async fn fetch_supported_models(&self) -> Result<Vec<String>, ProviderError> { | ||
| fn skip_canonical_filtering(&self) -> bool { | ||
| true | ||
| } | ||
|
Abhijay007 marked this conversation as resolved.
|
||
|
|
||
| async fn fetch_recommended_models(&self, toolshim: bool) -> Result<Vec<String>, ProviderError> { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because this moves the OpenRouter API catalogue fetch from Useful? React with 👍 / 👎. |
||
| let response = self | ||
| .api_client | ||
| .request("api/v1/models") | ||
|
|
@@ -273,10 +276,20 @@ impl Provider for OpenRouterProvider { | |
| .iter() | ||
| .filter_map(|model| { | ||
| let id = model.get("id").and_then(|v| v.as_str())?; | ||
| Some(id.to_string()) | ||
| if toolshim { | ||
| return Some(id.to_string()); | ||
| } | ||
| let supports_tools = model | ||
| .get("supported_parameters") | ||
| .and_then(|v| v.as_array()) | ||
| .is_some_and(|params| params.iter().any(|p| p.as_str() == Some("tools"))); | ||
| if supports_tools { | ||
| Some(id.to_string()) | ||
| } else { | ||
| None | ||
| } | ||
| }) | ||
| .collect(); | ||
|
|
||
| models.sort(); | ||
|
Abhijay007 marked this conversation as resolved.
|
||
| Ok(models) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.