diff --git a/App.tsx b/App.tsx index 70a1360..bdb64b9 100644 --- a/App.tsx +++ b/App.tsx @@ -1,10 +1,11 @@ import React, { useState, useEffect, useRef, useCallback } from 'react'; import { - Settings, MessageSquare, Brain, Search, Image as ImageIcon, + Settings, Brain, Search, Image as ImageIcon, Video, Mic, Send, Upload, Download, Copy, Share2, Menu, X, Sun, Moon, Volume2, Globe, Trash2, Plus, Info, PanelRight, PanelRightClose, History, Home as HomeIcon, - Sparkles, Layers, Sliders, MonitorDown, AlertTriangle + Sparkles, Layers, Sliders, MonitorDown, AlertTriangle, + Sigma, Cpu, Code, Box, Network, Bot, Binary } from 'lucide-react'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; @@ -49,10 +50,20 @@ const Modal: React.FC<{ isOpen: boolean; onClose: () => void; title: string; chi // Constants for UI const SIDEBAR_GROUPS = [ { - title: 'group.learning', + title: 'group.cs', + modules: [ + { id: AppModule.MATH, icon: Sigma, label: 'module.math', desc: 'desc.math' }, + { id: AppModule.THEORY, icon: Binary, label: 'module.theory', desc: 'desc.theory' }, + { id: AppModule.PRINCIPLES, icon: Cpu, label: 'module.principles', desc: 'desc.principles' }, + { id: AppModule.SOFT_ENG, icon: Code, label: 'module.soft_eng', desc: 'desc.soft_eng' }, + { id: AppModule.GRAPHICS, icon: Box, label: 'module.graphics', desc: 'desc.graphics' }, + { id: AppModule.NETWORK, icon: Network, label: 'module.network', desc: 'desc.network' }, + { id: AppModule.AI_LAB, icon: Bot, label: 'module.ai_lab', desc: 'desc.ai_lab' }, + ] + }, + { + title: 'group.tools', modules: [ - { id: AppModule.TUTOR, icon: MessageSquare, label: 'module.tutor', desc: 'desc.tutor' }, - { id: AppModule.THINKER, icon: Brain, label: 'module.thinker', desc: 'desc.thinker' }, { id: AppModule.RESEARCH, icon: Search, label: 'module.research', desc: 'desc.research' }, ] }, @@ -85,7 +96,7 @@ export default function App() { }); const [currentSessionId, setCurrentSessionId] = useState(null); - const [currentModule, setCurrentModule] = useState(AppModule.TUTOR); + const [currentModule, setCurrentModule] = useState(AppModule.MATH); const [isHome, setIsHome] = useState(true); const [inputText, setInputText] = useState(''); @@ -96,6 +107,9 @@ export default function App() { const [isLoading, setIsLoading] = useState(false); const [loadingText, setLoadingText] = useState(''); + // Thinking Toggle State + const [isThinkingMode, setIsThinkingMode] = useState(false); + // PWA Install Prompt const [installPrompt, setInstallPrompt] = useState(null); @@ -318,7 +332,7 @@ export default function App() { role: MessageRole.MODEL, timestamp: Date.now(), text: '', - isThinking: currentModule === AppModule.THINKER + isThinking: isThinkingMode && !isCreativeModule(currentModule) }]); try { @@ -336,7 +350,7 @@ export default function App() { }]); } else { // Text/Chat Generation - if (currentModule === AppModule.THINKER) setLoadingText(t('status.thinking', settings.language)); + if (isThinkingMode) setLoadingText(t('status.thinking', settings.language)); else setLoadingText(t('status.generating', settings.language)); // Prepare history for API @@ -347,7 +361,8 @@ export default function App() { return { role: m.role, parts }; }); - const stream = await geminiRef.current!.generateText(inputText, currentModule, historyParts, attachments); + // Pass isThinkingMode to the service + const stream = await geminiRef.current!.generateText(inputText, currentModule, historyParts, attachments, isThinkingMode); let fullText = ''; let sources: any[] = []; @@ -363,7 +378,7 @@ export default function App() { const lastMsg = msgs[msgs.length - 1]; if (lastMsg.id === botMsgId) { lastMsg.text = fullText; - lastMsg.isThinking = false; + lastMsg.isThinking = false; // Turn off thinking indicator once text starts arriving (simplification) } return { ...s, messages: msgs }; } @@ -572,8 +587,8 @@ export default function App() { }; const renderHome = () => ( -
-
+
+
@@ -954,11 +969,21 @@ export default function App() {
- {AppModule.TUTOR === currentModule && } - {AppModule.THINKER === currentModule && } + {AppModule.MATH === currentModule && } + {AppModule.THEORY === currentModule && } + {AppModule.PRINCIPLES === currentModule && } + {AppModule.SOFT_ENG === currentModule && } + {AppModule.GRAPHICS === currentModule && } + {AppModule.NETWORK === currentModule && } + {AppModule.AI_LAB === currentModule && } {AppModule.RESEARCH === currentModule && }
-

{t('prompt.placeholder', settings.language)}

+

+ {t(`hello.${currentModule}`, settings.language)} +

+

+ {t(`desc.${currentModule}`, settings.language)} +

) : ( @@ -996,6 +1021,15 @@ export default function App() {
+ + {/* Deep Thinking Toggle */} +