CodeGPT icon indicating copy to clipboard operation
CodeGPT copied to clipboard

generated html code is not displayed on chat window

Open paat opened this issue 9 months ago • 1 comments

What happened?

I am using llama.cpp server. with qwen 2.5 html code part of the prompt response is not shown on chat window. Image

Here is the full source of the message (html part is clearly present) Source.txt

Relevant log output or stack trace


Steps to reproduce

Just ask to refactor a html code.

CodeGPT version

3.2.3-241.1

Operating System

Windows

paat avatar Apr 22 '25 21:04 paat

+1 The only way to see the generated HTML code is to close the tab and then open it from history. If the code is in the first tab (the one you can't close) the only way to see is to close and open project once again.

PyCharm Build #PY-251.23774.444, built on April 15, 2025 throws the following error:

com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: Access from Event Dispatch Thread (EDT) is not allowed; If you access or modify model on EDT consider wrapping your code in WriteIntentReadAction ; see https://jb.gg/ij-platform-threading for details
Current thread: Thread[#81,AWT-EventQueue-0,6,main] 1868838282 (EventQueue.isDispatchThread()=true)
SystemEventQueueThread: (same)
	at com.intellij.util.concurrency.ThreadingAssertions.createThreadAccessException(ThreadingAssertions.java:257)
	at com.intellij.util.concurrency.ThreadingAssertions.throwThreadAccessException(ThreadingAssertions.java:248)
	at com.intellij.util.concurrency.ThreadingAssertions.assertBackgroundThread(ThreadingAssertions.java:112)
	at com.intellij.openapi.application.ReadAction.computeCancellable(ReadAction.java:115)
	at com.intellij.javascript.web.html.WebFrameworkHtmlLanguageSubstitutor.getLanguage(WebFrameworkHtmlLanguageSubstitutor.kt:19)
	at com.intellij.psi.LanguageSubstitutors.substituteLanguage(LanguageSubstitutors.java:52)
	at com.intellij.lang.LanguageUtil.getLanguageForPsi(LanguageUtil.java:56)
	at com.intellij.openapi.editor.highlighter.EditorHighlighterFactoryImpl.createEditorHighlighter(EditorHighlighterFactoryImpl.kt:37)
	at com.intellij.openapi.editor.highlighter.EditorHighlighterFactoryImpl.createEditorHighlighter(EditorHighlighterFactoryImpl.kt:68)
	at com.intellij.openapi.editor.impl.EditorFactoryImpl.createEditor(EditorFactoryImpl.kt:174)
	at ee.carlrobert.codegpt.util.EditorUtil.createEditor(EditorUtil.kt:41)
	at ee.carlrobert.codegpt.toolwindow.chat.editor.ResponseEditorPanel.<init>(ResponseEditorPanel.java:56)
	at ee.carlrobert.codegpt.toolwindow.chat.ui.ChatMessageResponseBody.prepareProcessingCode(ChatMessageResponseBody.java:313)
	at ee.carlrobert.codegpt.toolwindow.chat.ui.ChatMessageResponseBody.processCode(ChatMessageResponseBody.java:289)
	at ee.carlrobert.codegpt.toolwindow.chat.ui.ChatMessageResponseBody.processResponse(ChatMessageResponseBody.java:275)
	at ee.carlrobert.codegpt.toolwindow.chat.ui.ChatMessageResponseBody.updateMessage(ChatMessageResponseBody.java:132)
	at ee.carlrobert.codegpt.toolwindow.chat.ToolWindowCompletionResponseEventListener.processBufferedMessages(ToolWindowCompletionResponseEventListener.java:157)
	at ee.carlrobert.codegpt.toolwindow.chat.ToolWindowCompletionResponseEventListener.lambda$new$0(ToolWindowCompletionResponseEventListener.java:43)
	at java.desktop/javax.swing.Timer.fireActionPerformed(Timer.java:311)
	at java.desktop/javax.swing.Timer$DoPostEvent.run(Timer.java:243)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:102)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:102)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:108)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:102)
	at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:728)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:750)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:585)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:482)
	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$12$lambda$11$lambda$10$lambda$9(IdeEventQueue.kt:307)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:864)
	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$12$lambda$11$lambda$10(IdeEventQueue.kt:306)
	at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$3(IdeEventQueue.kt:958)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:109)
	at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:958)
	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$12(IdeEventQueue.kt:301)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:341)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

Hope this helps to resolve the issue and thank you for a great plugin!

koolvn avatar Apr 25 '25 13:04 koolvn

+1

Lshan523 avatar May 27 '25 06:05 Lshan523

+1

PeggyPro avatar May 27 '25 07:05 PeggyPro

+1

ShimonMimoun avatar Jun 03 '25 10:06 ShimonMimoun

+1

darwindaume avatar Jun 12 '25 11:06 darwindaume

A quick and dirty workaround is to force the LLM to format the markdown code block as XML, not HTML.

How to set this up:

Settings > Tools > ProxyAI > Personas > Default Persona (or your custom persona) > Add this line to the language formatting section:

8. If you are asked to return HTML code, use the xml language identifier in the markdown code block instead of html.

It then returns HTML code blocks as XML, but at least you can display and copy the code without re-opening the chat window or project.

Image

Not a fix, but I hope it helps!

darwindaume avatar Jun 12 '25 12:06 darwindaume

+1 and thank you for pointing that out @darwindaume, it seems HTML blocks do specifically cause this error. As I'm currently in my front-end dev mode this issue props up quite often.

However Mistral is very particular about using the correct language tag, overriding the system prompt/persona whenever it feels... In the mood to bug me...

Extra, when closing and re-opening IntelliJ, the generated code blocks do show. So it seems to be just a "rendering as it's being generated" thing

I see there's 4 duplicates of this issue (If you search for com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments.) I hope carlrobertoh finds a moment to tackle this one.

Juraji avatar Jul 17 '25 18:07 Juraji