Commit Graph

74 Commits

Author SHA1 Message Date
9c180bdd89 Refactor OpenAI utilities and remove Python executor
- Removed the `analyze_data_file` function from tool definitions to streamline functionality.
- Enhanced the `execute_python_code` function description to clarify auto-installation of packages and file handling.
- Deleted the `python_executor.py` module to simplify the codebase and improve maintainability.
- Introduced a new `token_counter.py` module for efficient token counting for OpenAI API requests, including support for Discord image links and cost estimation.
2025-10-02 21:49:48 +07:00
ac6bb8c582 refactor: simplify logging setup by removing file handlers and using console output only 2025-08-25 17:47:50 +07:00
7b19756932 refactor: optimize memory usage by removing unnecessary global variables and implementing cleanup mechanisms 2025-08-15 00:12:15 +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
80713ac94f feat: Implement data processing and visualization utilities
- Added `data_utils.py` for analyzing and visualizing data from CSV/Excel files.
- Introduced asynchronous processing to handle file uploads without blocking.
- Enhanced error handling for file reading and data conversion.
- Implemented various chart types (pie, bar, scatter, histogram, line) based on user queries.
- Added metadata management for generated charts, including cleanup of old charts.

feat: Create reminder management system for Discord

- Added `reminder_utils.py` to manage user reminders in Discord.
- Implemented functionality to add, retrieve, delete, and process reminders.
- Integrated timezone handling for accurate reminder scheduling.
- Developed a loop to check for due reminders and send notifications.
- Included parsing for various time formats to set reminders.
2025-03-19 23:45:28 +07:00
9069d16f19 Add logging configuration and enable webhook logging in config.py; update Dockerfile to include gcc and c++ dependencies 2025-03-15 13:09:15 +07:00
8136aa2dda Refactor Dockerfile for multi-stage build, update dependencies in requirements.txt, and add image generation and database handler modules 2025-03-13 22:10:57 +07:00
826d3e3fe4 Update NORMAL_CHAT_PROMPT to clarify C++ usage for calculations 2025-03-12 11:48:32 +07:00
1d01f1827f Update NORMAL_CHAT_PROMPT to specify C++ for code calculations 2025-03-12 11:34:20 +07:00
00219d120f Update NORMAL_CHAT_PROMPT to include tool names and clarify response guidelines 2025-03-11 21:30:23 +07:00
fd11b03bc1 Remove auto deploy to server. 2025-03-09 22:09:36 +07:00
d3358eaa5f Remove Flask import from bot implementation 2025-03-06 21:07:18 +07:00
d0287e7b9f Remove Flask server and health-check endpoint from bot implementation and update requirements 2025-03-06 21:00:32 +07:00
6419a8e1d4 Skip SSL certificate verification in web scraping and improve text sorting logic 2025-02-26 17:41:17 +07:00
295bee8727 2025-02-26 17:09:06 +07:00
9c260fde71 Add blacklist check decorator for command execution 2025-02-26 07:41:08 +07:00
7081b27a93 Defer interaction response in stop command and update permission message handling 2025-02-25 23:18:57 +07:00
e92c37dcaf Implement user task management and add command to stop user processes 2025-02-25 23:06:28 +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
a80b4c64a4 Add g++ compiler and build-essential to Dockerfile dependencies 2025-02-25 18:15:16 +07:00
49beaca848 Add PDF analysis prompt and increase token limit for API messages 2025-02-25 10:35:42 +07:00
65e3a23df2 Ensure ADMIN_ID comparison is consistent by converting user IDs to strings 2025-02-25 09:55:14 +07:00
2f199c78c1 Change ADMIN_ID to string type for consistency in bot.py 2025-02-25 09:26:15 +07:00
8542819597 Add PyPDF2 dependency and update README with ADMIN_ID configuration, add pdf function for only whitelisted user, add blacklist (aka bot ban). 2025-02-25 09:21:05 +07:00
f9e3e61310 Update bot.py to use asynchronous calls for get_history and get_user_model functions 2025-02-05 23:27:29 +07:00
bc57638638 Refactor bot.py to improve asynchronous handling and enhance message processing 2025-02-05 22:46:18 +07:00
0343599b29 Update save_user_model and save_history calls to be asynchronous 2025-02-03 11:49:43 +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
8c8bcc62d8 Refactor MongoDB interactions to use AsyncIOMotorClient for improved performance; update database functions to be asynchronous and add motor dependency 2025-02-03 09:14:41 +07:00
bce901ed9f Update bot configuration and add support for new model; modify timeout settings and improve help command localization 2025-02-03 08:59:40 +07:00
59634cce13 Add latency check to health endpoint and remove bot prefix command and heartbeat timeout 2025-01-23 12:42:02 +07:00
Vu Quoc Anh
6fa264fe75 Update bot.py 2025-01-11 19:37:09 +07:00
Vu Quoc Anh
31550b2556 Update bot.py 2025-01-11 17:52:38 +07:00
Vu Quoc Anh
a38156cd97 Update bot.py 2025-01-09 21:49:49 +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
67e806a901 Add slash command /user_stat to display user statistics
Add a new slash command `/user_stat` to fetch and display user statistics.

* **bot.py**
  - Add a new slash command `/user_stat` to fetch and display the current input token, output token, and model for the user.
  - Retrieve the user's history to calculate the input and output tokens.
  - Fetch the model from the database.
  - Update the `help_command` to include the new `/user_stat` command.

* **README.md**
  - Add documentation for the new `/user_stat` command.

---

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-07 22:32:44 +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
36c94d64a6 Improve history trimming logic to remove oldest messages first for better token management 2024-12-30 18:31:06 +07:00
4991f6886d Update message handling to set "role" to "system" only for non-"o1" models 2024-12-28 21:54:40 +07:00
a5d6f1e80d Reset "role" to "system" for messages not designated as "developer" in message handling 2024-12-28 21:41:46 +07:00
f0ad2e061d Enhance image handling in model "o1" by adding 'details' key and improve error message for rate limit 2024-12-28 18:18:39 +07:00
08869978f9 Rename "system" role to "developer" for model "o1" and refine image handling logic 2024-12-28 17:53:48 +07:00
acdbdf28f0 Reduce number of search results returned by Google custom search from 3 to 2 2024-12-28 17:28:33 +07:00
57f9d642bb Reduce search results 2024-12-25 10:34:34 +07:00
51a243f9aa Reduce number of search results returned by Google custom search from 5 to 3 2024-12-10 21:17:06 +07:00
503961ba88 Update search functionality to include scraped content and refine prompts 2024-12-10 20:59:37 +07:00
797c1e9e7c Remove user history entry upon error handling in bot 2024-12-03 15:45:39 +07:00
36b824d63d Start Flask server in a separate thread during bot initialization 2024-11-30 21:48:14 +07:00
ec81826a2f Update health check implementation and expose new endpoint in Docker setup 2024-11-30 21:40:59 +07:00