Negative limit for chat lists does not exist (v0.3.12) #1731

Closed
opened 2025-11-11 14:51:08 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @RobinBially on GitHub (Aug 8, 2024).

There are 2 failing backend tests:

  • test_get_session_user_chat_list
  • test_get_user_chats
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.DataError: (psycopg2.errors.InvalidRowCountInLimitClause) LIMIT must not be negative
E       
E       [SQL: SELECT chat.id AS chat_id, chat.title AS chat_title, chat.updated_at AS chat_updated_at, chat.created_at AS chat_created_at 
E       FROM chat 
E       WHERE chat.user_id = %(user_id_1)s AND chat.archived = false ORDER BY chat.updated_at DESC 
E        LIMIT %(param_1)s OFFSET %(param_2)s]
E       [parameters: {'user_id_1': '2', 'param_1': -1, 'param_2': 0}]
E       (Background on this error at: https://sqlalche.me/e/20/9h9h)

and in backend/apps/webui/models/chats.py there is a default value limit: int = -1, which doesn't seem to be valid.

Originally created by @RobinBially on GitHub (Aug 8, 2024). There are 2 failing backend tests: - test_get_session_user_chat_list - test_get_user_chats ```def do_execute(self, cursor, statement, parameters, context=None): > cursor.execute(statement, parameters) E sqlalchemy.exc.DataError: (psycopg2.errors.InvalidRowCountInLimitClause) LIMIT must not be negative E E [SQL: SELECT chat.id AS chat_id, chat.title AS chat_title, chat.updated_at AS chat_updated_at, chat.created_at AS chat_created_at E FROM chat E WHERE chat.user_id = %(user_id_1)s AND chat.archived = false ORDER BY chat.updated_at DESC E LIMIT %(param_1)s OFFSET %(param_2)s] E [parameters: {'user_id_1': '2', 'param_1': -1, 'param_2': 0}] E (Background on this error at: https://sqlalche.me/e/20/9h9h) ``` and in `backend/apps/webui/models/chats.py` there is a default value `limit: int = -1,` which doesn't seem to be valid.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#1731