@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.
24 lines (19 loc) • 649 B
text/typescript
import { optionalDevtools } from 'zustand-utils';
import { devtools as _devtools } from 'zustand/middleware';
import { isDev } from '@/utils/env';
export const createDevtools =
(name: string): typeof _devtools =>
(initializer) => {
let showDevtools = false;
// check url to show devtools
if (typeof window !== 'undefined') {
const url = new URL(window.location.href);
const debug = url.searchParams.get('debug');
if (debug?.includes(name)) {
showDevtools = true;
}
}
return optionalDevtools(showDevtools)(initializer, {
name: `LobeChat_${name}` + (isDev ? '_DEV' : ''),
});
};