Skip to content

fix(ui): accept top-level query requests#265

Open
Gujiassh wants to merge 1 commit into
TencentCloudADP:mainfrom
Gujiassh:fix/webui-top-level-query-request-20260522
Open

fix(ui): accept top-level query requests#265
Gujiassh wants to merge 1 commit into
TencentCloudADP:mainfrom
Gujiassh:fix/webui-top-level-query-request-20260522

Conversation

@Gujiassh

Copy link
Copy Markdown

Summary

Fixes Web UI query handling for clients that send the query text at the top level of the request payload.

UserRequest previously accepted only the nested form:

{"type": "query", "content": {"query": "..."}}

Some clients, including demo/dummy_client.py, send:

{"type": "query", "query": "..."}

That shape parsed with content=None, which later caused AttributeError: 'NoneType' object has no attribute 'query' in the WebSocket query worker. This change normalizes that legacy/top-level query form into content during request validation while keeping the existing nested form unchanged.

Fixes #223.

Validation

  • UV_PYTHON=/usr/bin/python3.12 uv run pytest tests/ui/test_user_request.py -q
  • UV_PYTHON=/usr/bin/python3.12 uv run ruff check utu/ui/common.py tests/ui/test_user_request.py
  • UV_PYTHON=/usr/bin/python3.12 uv run ruff format --check utu/ui/common.py tests/ui/test_user_request.py
  • git diff --check

Additional note: UV_PYTHON=/usr/bin/python3.12 uv run pytest tests/ui/test_user_request.py tests/utils/test_print_utils.py -q passes the new UI request tests, but the existing tests/utils/test_print_utils.py cases fail in this non-interactive shell because prompt_toolkit raises EOFError when stdin is not a TTY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

前段执行query时报错

1 participant