fix refresh models button: include custom API config in cache key to properly bust cache

This commit is contained in:
Russell Ballestrini 2025-07-11 01:08:57 -04:00
parent 02e614d733
commit cd218cc4a1

View file

@ -9,7 +9,18 @@ export const modelRegistry = {};
export async function fetchModelsFromEndpoints() {
const cacheKey = "modelRegistryCache";
const endpointsKey = "vllmEndpointsHash";
const endpointsString = JSON.stringify(VLLM_ENDPOINTS);
// Include custom API config in cache key to bust cache when it changes
const customAPIConfig = {
useCustomAPI: localStorage.getItem("useCustomAPI"),
customBaseURL: localStorage.getItem("customBaseURL"),
customAPIKey: localStorage.getItem("customAPIKey")
};
const endpointsString = JSON.stringify({
vllm: VLLM_ENDPOINTS,
custom: customAPIConfig
});
const cachedEndpoints = localStorage.getItem(endpointsKey);
const cacheItem = localStorage.getItem(cacheKey);
const now = Date.now();