feat(chat): remove mobile check and open new session draft when no active session
This commit is contained in:
@@ -11,7 +11,6 @@ import { useChatScrollManager } from '@/hooks/useChatScrollManager';
|
||||
import { useDeviceInfo } from '@/lib/device';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { OverlayScrollbar } from '@/components/ui/OverlayScrollbar';
|
||||
import { isVSCodeRuntime } from '@/lib/desktop';
|
||||
|
||||
export const ChatContainer: React.FC = () => {
|
||||
const {
|
||||
@@ -41,14 +40,10 @@ export const ChatContainer: React.FC = () => {
|
||||
const draftOpen = Boolean(newSessionDraft?.open);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (isMobile || isVSCodeRuntime()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!currentSessionId && !draftOpen) {
|
||||
openNewSessionDraft();
|
||||
}
|
||||
}, [currentSessionId, draftOpen, isMobile, openNewSessionDraft]);
|
||||
}, [currentSessionId, draftOpen, openNewSessionDraft]);
|
||||
|
||||
const sessionMessages = React.useMemo(() => {
|
||||
|
||||
|
||||
@@ -46,12 +46,12 @@ export const VSCodeLayout: React.FC = () => {
|
||||
}
|
||||
}, [currentSessionId]);
|
||||
|
||||
// If the active session disappears (e.g., deleted), stay on the sessions list
|
||||
// If the active session disappears (e.g., deleted), show a new chat view
|
||||
React.useEffect(() => {
|
||||
if (!currentSessionId && !newSessionDraftOpen && currentView === 'chat') {
|
||||
setCurrentView('sessions');
|
||||
if (!currentSessionId && !newSessionDraftOpen) {
|
||||
openNewSessionDraft();
|
||||
}
|
||||
}, [currentSessionId, currentView, newSessionDraftOpen]);
|
||||
}, [currentSessionId, newSessionDraftOpen, openNewSessionDraft]);
|
||||
|
||||
const handleBackToSessions = React.useCallback(() => {
|
||||
setCurrentView('sessions');
|
||||
|
||||
Reference in New Issue
Block a user