xtekky / chatgpt-clone

ChatGPT interface with better UI
https://g4f.ai
GNU General Public License v3.0
3.43k stars 1.03k forks source link

The front page cannot be pulled down #82

Open White-Friday opened 1 year ago

White-Friday commented 1 year ago

When the front-end page is full, the complete information cannot be displayed through the pull-down

staythepath commented 1 year ago

I'm having this problem too, but I'm also having the list index out of range or whatever and I think I have my openai_api_base set wrong. Is it just suppose to be https://api.openai.com if I'm not using any proxy or anything? I can get it to respond with that set as the opan_api_base but I can't scroll down to see the full response.

SergeyPolud commented 1 year ago

@xtekky how to scroll the page?

staythepath commented 1 year ago

In style.css I change this to this:

html,
body {
    scroll-behavior: smooth;
    overflow: auto;
}

then in chat.js I removed every instance of

message_box.scrollTop = message_box.scrollHeight;

and added this EventListener here:

const ask_gpt = async (message) => {

  message_box.addEventListener('scroll', function () {
    message_box.scrollTo({ top: message_box.scrollHeight, behavior: "smooth" });
  });

  try {
    message_input.value = ``;
    message_input.innerHTML = ``;
    message_input.innerText = ``;`

This makes the page functional in that I can scroll down now and I can scroll down as the api is responding, but it's definitely not a proper fix. Hopefully someone comes along and does it properly, but for now this is working for me. I'm probably breaking something with this though, because IDK what I'm doing.

chekamarue commented 1 year ago

1 ) remove overflow from body and keep only html, body { scroll-behavior: smooth; } 2) open chat.js with any editor ! then press ctrl + h and remove all window.scrollTo(0, 0); lines

optionally you can add window.scrollTo(0, document.body.scrollHeight); to automatically go to bottom page

exemple

message_input.addEventListener("blur", () => { window.scrollTo(0, document.body.scrollHeight); });

you can find updated files in my fork

SergeyPolud commented 1 year ago

you can find updated files in my fork

Yesterday after a couple of hours I resolved the issue both for PC and mobile. You can find changes in my pull request https://github.com/xtekky/chatgpt-clone/pull/89

arm3n commented 1 year ago

Super appreciated!