// (c) 2026 TWWIM UG. All rights reserved. (www.twwim.com) import { useState } from 'react'; import { Clock, Database, Send } from 'lucide-react'; import { useTranslation } from '@/i18n/TranslationProvider'; import { usePlaygroundAsk } from '../hooks/usePlaygroundAsk'; import { PlaygroundSourceRow } from './PlaygroundSourceRow'; interface PlaygroundTabProps { tenantId: string; } /** * Top-level container for the Knowledge Playground tab. Owns the question * input, fires the ask mutation, and renders the answer + sources. * Sub-components handle individual source rows and chunk editing. */ export function PlaygroundTab({ tenantId }: PlaygroundTabProps) { const { t } = useTranslation(); const [question, setQuestion] = useState(''); const askMutation = usePlaygroundAsk(tenantId); const disabled = askMutation.isPending || question.trim().length === 0; const handleAsk = () => { askMutation.mutate({ question, topK: 8 }); }; const handleAskAgain = () => { if (question.trim().length > 0) { askMutation.mutate({ question, topK: 8 }); } }; const answer = askMutation.data; return (
{/* Question input */}