This commit significantly refactors the handling of <think> tags within the Playground component to improve robustness, prevent Markdown rendering errors, and ensure accurate separation of reasoning and displayable content. Key changes include: - Modified `handleNonStreamRequest`, `onStopGenerator`, and `renderCustomChatContent` for more resilient <think> tag parsing. - Implemented logic to correctly extract content from fully paired `<think>...</think>` tags. - Added handling for unclosed `<think>` tags, particularly relevant during streaming responses, to capture ongoing thought processes. - Ensured `reasoningContent` is accurately populated from all sources (API, paired tags, and unclosed streaming tags). - Thoroughly sanitized the final `currentDisplayableFinalContent` to remove all residual `<think>` and `</think>` string instances, preventing issues with the Markdown renderer. - Corrected the usage of `thinkTagRegex.lastIndex = 0;` to ensure proper regex state resetting before each use in loops. Additionally, numerous explanatory comments detailing the "how" of the code (rather than the "why") have been removed to improve code readability and reduce noise.
React Template
Basic Usages
# Runs the app in the development mode
npm start
# Builds the app for production to the `build` folder
npm run build
If you want to change the default server, please set REACT_APP_SERVER environment variables before build,
for example: REACT_APP_SERVER=http://your.domain.com.
Before you start editing, make sure your Actions on Save options have Optimize imports & Run Prettier enabled.