akhaliq HF Staff commited on
Commit
a23307a
·
1 Parent(s): 254f500

update model list

Browse files
frontend/src/app/page.tsx CHANGED
@@ -36,6 +36,15 @@ export default function Home() {
36
  const [isResizingSettings, setIsResizingSettings] = useState(false);
37
  const [isDesktop, setIsDesktop] = useState(false);
38
 
 
 
 
 
 
 
 
 
 
39
  // Load messages from localStorage on mount (client-side only to avoid hydration issues)
40
  useEffect(() => {
41
  if (typeof window !== 'undefined') {
 
36
  const [isResizingSettings, setIsResizingSettings] = useState(false);
37
  const [isDesktop, setIsDesktop] = useState(false);
38
 
39
+ // Clear cache on app startup to ensure fresh data
40
+ useEffect(() => {
41
+ if (typeof window !== 'undefined') {
42
+ console.log('[Cache] Clearing models and languages cache on app startup');
43
+ localStorage.removeItem('anycoder_models');
44
+ localStorage.removeItem('anycoder_languages');
45
+ }
46
+ }, []); // Run once on mount
47
+
48
  // Load messages from localStorage on mount (client-side only to avoid hydration issues)
49
  useEffect(() => {
50
  if (typeof window !== 'undefined') {
frontend/src/lib/api.ts CHANGED
@@ -150,7 +150,7 @@ class ApiClient {
150
  }
151
 
152
  async getModels(): Promise<Model[]> {
153
- // Check cache first (24 hour TTL)
154
  const cached = this.getCachedData<Model[]>('anycoder_models', 24 * 60 * 60 * 1000);
155
  if (cached) {
156
  console.log('Using cached models:', cached.length, 'models');
@@ -165,7 +165,7 @@ class ApiClient {
165
  // Cache the successful response
166
  if (models && models.length > 0) {
167
  this.setCachedData('anycoder_models', models);
168
- console.log('Cached', models.length, 'models');
169
  }
170
 
171
  return models;
@@ -198,7 +198,7 @@ class ApiClient {
198
  }
199
 
200
  async getLanguages(): Promise<{ languages: Language[] }> {
201
- // Check cache first (24 hour TTL)
202
  const cached = this.getCachedData<Language[]>('anycoder_languages', 24 * 60 * 60 * 1000);
203
  if (cached) {
204
  console.log('Using cached languages:', cached.length, 'languages');
@@ -213,7 +213,7 @@ class ApiClient {
213
  // Cache the successful response
214
  if (languages && languages.length > 0) {
215
  this.setCachedData('anycoder_languages', languages);
216
- console.log('Cached', languages.length, 'languages');
217
  }
218
 
219
  return response.data;
 
150
  }
151
 
152
  async getModels(): Promise<Model[]> {
153
+ // Check cache first (24 hour TTL - cache once per day)
154
  const cached = this.getCachedData<Model[]>('anycoder_models', 24 * 60 * 60 * 1000);
155
  if (cached) {
156
  console.log('Using cached models:', cached.length, 'models');
 
165
  // Cache the successful response
166
  if (models && models.length > 0) {
167
  this.setCachedData('anycoder_models', models);
168
+ console.log('Cached', models.length, 'models (valid for 24 hours)');
169
  }
170
 
171
  return models;
 
198
  }
199
 
200
  async getLanguages(): Promise<{ languages: Language[] }> {
201
+ // Check cache first (24 hour TTL - cache once per day)
202
  const cached = this.getCachedData<Language[]>('anycoder_languages', 24 * 60 * 60 * 1000);
203
  if (cached) {
204
  console.log('Using cached languages:', cached.length, 'languages');
 
213
  // Cache the successful response
214
  if (languages && languages.length > 0) {
215
  this.setCachedData('anycoder_languages', languages);
216
+ console.log('Cached', languages.length, 'languages (valid for 24 hours)');
217
  }
218
 
219
  return response.data;