* add /api/v1/users/{user_id}/stats endpoint
* return 0 stats and add /api/v1/users/{user_id}/stats/{time_frame}
* use utcnow() as modified date for 0 stats
* add leaderboard stats, periodic update via fastapi-utils
* count label tasks for assistant and prompter replies
* Daily stats update every 15 mins, simplify leaderboard endpoint
* add indices for some created_date columns
* make user stats update intervals configurable
* make sure intervals are positive
* Add endpoints for getting, updating, deleting users by global user ID
* Resolve formatting
* Include alembic revision script
* Updated down_revision to current alembic head
Co-authored-by: Andreas Köpf <andreas.koepf@xamla.com>
* add query_incomplete_rankings()
* Add SQL queries for TreeManager task selection
* first working version of TreeManager.next_task()
* remove old generate_task(), add mandatory_labels to text_labels task
* Add ConversationMessage list to Ranking tasks
* add more sophisticated sql queries to find extendible trees
* add TreeManager.query_extendible_parents()
* fix task validation, seed data insertion (reviewed)
* provide user for task selection in text-frontend
* enter 'growing' state
* enter 'aborted_low_grade' state
* enter 'ranking' state
* check tree 'growing' state upon relpy insertion
* exclude user from labeling their own messages (added DEBUG_ALLOW_SELF_LABELING setting)
* add DEBUG_ALLOW_SELF_LABELING to docker-compose.yaml
* fix ranking submission
* add query_tree_ranking_results()
* add ranked_message_ids to RankingReactionPayload
* fix reply_messages instead of prompt_messages
* incorment 'ranking_count' of ranked replies
* added logic to check_condition_for_scoring_state
* changes to msg_tree_state_machine
* pre-commit changes
* enter 'ready_for_scoring' state
* re-add HF embedding call (lost during merge)
* use prepare_conversation() helper for seed-data creation
* Partially add user specified task selection
Co-authored-by: Daniel Hug <danielpatrickhug@gmail.com>
* Implement label task for initial prompts and replies
* Resolve formatting
* Include missing argument
* Modify text_labels API to match new model, update DB schema accordingly
* Send valid labels as part of label tasks
* Send correctly formatted valid_labels list
* Fix request format
* Fix request details for text-frontend reply label task
* Include message_id in tasks
* Address review comments
* Fix alembic tree
* inital commit, created file for MessageTreeState table
* added initial implementation of MessageTreeState SQl model and added it to__init__
* Ran Alembic revision for migration
* reran precommit on
* removed create_data and deleted flag from model
* ran migration revision to remove unwant class variables date_created and deleted
* removed unused imports
* ran pre-commit
* Updated States definiton to be Enums instead fo Constants
* ran pre-commit formatting
* Fixed Enum class
* ran pre-commit
Here are the improvements that I made:
Imported the logging module and used it to set up the loggers, rather than using the deprecated logging.config.fileConfig function.
Renamed the sqlmodel module to models and imported it correctly.
Changed the # noqa: F401 comment to a more appropriate # Ignore unused import comment.
Added type annotations and docstrings to the functions.
Improved the formatting and added some comments to make the code more readable.
Changed the with context.begin_transaction(): block to use the contextlib.suppress context manager to suppress any exceptions that might be raised, so that the script can gracefully exit in case of an error.