Skip to content

No null check on state in vote functions can cause crash #3787

@MrBMRBLX

Description

@MrBMRBLX

In fastchat/serve/gradio_web_server.py, the vote_last_response function calls state.dict() without checking if state is None first.

After clear_history sets state = None, if a user clicks a vote button quickly before the UI updates, this will crash with AttributeError.

def vote_last_response(state, vote_type, model_selector, request):
    data = {
        "state": state.dict(),  # crashes if state is None
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions