Skip to content

Feature: Add LLM COT Rendering support for WebUI#2077

Merged
danielaskdd merged 4 commits intoHKUDS:mainfrom
danielaskdd:render-thinking-block
Sep 8, 2025
Merged

Feature: Add LLM COT Rendering support for WebUI#2077
danielaskdd merged 4 commits intoHKUDS:mainfrom
danielaskdd:render-thinking-block

Conversation

@danielaskdd
Copy link
Collaborator

Add LLM COT Rendering support for WebUI

📋 Summary

This PR introduces a new feature that visualizes AI thinking processes in the chat interface, providing users with transparency into how the AI formulates responses. The feature includes real-time thinking content display, timing statistics, and an intuitive expandable UI.

✨ Features Added

🎯 Core Functionality

  • Real-time Thinking Visualization: Parse and display AI thinking content using <think> tags during streaming responses
  • Thinking Time Tracking: Accurate measurement and display of thinking duration with millisecond precision
  • Expandable UI: Collapsible thinking sections with smooth animations and intuitive controls
  • Streaming Support: Real-time parsing of thinking content as responses are received

🌐 User Experience Improvements

  • Visual Indicators: Clear thinking status with loading animations and chevron icons
  • Content Separation: Clean separation between thinking process and final response
  • Interactive Controls: Click-to-expand functionality for thinking content
  • Responsive Design: Optimized layout for different screen sizes

🌍 Internationalization

  • Multi-language Support: Added translations for 5 languages (EN, ZH, ZH_TW, AR, FR)
  • Localized Timing Display: Culture-appropriate time formatting
  • Accessible Labels: Screen reader friendly interface elements

- Add thinking fields to Message type
- Create expandable thinking section
- Track thinking time during streaming
- Reset expansion state on new thinking
- Prevent content leakage during thinking
- Update thinkingTime type to allow null
- Add memory leak prevention cleanup
- Add missing i18n translations
- Add thinkingProcessed ref to track state
- Extract thinking content only once
- Preserve real-time thinking updates
- Reset processed flag on new queries
- Always update display content stream
@danielaskdd danielaskdd merged commit 5f349d5 into HKUDS:main Sep 8, 2025
1 check failed
@danielaskdd danielaskdd deleted the render-thinking-block branch September 8, 2025 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant