codacus commited on
Commit
7ba7345
·
1 Parent(s): e0c5c51

some more logs cleanup

Browse files
Files changed (1) hide show
  1. app/utils/constants.ts +8 -5
app/utils/constants.ts CHANGED
@@ -1,6 +1,7 @@
1
  import Cookies from 'js-cookie';
2
  import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
3
  import type { ProviderInfo } from '~/types/model';
 
4
 
5
  export const WORK_DIR_NAME = 'project';
6
  export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
@@ -10,6 +11,8 @@ export const PROVIDER_REGEX = /\[Provider: (.*?)\]\n\n/;
10
  export const DEFAULT_MODEL = 'claude-3-5-sonnet-latest';
11
  export const PROMPT_COOKIE_KEY = 'cachedPrompt';
12
 
 
 
13
  const PROVIDER_LIST: ProviderInfo[] = [
14
  {
15
  name: 'Anthropic',
@@ -383,8 +386,8 @@ async function getOllamaModels(): Promise<ModelInfo[]> {
383
  provider: 'Ollama',
384
  maxTokenAllowed: 8000,
385
  }));
386
- } catch (e) {
387
- console.warn('Failed to get Ollama models:', e);
388
  return [];
389
  }
390
  }
@@ -471,8 +474,8 @@ async function getLMStudioModels(): Promise<ModelInfo[]> {
471
  label: model.id,
472
  provider: 'LMStudio',
473
  }));
474
- } catch (e) {
475
- console.warn('Failed to get LMStudio models:', e);
476
  return [];
477
  }
478
  }
@@ -491,7 +494,7 @@ async function initializeModelList(): Promise<ModelInfo[]> {
491
  }
492
  }
493
  } catch (error: any) {
494
- console.warn(`Failed to fetch apikeys from cookies:${error?.message}`);
495
  }
496
  MODEL_LIST = [
497
  ...(
 
1
  import Cookies from 'js-cookie';
2
  import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
3
  import type { ProviderInfo } from '~/types/model';
4
+ import { createScopedLogger } from './logger';
5
 
6
  export const WORK_DIR_NAME = 'project';
7
  export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
 
11
  export const DEFAULT_MODEL = 'claude-3-5-sonnet-latest';
12
  export const PROMPT_COOKIE_KEY = 'cachedPrompt';
13
 
14
+ const logger = createScopedLogger('Constants');
15
+
16
  const PROVIDER_LIST: ProviderInfo[] = [
17
  {
18
  name: 'Anthropic',
 
386
  provider: 'Ollama',
387
  maxTokenAllowed: 8000,
388
  }));
389
+ } catch (e: any) {
390
+ logger.warn('Failed to get Ollama models: ', e.message || '');
391
  return [];
392
  }
393
  }
 
474
  label: model.id,
475
  provider: 'LMStudio',
476
  }));
477
+ } catch (e: any) {
478
+ logger.warn('Failed to get LMStudio models: ', e.message || '');
479
  return [];
480
  }
481
  }
 
494
  }
495
  }
496
  } catch (error: any) {
497
+ logger.warn(`Failed to fetch apikeys from cookies: ${error?.message}`);
498
  }
499
  MODEL_LIST = [
500
  ...(