28 Commits

Author SHA1 Message Date
f17081b185 Add retry utilities, input validation, and comprehensive tests
- Implemented async retry logic with exponential backoff in `src/utils/retry.py`.
- Created input validation utilities for Discord bot in `src/utils/validators.py`.
- Refactored token pricing import in `src/utils/token_counter.py`.
- Added comprehensive test suite in `tests/test_comprehensive.py` covering various modules including pricing, validators, retry logic, and Discord utilities.
2025-11-30 17:45:36 +07:00
1cb47f1d25 refactor: Update prepare_messages_for_api tests to reflect changes in message handling 2025-08-28 15:31:45 +07:00
ac8fd924c1 feat: Add comprehensive unit tests for DatabaseHandler, OpenAI utilities, and code utilities 2025-06-20 21:23:03 +07:00
d3b92f8bef feat: Implement data analysis and code execution utilities
- Added data_analyzer.py for comprehensive data analysis with templates for summary, correlation, distribution, and custom analysis.
- Integrated logging for tracking analysis processes and errors.
- Included package installation functionality for required libraries.
- Developed python_executor.py to safely execute user-provided Python code with sanitization and timeout features.
- Implemented security measures to prevent unsafe code execution.
- Enhanced output handling to capture visualizations and standard output.
2025-06-20 17:56:27 +07:00
d0a6743d80 feat: Update model references to include 'openai/' prefix and improve Dockerfile for better caching and user permissions 2025-04-16 21:58:15 +07:00
8eb78a4ca3 refactor: Update Dockerfile and requirements for improved build process and add new dependencies; enhance database connection timeouts and update prompts for better user interaction 2025-03-20 22:54:25 +07:00
9f1fc47a3e chore: Remove compiled Python files from cache and update .gitignore to exclude virtual environments and temporary files 2025-03-20 15:54:02 +07:00
b9c43ed50b refactor: Clean up code formatting and enhance test cases for better readability and coverage 2025-03-20 12:50:52 +07:00
a24be7bfe9 Remove commented-out test case for web content scraping in TestWebUtils 2025-03-16 22:57:56 +07:00
da3d58360e Update test case to use example.com for web content scraping 2025-03-16 22:55:48 +07:00
69880f6734 Enhance test coverage for DatabaseHandler with environment variable support and real database handling 2025-03-13 23:18:41 +07:00
8955d089c7 Initialize tests package with __init__.py 2025-03-13 22:18:09 +07:00
bc5b00698b Refactor web scraping logic and enhance code sanitization tests for Python and C++ 2025-02-25 21:39:54 +07:00
cbae78491d Enhance code sanitization feedback for Python and C++; refactor tests to use pytest and improve structure 2025-02-25 18:29:54 +07:00
5a04e7c7a5 Remove redundant synchronous test cases for search and web commands in test_bot.py 2025-02-25 09:32:10 +07:00
4fd27b3197 Refactor bot and test code to use asynchronous methods; update get_history calls and improve test structure 2025-02-03 09:38:05 +07:00
1b9d0043e5 Refactor test cases to use asynchronous methods; update history and user model tests, and improve attachment handling 2025-02-03 09:24:17 +07:00
Vu Quoc Anh
dd198ac1df Update test_bot.py 2025-01-11 17:54:51 +07:00
Vu Quoc Anh
b2c71db135 Update test_bot.py 2025-01-08 12:30:27 +07:00
Vu Quoc Anh
5af19d7a30 Add /user_stat command to fetch and display user statistics
* Handle cases where user model is not found, default to `gpt-4o-mini`
* Handle cases where user history is not found or blank, count tokens as 0
* Add unit tests for `/user_stat` command
* Test default model `gpt-4o-mini` if user model not found
* Test token count as 0 if user history is not found or blank
* Add tests for remaining functions in `bot.py`
2025-01-07 23:05:22 +07:00
Vu Quoc Anh
2ea996c365 Update test_bot.py 2025-01-06 23:19:23 +07:00
Vu Quoc Anh
b8a938be42 Add slash command for remaining chat turns and reset
Add functionality to track and reset chat turns for each user and model, and implement a new slash command to check remaining chat turns.

- Add a new MongoDB collection `chat_turns` to track chat turns for each user and model.
- Implement functions to get, update, and reset remaining chat turns.
- Add a daily reset task to reset chat turns for all users and models.
- Add a new slash command `/remaining_turns` to check the remaining chat turns for each model.
- Update the help command to include the new `/remaining_turns` command.

- Add unit tests for the new MongoDB collection `chat_turns`.
- Add unit tests for the daily reset of chat turns.
- Add unit tests for the new slash command `/remaining_turns`.
- Add unit tests for the rate limits for each model.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Coder-Vippro/ChatGPT-Discord-Bot?shareId=XXXX-XXXX-XXXX-XXXX).
2025-01-06 21:53:28 +07:00
b30dce5a09 Remove unused imports from test_bot.py to clean up the code 2025-01-06 18:41:07 +07:00
ee82cfbcd8 Refactor test_bot.py to enhance test coverage and structure; update .gitignore to exclude additional files 2025-01-06 18:39:38 +07:00
Vu Quoc Anh
9fe39f4284 Update test_bot.py 2025-01-05 23:20:14 +07:00
Vu Quoc Anh
4ec47f5b6c Update test_bot.py 2025-01-05 23:18:13 +07:00
Vu Quoc Anh
3bd760c5a9 Update test_bot.py 2025-01-05 23:12:37 +07:00
6785b9d383 Initial commit with all files 2024-10-26 13:19:48 +07:00