MCPcopy Create free account
hub / github.com/ResearAI/AutoFigure / ChatPanel

Function ChatPanel

frontend/components/chat-panel.tsx:90–1175  ·  view source on GitHub ↗
({
    isVisible,
    onToggleVisibility,
    drawioUi,
    onToggleDrawioUi,
    darkMode,
    onToggleDarkMode,
    isMobile = false,
    onCloseProtectionChange,
}: ChatPanelProps)

Source from the content-addressed store, hash-verified

88}
89
90export default function ChatPanel({
91 isVisible,
92 onToggleVisibility,
93 drawioUi,
94 onToggleDrawioUi,
95 darkMode,
96 onToggleDarkMode,
97 isMobile = false,
98 onCloseProtectionChange,
99}: ChatPanelProps) {
100 const {
101 loadDiagram: onDisplayChart,
102 handleExport: onExport,
103 handleExportWithoutHistory,
104 resolverRef,
105 chartXML,
106 clearDiagram,
107 isDrawioReady,
108 } = useDiagram()
109
110 const onFetchChart = (saveToHistory = true) => {
111 return Promise.race([
112 new Promise<string>((resolve) => {
113 if (resolverRef && "current" in resolverRef) {
114 resolverRef.current = resolve
115 }
116 if (saveToHistory) {
117 onExport()
118 } else {
119 handleExportWithoutHistory()
120 }
121 }),
122 new Promise<string>((_, reject) =>
123 setTimeout(
124 () =>
125 reject(
126 new Error(
127 "Chart export timed out after 10 seconds",
128 ),
129 ),
130 10000,
131 ),
132 ),
133 ])
134 }
135
136 // File processing using extracted hook
137 const { files, pdfData, handleFileChange, setFiles } = useFileProcessor()
138
139 const [showHistory, setShowHistory] = useState(false)
140 const [showSettingsDialog, setShowSettingsDialog] = useState(false)
141 const [, setAccessCodeRequired] = useState(false)
142 const [input, setInput] = useState("")
143 const [dailyRequestLimit, setDailyRequestLimit] = useState(0)
144 const [dailyTokenLimit, setDailyTokenLimit] = useState(0)
145 const [tpmLimit, setTpmLimit] = useState(0)
146 const [showNewChatDialog, setShowNewChatDialog] = useState(false)
147

Callers

nothing calls this directly

Calls 6

useDiagramFunction · 0.90
useFileProcessorFunction · 0.90
useQuotaManagerFunction · 0.90
hasToolErrorsFunction · 0.85
clearDiagramFunction · 0.85
handleFileChangeFunction · 0.70

Tested by

no test coverage detected