danny-avila / LibreChat

Enhanced ChatGPT Clone: Features Anthropic, AWS, OpenAI, Assistants API, Azure, Groq, o1, GPT-4o, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, langchain, DALL-E-3, ChatGPT Plugins, OpenAI Functions, Secure Multi-User System, Presets, completely open-source for self-hosting. Actively in public development.
https://librechat.ai/
MIT License
17.59k stars 2.92k forks source link

Enhancement: Better handle large amounts of pasted input text #2335

Closed kzar closed 4 months ago

kzar commented 5 months ago

What features would you like to see added?

One of the useful things about the Claude Opus model is the large context window, that can be used to do things like summarise large blocks of text. Unfortunately though, Librechat responds quite sluggishly when a large block of text is pasted into the input box.

More details

The official Claude web UI handles this well, large amounts of text are displayed as a small "Pasted" icon instead and the app doesn't slow down. It would be nice if Librechat could do something similar.

Which components are impacted by your request?

No response

Pictures

image

Code of Conduct

danny-avila commented 5 months ago

Thanks! I'll look into it

kzar commented 5 months ago

If it helps, I'm guessing they're using the paste event and checking the clipboard length before deciding what to do.

danny-avila commented 5 months ago

If it helps, I'm guessing they're using the paste event and checking the clipboard length before deciding what to do.

Great point, will have to think how to best to implement

danny-avila commented 5 months ago

Also FYI and mostly a note for myself. The "delay" for long text only happens on chrome and I narrowed down exactly why. There would need to be a compromise for the current optimizations being handled for the textarea to fix it, but also may not address for a while.

kzar commented 5 months ago

If you want a second pair of eyes to look at that slow code, just shout (and link the code). Would be happy to have a quick look if it helps.

jordantgh commented 5 months ago

Speaking personally, I am quite often editing the pasted text, so I'm not sure the claude approach is ideal in all cases. Arguably it's better practise to get everything just right before pasting, but often enough I change my mind about what to include in the context as I'm drafting my query. I can see a case though for a pop out editor for larger prompts. But even ChatGPT doesn't have perfect UX on this, it seems like a hard problem.

danny-avila commented 5 months ago

If you want a second pair of eyes to look at that slow code, just shout (and link the code). Would be happy to have a quick look if it helps.

I figured out the root cause for this issue and I’ll be pushing a change today

sbarrios93 commented 4 months ago

Unfortunately, this is still happening (not sure if the changes were pushed @danny-avila )

danny-avila commented 4 months ago

Unfortunately, this is still happening (not sure if the changes were pushed @danny-avila )

can you describe what is still happening? On both firefox/chrome, pasting large amounts of text does not incur a noticeable delay

danny-avila commented 4 months ago

Closing in favor of #2755 (same request) and the original inspiration for this issue, the slow loading of text via Chrome, is no longer an issue.