mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-01-23 03:07:05 +00:00
some more logs cleanup
This commit is contained in:
parent
e0c5c51e56
commit
7ba734571e
@ -1,6 +1,7 @@
|
|||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
|
import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
|
||||||
import type { ProviderInfo } from '~/types/model';
|
import type { ProviderInfo } from '~/types/model';
|
||||||
|
import { createScopedLogger } from './logger';
|
||||||
|
|
||||||
export const WORK_DIR_NAME = 'project';
|
export const WORK_DIR_NAME = 'project';
|
||||||
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
|
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
|
||||||
@ -10,6 +11,8 @@ export const PROVIDER_REGEX = /\[Provider: (.*?)\]\n\n/;
|
|||||||
export const DEFAULT_MODEL = 'claude-3-5-sonnet-latest';
|
export const DEFAULT_MODEL = 'claude-3-5-sonnet-latest';
|
||||||
export const PROMPT_COOKIE_KEY = 'cachedPrompt';
|
export const PROMPT_COOKIE_KEY = 'cachedPrompt';
|
||||||
|
|
||||||
|
const logger = createScopedLogger('Constants');
|
||||||
|
|
||||||
const PROVIDER_LIST: ProviderInfo[] = [
|
const PROVIDER_LIST: ProviderInfo[] = [
|
||||||
{
|
{
|
||||||
name: 'Anthropic',
|
name: 'Anthropic',
|
||||||
@ -383,8 +386,8 @@ async function getOllamaModels(): Promise<ModelInfo[]> {
|
|||||||
provider: 'Ollama',
|
provider: 'Ollama',
|
||||||
maxTokenAllowed: 8000,
|
maxTokenAllowed: 8000,
|
||||||
}));
|
}));
|
||||||
} catch (e) {
|
} catch (e: any) {
|
||||||
console.warn('Failed to get Ollama models:', e);
|
logger.warn('Failed to get Ollama models: ', e.message || '');
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -471,8 +474,8 @@ async function getLMStudioModels(): Promise<ModelInfo[]> {
|
|||||||
label: model.id,
|
label: model.id,
|
||||||
provider: 'LMStudio',
|
provider: 'LMStudio',
|
||||||
}));
|
}));
|
||||||
} catch (e) {
|
} catch (e: any) {
|
||||||
console.warn('Failed to get LMStudio models:', e);
|
logger.warn('Failed to get LMStudio models: ', e.message || '');
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -491,7 +494,7 @@ async function initializeModelList(): Promise<ModelInfo[]> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.warn(`Failed to fetch apikeys from cookies:${error?.message}`);
|
logger.warn(`Failed to fetch apikeys from cookies: ${error?.message}`);
|
||||||
}
|
}
|
||||||
MODEL_LIST = [
|
MODEL_LIST = [
|
||||||
...(
|
...(
|
||||||
|
Loading…
Reference in New Issue
Block a user