UNPKG

@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.

13 lines (10 loc) 235 B
export const safeParseJSON = <T = Record<string, any>>(text?: string) => { if (typeof text !== 'string') return undefined; let json: T; try { json = JSON.parse(text); } catch { return undefined; } return json; };