fix: enable Requesty refresh models with credentials #10273
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The existing
flushRouterModelspattern doesn't work for Requesty because it doesn't pass API credentials. This caused the 'Refresh Models' button to return stale cached data instead of fresh models.Changes
Backend (
webviewMessageHandler.ts)refresh: trueflag support torequestRouterModelshandlerrefresh=truewith a provider filter, flushes cache WITH credentials before fetchingFrontend (
Requesty.tsx)requestRouterModelswithrefresh: trueinstead offlushRouterModelsrefetchRouterModelsprop since it's no longer neededWhy this is necessary
The
flushRouterModelsmessage (used by DeepInfra) callsflushModels({ provider }, true)without credentials. For Requesty, this meansgetRequestyModels(undefined, undefined)- which fails or returns empty data. The cache isn't cleared on failure, so subsequentrefetchRouterModels()returns stale cached data.This approach reuses existing infrastructure while ensuring the credential-aware cache flush works for providers like Requesty that require
apiKeyandbaseUrlfor API calls.Testing
Supersedes #10264
Important
Enable Requesty model refresh with credentials by adding a
refreshflag torequestRouterModelsand updating frontend usage.webviewMessageHandler.ts):refresh: trueflag support torequestRouterModelshandler.refresh=trueand provider filter is set.Requesty.tsx):requestRouterModelswithrefresh: trueinstead offlushRouterModels.refetchRouterModelsprop.This description was created by
for c19730e. You can customize this summary. It will automatically update as commits are pushed.