Explorar el Código

🐛 fix(Playground): Prevent markdown error from <think> tags in reasoning display

- Modified the `renderCustomChatContent` function to strip `<think>` and `</think>` tags from `finalExtractedThinkingContent` before passing it to the `MarkdownRender` component. This resolves potential parsing errors caused by unclosed or malformed tags.
- Added a conditional check to ensure that the thinking process block is only rendered if `finalExtractedThinkingContent` has actual content and the section is expanded, improving rendering stability.
Apple\Apple hace 9 meses
padre
commit
31ece25252
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      web/src/pages/Playground/Playground.js

+ 2 - 2
web/src/pages/Playground/Playground.js

@@ -1161,11 +1161,11 @@ const Playground = () => {
                 className={`transition-all duration-500 ease-out ${message.isReasoningExpanded ? 'max-h-96 opacity-100' : 'max-h-0 opacity-0'
                 className={`transition-all duration-500 ease-out ${message.isReasoningExpanded ? 'max-h-96 opacity-100' : 'max-h-0 opacity-0'
                   } overflow-hidden`}
                   } overflow-hidden`}
               >
               >
-                {message.isReasoningExpanded && (
+                {message.isReasoningExpanded && finalExtractedThinkingContent && (
                   <div className="p-5 pt-4">
                   <div className="p-5 pt-4">
                     <div className="bg-white/70 backdrop-blur-sm rounded-xl p-4 shadow-inner overflow-x-auto max-h-50 overflow-y-auto">
                     <div className="bg-white/70 backdrop-blur-sm rounded-xl p-4 shadow-inner overflow-x-auto max-h-50 overflow-y-auto">
                       <div className="prose prose-sm prose-purple max-w-none">
                       <div className="prose prose-sm prose-purple max-w-none">
-                        <MarkdownRender raw={finalExtractedThinkingContent} />
+                        <MarkdownRender raw={finalExtractedThinkingContent.replace(/<\/?think>/g, '')} />
                       </div>
                       </div>
                     </div>
                     </div>
                   </div>
                   </div>