262 Commits

Author SHA1 Message Date
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
5a04e7c7a5 Remove redundant synchronous test cases for search and web commands in test_bot.py 2025-02-25 09:32:10 +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 1.0.7 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
879d34f5b1 Remove GitHub Container Registry login step from workflow 2025-02-03 11:32:21 +07:00
42e7377665 Update GitHub Container Registry login action to use master branch 2025-02-03 11:18:02 +07:00
da1cfe4cd9 Add GitHub Container Registry login step to workflow 2025-02-03 10:25:38 +07:00
Vu Quoc Anh
5be8b3e43c Update main.yml 2025-02-03 10:02: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
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
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
dd198ac1df Update test_bot.py 2025-01-11 17:54:51 +07:00
Vu Quoc Anh
31550b2556 Update bot.py 2025-01-11 17:52:38 +07:00
Vu Quoc Anh
71b4b4ac73 Update requirements.txt 2025-01-09 21:50:23 +07:00
Vu Quoc Anh
a38156cd97 Update bot.py 2025-01-09 21:49:49 +07:00
Vu Quoc Anh
b2c71db135 Update test_bot.py 2025-01-08 12:30:27 +07:00
Vu Quoc Anh
24e7e250d9 Merge pull request #8 from Coder-Vippro/cauvang32/add-user-stat-command
Add slash command /user_stat to display user statistics
2025-01-07 23:29:21 +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
2ea996c365 Update test_bot.py 2025-01-06 23:19:23 +07:00
Vu Quoc Anh
9f0a256b0c Merge pull request #7 from Coder-Vippro/cauvang32/add-slash-command
Add slash command for remaining chat turns and reset
2025-01-06 23:16:27 +07:00
Vu Quoc Anh
6ebbe6c763 Update pull.yml 2025-01-06 23:13:33 +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
52afa9d41d Add environment variables for MongoDB URI and set deployment environment in GitHub Actions workflow 2025-01-06 18:51:44 +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
Vu Quoc Anh
6230e5e008 Update Dockerfile 2024-12-31 15:05:53 +07:00
7c4c58949c ok 2024-12-30 18:31: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
Vu Quoc Anh
6bd29626f9 Update main.yml 2024-12-30 17:48:52 +07:00
Vu Quoc Anh
4d3c4ff562 Update main.yml 2024-12-30 15:50:51 +07:00
Vu Quoc Anh
f1f11e76b4 Update main.yml 2024-12-30 15:44:33 +07:00
Vu Quoc Anh
68a2efd69f Update main.yml 2024-12-30 11:52:34 +07:00
Vu Quoc Anh
590fbec630 Update main.yml 2024-12-30 11:44:26 +07:00
4991f6886d Update message handling to set "role" to "system" only for non-"o1" models 1.0.6 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