Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
6.73k stars 873 forks source link

`Not Found. Thread not found` error (with Google OAuth) #1187

Open JeongYunLee opened 1 month ago

JeongYunLee commented 1 month ago

Describe the bug I used Google OAuth for data persistence, and the login process worked correctly. However, after performing a query and getting a response, I continuously encounter the error “Not Found. Thread not found” during the process of saving the log on the left side. The @cl.oauth_callback function I used is as follows.

@cl.oauth_callback
def oauth_callback(
  provider_id: str,
  token: str,
  raw_user_data: Dict[str, str],
  default_user: cl.User,
) -> Optional[cl.User]:
  return default_user

I discovered a similar issue but couldn't find a solution, so I created a new issue.

To Reproduce Steps to reproduce the behavior:

  1. Add @cl.oauth_callback
  2. Login using 'Continue with Google`
  3. Entering prompt
  4. Answers came out, but not saved the log on the left and error occured

Expected behavior

Screenshots

image

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

I am using the @cl.password_auth_callback function for login instead of OAuth, and in this case, the same error "Not Found. Thread not found" occasionally occurs (but not always). Could the irregular occurrence of this error indicate that the cause is unrelated to OAuth authentication?

@cl.password_auth_callback
def auth_callback(username: str, password: str):
    # Fetch the user matching username from your database
    # and compare the hashed password with the value stored in the database
    if (username, password) == ('admin_id', 'admin_pw'):
        return cl.User(
            identifier="admin", metadata={"role": "admin", "provider": "credentials"}
        )
    elif (username, password) == ('tester1', 'tester1'):
        return cl.User(
            identifier="tester1", metadata={"role": "user", "provider": "credentials"}
        )
    elif (username, password) == ('tester2', 'tester2'):
        return cl.User(
            identifier="tester2", metadata={"role": "user", "provider": "credentials"}
        )
    elif (username, password) == ('tester3', 'tester3'):
        return cl.User(
            identifier="tester3", metadata={"role": "user", "provider": "credentials"}
        )
    elif (username, password) == ('tester4', 'tester4'):
        return cl.User(
            identifier="tester4", metadata={"role": "user", "provider": "credentials"}
        )
    elif (username, password) == ('tester5', 'tester5'):
        return cl.User(
            identifier="tester5", metadata={"role": "user", "provider": "credentials"}
        )
    else:
        return None
JeongYunLee commented 1 month ago

Now, I'm not sure this is an OAuth problem. When I used just @cl.password_auth_callback without @cl.oauth_callback, I got the same error.

Plus, I'm using langgraph with chainlit and this error occurs irregularly. For example, (it's not clear) when the answers' lengths are long, the error occurs even if the processes are same.

Is there anybody who got the same error? please share your ideas... thanks