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.

16 lines (11 loc) 294 B
import { useMemo } from 'react'; export const useParseContent = (content: string) => { let isJSON = true; try { JSON.parse(content); } catch { isJSON = false; } const data = isJSON ? JSON.parse(content) : content; return useMemo(() => ({ data, isJSON }), [content]); };