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.

22 lines (18 loc) 543 B
import { parseAsBoolean, useQueryState } from 'nuqs'; import { useMemo } from 'react'; export const usePinnedAgentState = () => { const [isPinned, setIsPinned] = useQueryState( 'pinned', parseAsBoolean.withDefault(false).withOptions({ clearOnDefault: true }), ); const actions = useMemo( () => ({ pinAgent: () => setIsPinned(true), setIsPinned, togglePinAgent: () => setIsPinned((prev) => !prev), unpinAgent: () => setIsPinned(false), }), [], ); return [isPinned, actions] as const; };