Mintplex-Labs / anything-llm

The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, and more.
https://anythingllm.com
MIT License
26.54k stars 2.65k forks source link

[BUG]: Copy response omits some content #1359

Closed frost19k closed 5 months ago

frost19k commented 6 months ago

How are you running AnythingLLM?

Docker (local)

What happened?

If a model's response contains more than one code block, the code within the second block onwards does not get copied to the clipboard - when clicking the cope response button at the bottom. You have to manually copy the code with the copy code function of said block.

Are there known steps to reproduce?

Get the model to produce a response with more than one code block. Try "Generate a simple python flask app as well as an html landing page as a demonstration"

Click the copy response button to copy the whole response text.

Paste into a text editor and observe.

frost19k commented 6 months ago

Screenshot from 2024-05-11 15-23-17

Screenshot from 2024-05-11 15-23-21

timothycarambat commented 6 months ago

This would appear intentional and is working as expected. If you want to copy just the code block. You would click copy on the Copy code. Copy response via the clipboard on the bottom is supposed to copy the whole response - it would be counterintuitive to selectively copy random blocks from the response.

Our app and most use cases can and will produce answers that are more than just code snippets, so it makes sense to always copy the full text if you want to copy the response.

Will close as this is intentional, however, if i am misreading the issues please continue to comment

frost19k commented 6 months ago

it would be counterintuitive to selectively copy random blocks from the response.

I agree. My point is that it's not doing that. In the screenshots you will see that html pasted into VSCode is missing several lines. It seems to be specific to HTML code blocks. I'm not seeing missing lines in code blocks labels anything else.

timothycarambat commented 6 months ago

Ah, I see why this is, it was because we sanitize and strip out the HTML tags for the HTML block because of the potential of self-XSS on accident.