Skip to content
This repository was archived by the owner on Mar 18, 2026. It is now read-only.

refactoring#150

Merged
CocoRoF merged 15 commits intodeployfrom
main
Aug 28, 2025
Merged

refactoring#150
CocoRoF merged 15 commits intodeployfrom
main

Conversation

@CocoRoF
Copy link
Collaborator

@CocoRoF CocoRoF commented Aug 28, 2025

This pull request introduces a major refactor and several improvements to the chat interface and its supporting components. The most significant change is the addition of a new, modular chat interface component (ChatInterfaceRefactored2.tsx) that leverages custom hooks for workflow execution, collection management, and scroll management. Additionally, the pull request enhances markdown and LaTeX rendering in chat messages, improves UI consistency, and removes unnecessary debug logging from parsing utilities.

Chat Interface Refactor and Feature Improvements

  • Added a new chat interface component ChatInterfaceRefactored2.tsx that refactors the chat flow, introduces modular state management via custom hooks, and improves handling for workflows, attachments, collections, and PDF viewing. This component also manages panel resizing and scroll restoration for a better user experience.
  • Updated ESLint configuration to ignore the new backup/ directory, preventing linting of backup or experimental files.

Markdown and LaTeX Rendering Enhancements

  • Improved LaTeX rendering in ChatParserLatex.tsx by applying markdown processing to non-LaTeX text segments, adjusting font sizes for block and inline equations, and ensuring consistent formatting. [1] [2] [3] [4] [5]
  • Integrated processInlineMarkdown for better markdown support within LaTeX blocks and non-LaTeX text.

Codebase Clean-up and Logging Removal

  • Removed unnecessary debug logging statements from chat parsing utilities, including citation and LaTeX block finders, for cleaner production code. [1] [2] [3] [4] [5] [6] [7]

Minor Logic and Safety Improvements

  • Added minor logic improvements and code comments to citation and LaTeX parsing functions for safer and clearer handling of edge cases. [1] [2]

These changes collectively improve the maintainability, user experience, and rendering quality of the chat interface and its supporting components.

haesookimDev and others added 15 commits August 27, 2025 11:18
- Introduce new ChatInterface component with enhanced chat features
- Add useCollectionManagement hook for managing selected collections with localStorage sync
- Add useInputHandling hook for input state, IME composition, and auto-resizing textarea
- Add useScrollManagement hook for scroll position, user scroll detection, and smooth scroll-to-bottom
- Add useWorkflowExecution hook to handle workflow execution with streaming and deploy support
- Support dynamic PDF viewer panel with resizable split layout
- Implement attachment menu with collection modal integration
- Preserve scroll position when viewing source documents and during workflow execution
- Improve workflow content loading and error handling with user context support
- Add ChatContainer component with PDF viewer support and panel resizing
- Implement ChatInput component with attachment menu and message handling
- Create CollectionDisplay component to show selected collections
- Develop ChatInterfaceOptimized and ChatInterfaceRefactored2 components for improved chat UI
- Introduce useChatState hook with reducer for centralized chat UI and workflow state management
- Define comprehensive chat state types and actions for UI, panel, PDF viewer, and workflow
- Add related index exports for new components and types
- Enable dynamic PDF viewer loading to avoid SSR issues
- Implement scroll and workflow execution management hooks integration
- Persist panel split state in localStorage for consistent user experience
- Introduce PerformanceTracker class for measuring and aggregating
  performance metrics such as render durations.
- Add hooks useRenderTracker, useMemoryTracker, and useRenderTime to
  track render counts, memory usage, and render durations respectively.
- Create ProfilerWrapper component to integrate React DevTools Profiler
  with custom logging.
- Implement PerformanceBenchmark component to display render counts,
  average render times, and optional memory usage in development mode.
- Add PerformanceComparison component to toggle and compare original
  and optimized component performance during development.
- Replace legacy ChatInterface with a memoized functional component using
  custom hooks for workflow execution, collection, scroll, and chat state
  management.
