Spaces:
Runtime error
Runtime error
File size: 923 Bytes
13095e0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import { useMemo } from 'react';
import { useTranslation } from 'next-i18next';
import { ErrorMessage } from '@/types/error';
const useErrorService = () => {
const { t } = useTranslation('chat');
return {
getModelsError: useMemo(
() => (error: any) => {
return !error
? null
: ({
title: t('Error fetching models.'),
code: error.status || 'unknown',
messageLines: error.statusText
? [error.statusText]
: [
t(
'Make sure your OpenAI API key is set in the bottom left of the sidebar.',
),
t(
'If you completed this step, OpenAI may be experiencing issues.',
),
],
} as ErrorMessage);
},
[t],
),
};
};
export default useErrorService;
|