Skip to content

Commit

Permalink
ui: support disable debug panel
Browse files Browse the repository at this point in the history
  • Loading branch information
634750802 committed Jun 25, 2024
1 parent 04a8e10 commit 0c020c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/chat/conversation-message-groups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { InfoCircledIcon } from '@radix-ui/react-icons';
import { AlertTriangleIcon } from 'lucide-react';
import { useState } from 'react';

const enableDebug = !process.env.NEXT_PUBLIC_DISABLE_DEBUG_PANEL;

export function ConversationMessageGroups ({ history }: { history: ChatMessage[] }) {
const { error, messages, isLoading, isWaiting } = useMyChatContext();
const groups = useGroupedConversationMessages(history, messages, isLoading || isWaiting, error);
Expand All @@ -38,7 +40,7 @@ function ConversationMessageGroup ({ group }: { group: ConversationMessageGroupP
const [debugInfoOpen, setDebugInfoOpen] = useState(false);
return (
<section className="space-y-6 p-4 pt-12 border-b pb-10 last-of-type:border-b-0 last-of-type:border-pb-4">
<Collapsible open={debugInfoOpen} onOpenChange={setDebugInfoOpen}>
{enableDebug && <Collapsible open={debugInfoOpen} onOpenChange={setDebugInfoOpen}>
<div className="relative pr-12">
<h2 className="text-2xl font-normal">{group.userMessage.content}</h2>
<CollapsibleTrigger asChild>
Expand All @@ -51,7 +53,7 @@ function ConversationMessageGroup ({ group }: { group: ConversationMessageGroupP
<CollapsibleContent>
<DebugInfo group={group} />
</CollapsibleContent>
</Collapsible>
</Collapsible>}

<MessageContextSources group={group} />
<section className="space-y-2">
Expand Down

0 comments on commit 0c020c8

Please sign in to comment.