- Remove redundant state variables and handlers; centralize state via useChatState.
- Modularize logic: separate concerns for workflow execution, input handling,
  and UI state toggling.
- Introduce ChatContainer component to encapsulate chat area and PDF viewer,
  improving layout and performance.
- Simplify additionalParams validation with memoized function.
- Improve scroll handling with useScrollManagement hook for better UX.
- Remove deprecated dynamic imports and ResizablePanel in favor of integrated
  panel management.
- Clean up event handlers and side
Reformatted the "exclude" array in tsconfig.json to a single line
for improved readability and consistency with project style guidelines.
- Add scoped CSS module for ChatInterface container styling
- Introduce useInputHandling hook import (preparation for input logic)
- Replace inline styles with CSS module class for root div
- Fix setInputMessage to update chatContainerRef input properly
- Refactor workflow content loading to handle loading state correctly
  with try-catch-finally and consolidated error handling
- Update useEffect dependencies for scroll management hooks to prevent
  stale closures and ensure consistent scrolling behavior
- Rename ChatInterfaceOptimized to ChatInterface for clarity
- Add hasLoadedExistingChat ref to prevent repeated loading of existing chats
- Modify workflow content loading effect to run only once per workflow content
- Adjust dependencies in useEffect hooks to avoid unnecessary re-renders and reloads
- Capture and clear the current input message before loading existing chat logs
- Pass the captured message to workflowExecution.executeWorkflow to ensure proper execution context
- Clear input message after sending on Enter key press to reset input field
- Add missing dependency to useEffect hooks for consistent behavior and avoid stale closures
[리팩토링] ChatInterface 컴포넌트 구조 개선 및 상태 관리 최적화
Refine scroll behavior to avoid forcing scroll to bottom if the user
has manually scrolled up in the chat interface. This improves user
experience by respecting user scroll position during message updates.

- Track user scroll direction to detect upward scrolling in useScrollManagement
- Modify scrollToBottom to skip auto-scroll if user scrolled up
- Update ChatInterface to trigger auto-scroll only on new messages with output data
- Remove redundant scrollToBottom calls from workflow execution hook during streaming and on completion
- Add scrollToBottom call on message send and Enter key press to ensure chat view stays updated
- Refactor LaTeX parsing and rendering to use processInlineMarkdown for consistent markdown processing inside LaTeX text
- Enhance LaTeX detection regex to better identify block and inline math expressions
- Remove numerous console.log/debug statements across PDFViewer, DocumentViewer, SidePanelPDFViewer, ChatContent, ChatInterface, PerformanceBenchmark, and useWorkflowExecution; replace with devLog where appropriate for controlled logging
- Minor style and readability improvements in LaTeX renderer component (font size adjustments for block and inline math)
- Clean up debug logs in chat workflow execution hook and performance benchmarking component
- Introduce optional onShiftEnter callback in ChatInput and ChatContainer
- Trigger onShiftEnter (scrollToBottom) on Shift+Enter key press in input handling
- Update ChatInterface to pass scrollToBottom as onShiftEnter handler
- Extend ESLint config to ignore backup/ directory
- Implemented startTraining, getMLflow, getTrainingStatus, getAllTrainingJobs, stopTraining, and createTrainVastInstance functions in trainAPI.js for managing training jobs.
- Developed saveWorkflow, listWorkflows, listWorkflowsDetail, loadWorkflow, deleteWorkflow, getWorkflowList, getWorkflowPerformance, getWorkflowNodeCounts, getPieChartData, getBarChartData, getLineChartData, getWorkflowIOLogs, deleteWorkflowIOLogs, executeWorkflowById, executeWorkflowByIdStream, deleteWorkflowPerformance, executeWorkflowTesterStream, getWorkflowTesterIOLogs, and deleteWorkflowTesterIOLogs functions in workflowAPI.js for workflow management and performance monitoring.
- Enhanced error handling and logging throughout the API functions.
@CocoRoF CocoRoF merged commit 0463ad0 into deploy Aug 28, 2025
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants