fix(desktop): DeerFlow UI — ChatArea refactor + ai-elements + dead CSS cleanup

ChatArea retry button uses setInput instead of direct sendToGateway,
fix bootstrap spinner stuck for non-logged-in users,
remove dead CSS (aurora-title/sidebar-open/quick-action-chips),
add ai components (ReasoningBlock/StreamingText/ChatMode/ModelSelector/TaskProgress),
add ClassroomPlayer + ResizableChatLayout + artifact panel

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-02 19:24:44 +08:00
parent d40c4605b2
commit 28299807b6
70 changed files with 4938 additions and 618 deletions

View File

@@ -0,0 +1,76 @@
/**
* useClassroom — React hook wrapping the classroom store for component consumption.
*
* Provides a simplified interface for classroom generation and chat.
*/
import { useCallback } from 'react';
import {
useClassroomStore,
type GenerationRequest,
} from '../store/classroomStore';
import type {
Classroom,
ClassroomChatMessage,
} from '../types/classroom';
export interface UseClassroomReturn {
/** Is generation in progress */
generating: boolean;
/** Current generation stage name */
progressStage: string | null;
/** Progress percentage 0-100 */
progressPercent: number;
/** The active classroom */
activeClassroom: Classroom | null;
/** Chat messages for active classroom */
chatMessages: ClassroomChatMessage[];
/** Is a chat request loading */
chatLoading: boolean;
/** Error message, if any */
error: string | null;
/** Start classroom generation */
startGeneration: (request: GenerationRequest) => Promise<string>;
/** Cancel active generation */
cancelGeneration: () => void;
/** Send a chat message in the active classroom */
sendChatMessage: (message: string, sceneContext?: string) => Promise<void>;
/** Clear current error */
clearError: () => void;
}
/**
* Hook for classroom generation and multi-agent chat.
*
* Components should use this hook rather than accessing the store directly,
* to keep the rendering logic decoupled from state management.
*/
export function useClassroom(): UseClassroomReturn {
const {
generating,
progressStage,
progressPercent,
activeClassroom,
chatMessages,
chatLoading,
error,
startGeneration,
cancelGeneration,
sendChatMessage,
clearError,
} = useClassroomStore();
return {
generating,
progressStage,
progressPercent,
activeClassroom,
chatMessages,
chatLoading,
error,
startGeneration: useCallback((req: GenerationRequest) => startGeneration(req), [startGeneration]),
cancelGeneration: useCallback(() => cancelGeneration(), [cancelGeneration]),
sendChatMessage: useCallback((msg, ctx) => sendChatMessage(msg, ctx), [sendChatMessage]),
clearError: useCallback(() => clearError(), [clearError]),
};
}