Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDEA] Live Scrolling with Scrolling Buffer #758

Closed
aymenssf opened this issue May 25, 2024 · 12 comments · Fixed by #923
Closed

[IDEA] Live Scrolling with Scrolling Buffer #758

aymenssf opened this issue May 25, 2024 · 12 comments · Fixed by #923
Labels
good first issue Good for newcomers upgrade New feature or request

Comments

@aymenssf
Copy link

Live Scrolling with Scrolling Buffer:

Scrolling Buffer: Implement a buffer that stores a certain number of previously generated lines. This allows users to scroll up and see the recently generated text without affecting the ongoing generation process.
Live Scrolling: As the AI generates new lines, automatically update the displayed content within the buffer. This way, the user can scroll up and review the recent history without the page jumping or content disappearing.

@aymenssf aymenssf added the upgrade New feature or request label May 25, 2024
@debanjum
Copy link
Member

Hey @aymenssf, can you describe the issue in more details? Is the problem that the user can't scroll-up when Khoj is writing out its response? What is the "content disappearing" bit you mentioned? Feel free to share screenshots or small videos if they'll help explaining the issue

@debanjum debanjum changed the title [IDEA] [IDEA] Live Scrolling with Scrolling Buffer May 26, 2024
@m00nbyt3
Copy link

I have this problem, I can't scroll-up when Khoj is writing out its response

@aymenssf
Copy link
Author

aymenssf commented Jun 4, 2024

https://github.com/khoj-ai/khoj/assets/79019644/4e450c75-08ca-47a1-972d-e9f993f3f021
Hello @debanjum , here is what I mean, thank you

@m00nbyt3
Copy link

m00nbyt3 commented Jun 20, 2024

As a temporal solution, we can inject this code ( genereted by khoj btw :) ) in DevTools console:


// Selects the element
var chatBody = document.getElementById("chat-body");

// Saves the last scrollTop value
var originalScrollTop = chatBody.scrollTop;

// Redefine scrollTop porperty
Object.defineProperty(chatBody, 'scrollTop', {
    set: function(value) {
        // Do not do nothing, so the scrollTop will not change
        // Maybe we can write some code here
    },
    get: function() {
        return originalScrollTop;
    },
    configurable: true
});

@shantanuSakpal
Copy link
Contributor

yep, this is an annoying bug. if the answer is going to be long, i would like to start reading it rather than waiting for the ai to finish the answer

@m00nbyt3
Copy link

m00nbyt3 commented Aug 6, 2024

This has gotten worse with the new UI, theres a strange flicker while the answer is generated, and its impossible to srcoll up to read the answer from the start while khoj is generating it.

@sabaimran sabaimran added the good first issue Good for newcomers label Sep 16, 2024
@sabaimran
Copy link
Member

hey @m00nbyt3 , does the code you pasted above work for fixing this bug?

I haven't been able to fix this so far in my experimentation from ~2 months ago. If any contributors want to jump in and create a fix, I'll actually compensate you lol. Hopefully it should be a minimal JavaScript-y fix in the file chatHistory.tsx and how the function scrollToBottom is being called.

Otherwise, I'll take another look at it next week!

@shantanuSakpal
Copy link
Contributor

alright, will give it a try.

@m00nbyt3
Copy link

That code worked before the UI upgrade. Ill also give it a try, no need to compensate anything, this is open source :))

@shantanuSakpal
Copy link
Contributor

cool @m00nbyt3 , thats the spirit 👍 😄

@sabaimran
Copy link
Member

Thanks, @m00nbyt3 ! Let me know if you run into issues and I'll hop back in.

@shantanuSakpal
Copy link
Contributor

are you still working on this? @m00nbyt3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers upgrade New feature or request
Projects
None yet
5 participants