@lobehub/chat
Version:
Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.
22 lines (18 loc) • 608 B
text/typescript
import { t } from 'i18next';
import { notification } from '@/components/AntdStaticMethods';
import { ImportPgDataStructure } from '@/types/export';
export const parseConfigFile = async (file: File): Promise<ImportPgDataStructure | undefined> => {
const text = await file.text();
try {
return JSON.parse(text);
} catch (error) {
console.error(error);
notification.error({
description: t('import.importConfigFile.description', {
ns: 'error',
reason: (error as any).message,
}),
message: t('import.importConfigFile.title', { ns: 'error' }),
});
}
};