feat(providers): add error handling
This commit is contained in:
parent
ec91289c0c
commit
fd65af53c3
|
@ -10,6 +10,7 @@ export const getAvailableProviders = async () => {
|
|||
const models = {};
|
||||
|
||||
if (openAIApiKey) {
|
||||
try {
|
||||
models['openai'] = {
|
||||
'gpt-3.5-turbo': new ChatOpenAI({
|
||||
openAIApiKey,
|
||||
|
@ -26,6 +27,9 @@ export const getAvailableProviders = async () => {
|
|||
modelName: 'text-embedding-3-large',
|
||||
}),
|
||||
};
|
||||
} catch (err) {
|
||||
console.log(`Error loading OpenAI models: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (ollamaEndpoint) {
|
||||
|
@ -50,7 +54,7 @@ export const getAvailableProviders = async () => {
|
|||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
console.log(`Error loading Ollama models: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue