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

Welcome Modal is not shown #336

Open
nenb opened this issue Mar 2, 2024 · 4 comments
Open

Welcome Modal is not shown #336

nenb opened this issue Mar 2, 2024 · 4 comments
Labels
type: bug 🐛 Something isn't working
Milestone

Comments

@nenb
Copy link
Contributor

nenb commented Mar 2, 2024

Bug description

I have never seen the Welcome Modal in the UI. While it may be technically possible, I think that in practice it is not possible.

The relevant section of code is in main_page.py:

def __panel__(self):
    asyncio.ensure_future(self.refresh_data())
    
    objects = [self.left_sidebar, self.central_view, self.right_sidebar]
    
    if self.chats is not None and len(self.chats) == 0:
        ...  # logic to add welcome modal to layout here

self.chats is initialised as None. It is subsequently populated by a JSON structure by self.refresh_data(). However, self.refresh_data() is scheduled as a background task (asyncio.ensure_future) and is unlikely (impossible?) to complete before hitting the if-block of code that determines whether to show the welcome modal. Hence the welcome modal logic will never be shown.

How to reproduce the bug?

Open the UI!

Versions and dependencies used

Affects all versions.

Anything else?

My favoured proposal would be to remove the welcome modal entirely.

If this is not desired, it becomes a bit more complicated.

The welcome modal should only be shown the first time that someone uses ragna. I consider it quite a bad/annoying UX otherwise - it's just another button to click to close something and is frustrating.

The question is then: how does ragna determine a first-time user? At the moment, the only clear way is to call the /get_chats endpoint and determine the length of the chat history (a length of 0 means new user). To show the welcome modal, the application would need to wait for a response from this endpoint before showing the main_page (at the moment the application does not wait for a response, it just schedules it as a future task). However, waiting for a response in this way might introduce a performance issue if /get_chats returns something large, or if the API is slow for some reason, so I'm not sure if this is a good idea.

Another solution is to introduce a new endpoint to the API that checks whether a user already exists in the DB (so, it doesn't return the entire user history, just a boolean indicating a if the user exists). This should not create the same performance issues, but it does mean that we now need to support a new endpoint. (Which is fine, but is it really worth it?)

Another partial solution is to call the welcome modal anytime a user needs to authenticate. It's not great, as it's not only first-time users who have to authenticate, but it does reduce the frequency of the welcome modal pop-up.

@nenb nenb added the type: bug 🐛 Something isn't working label Mar 2, 2024
@pmeier
Copy link
Member

pmeier commented Mar 4, 2024

I have never seen the Welcome Modal in the UI.

Same. And I thought this happened, because we never got around to implement it. Thanks for reporting that we actually have the code, but it is broken 😇

self.chats is initialised as None. It is subsequently populated by a JSON structure by self.refresh_data(). However, self.refresh_data() is scheduled as a background task (asyncio.ensure_future) and is unlikely (impossible?) to complete before hitting the if-block of code that determines whether to show the welcome modal. Hence the welcome modal logic will never be shown.

Agreed. I think this is my fault. My previous understanding was that asyncio.ensure_future let's us run async code synchronously while we already have an event loop running. But, as you point out, this is not the case. It just schedules it. I think we broke this in #135.

My favoured proposal would be to remove the welcome modal entirely.

Let's ask @smeragoel here.

The welcome modal should only be shown the first time that someone uses ragna. I consider it quite a bad/annoying UX otherwise - it's just another button to click to close something and is frustrating.

I don't think this was the intention. IIRC, we wanted to show it every time there are no chats open. Right now this means only for a first time user, but after we fix #304, this can also happen when a user deletes all open chats. @smeragoel do you remember the details here?

@smeragoel
Copy link

The idea of the modal was to provide a "landing page" of sorts when the user starts the app, instead of the chat config modal directly.

A solution I see to reduce the number of clicks would be to move this from a modal format, to on-screen text, so that the user doesn't have to dismiss the modal to start a new chat. And you would still have a "landing page" that can always be used to provide info, updates etc.

Wdyt?

@pmeier
Copy link
Member

pmeier commented Mar 4, 2024

So if there are no chats open, we have static text where usually the chat interface is?

@smeragoel
Copy link

Yep, we still have the left panel, and static text on the right side, where the chat usually is, without the input field.

@pmeier pmeier added this to the 0.3.0 milestone Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants