Skip to content

Commit 7ba7345

Browse files
committed
some more logs cleanup
1 parent e0c5c51 commit 7ba7345

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

app/utils/constants.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Cookies from 'js-cookie';
22
import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
33
import type { ProviderInfo } from '~/types/model';
4+
import { createScopedLogger } from './logger';
45

56
export const WORK_DIR_NAME = 'project';
67
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
@@ -10,6 +11,8 @@ export const PROVIDER_REGEX = /\[Provider: (.*?)\]\n\n/;
1011
export const DEFAULT_MODEL = 'claude-3-5-sonnet-latest';
1112
export const PROMPT_COOKIE_KEY = 'cachedPrompt';
1213

14+
const logger = createScopedLogger('Constants');
15+
1316
const PROVIDER_LIST: ProviderInfo[] = [
1417
{
1518
name: 'Anthropic',
@@ -383,8 +386,8 @@ async function getOllamaModels(): Promise<ModelInfo[]> {
383386
provider: 'Ollama',
384387
maxTokenAllowed: 8000,
385388
}));
386-
} catch (e) {
387-
console.warn('Failed to get Ollama models:', e);
389+
} catch (e: any) {
390+
logger.warn('Failed to get Ollama models: ', e.message || '');
388391
return [];
389392
}
390393
}
@@ -471,8 +474,8 @@ async function getLMStudioModels(): Promise<ModelInfo[]> {
471474
label: model.id,
472475
provider: 'LMStudio',
473476
}));
474-
} catch (e) {
475-
console.warn('Failed to get LMStudio models:', e);
477+
} catch (e: any) {
478+
logger.warn('Failed to get LMStudio models: ', e.message || '');
476479
return [];
477480
}
478481
}
@@ -491,7 +494,7 @@ async function initializeModelList(): Promise<ModelInfo[]> {
491494
}
492495
}
493496
} catch (error: any) {
494-
console.warn(`Failed to fetch apikeys from cookies:${error?.message}`);
497+
logger.warn(`Failed to fetch apikeys from cookies: ${error?.message}`);
495498
}
496499
MODEL_LIST = [
497500
...(

0 commit comments

Comments
 (0)