Commit graph

128 commits

Author SHA1 Message Date
819e4bbaae
feat: Prepare for 0.3.9 release and update copyright
- Initialized preparations for the unreleased 0.3.9 version in the changelog.
- Updated copyright information to include 2024 and added Private.coffee Team alongside Kumi Mitterer to reflect the collaborative nature of the project going forward.
- Incremented the project version to 0.3.9.dev0 in pyproject.toml to align with upcoming development efforts.
- Modified all references from Kumi's personal repo to the Private.coffee Team's repo in README.md, LICENSE, and pyproject.toml, ensuring future contributions and issues are directed to the correct repository. This change facilitates a broader collaboration platform and acknowledges the team's growing involvement in the project's development.

These updates are critical for the upcoming development phase and for accurately representing the collaborative efforts behind the project.
2024-04-23 07:58:34 +02:00
94a9881465
feat(changelog): update for v0.3.7/0.3.8 enhancements
All checks were successful
Python Package CI/CD / Setup and Test (push) Successful in 1m20s
Python Package CI/CD / Publish to PyPI (push) Successful in 37s
Updated the CHANGELOG.md to document enhancements in versions 0.3.7 and 0.3.8, including updates to URLs in the pyproject.toml and migration of the build pipeline to Forgejo Actions. These changes aim to improve project dependency management and streamline the CI/CD process, ensuring a more efficient development workflow.
2024-04-15 19:31:27 +02:00
6236142a21
chore: bump version to 0.3.8 and update URLs
Bumped project version to 0.3.8 for the next release cycle. Updated Homepage and Bug Tracker URLs to reflect the new hosting location, aiming for improved accessibility and collaboration. Additionally, introduced a Source Code URL for direct access to the repository, facilitating developers' engagement and contributions.
2024-04-15 19:29:23 +02:00
66d4dff72d
feat(release): streamline PyPI publishing process
All checks were successful
Python Package CI/CD / Setup and Test (push) Successful in 1m17s
Python Package CI/CD / Publish to PyPI (push) Successful in 39s
Simplified the publishing to PyPI steps in the release workflow by consolidating the Python environment setup, tool installation, package building, and publishing into a single job. This change makes the workflow more efficient and reduces the number of steps required to publish a package. It ensures that the environment setup, dependencies installation, package building, and publishing are done in one go, which can help in minimizing potential issues arising from multiple, separate steps.

This approach leverages the existing Python and PyPI tools more effectively and could potentially shorten the release cycle time. It also makes the workflow file cleaner and easier to maintain.
2024-04-15 19:22:07 +02:00
9110910b11
fix: use posix shell syntax for activation
Some checks failed
Python Package CI/CD / Setup and Test (push) Successful in 1m29s
Python Package CI/CD / Publish to PyPI (push) Failing after 18s
Switched the virtual environment activation command to be compliant with POSIX shell syntax. The previous `source` command is replaced with `.`, making the script more broadly compatible with different shell environments without requiring bash specifically. This change ensures greater portability and compatibility of the release workflow across diverse CI/CD execution environments.
2024-04-15 19:11:49 +02:00
c33efd2e73
feat(workflows): Use python3 for venv and version check
Some checks failed
Python Package CI/CD / Setup and Test (push) Failing after 21s
Python Package CI/CD / Publish to PyPI (push) Failing after 10m58s
Updated the GitHub Actions workflow in `.forgejo/workflows/release.yml` to explicitly use `python3` instead of `python` for both version checking and virtual environment setup. This change ensures compatibility and clarity across environments where `python` might still point to Python 2.x, preventing potential conflicts and erasing ambiguity. The adjustment aligns with modern best practices, acknowledging the widespread transition to Python 3 and its tooling.
2024-04-15 18:58:44 +02:00
d57a7367ab
feat(workflows): Switch base image to node:20-bookworm
Some checks failed
Python Package CI/CD / Setup and Test (push) Failing after 29s
Python Package CI/CD / Publish to PyPI (push) Failing after 16s
Updated the CI/CD pipeline in `.forgejo/workflows/release.yml` to utilize the `node:20-bookworm` image instead of `python:3.10`. This necessitated adding steps for installing Python dependencies, given the switch to a Node.js-based image. This change accommodates projects that require both Node.js and Python environments for their setup and publishing processes, ensuring better compatibility and flexibility in handling mixed-technology stacks.

This update enhances our pipeline's capability to manage dependencies more efficiently across different technologies, catering to the evolving needs of our projects.
2024-04-15 18:53:37 +02:00
037acf34b2
Version bump
Some checks failed
Python Package CI/CD / Publish to PyPI (push) Failing after 1m11s
Python Package CI/CD / Setup and Test (push) Failing after 11m51s
2024-04-15 18:18:43 +02:00
589c8395b7
ci: remove redundant GitLab CI configuration
Removed the entire `.gitlab-ci.yml`, discontinuing the GitLab CI/CD process. This change reflects a shift toward consolidating our CI/CD workflows, potentially to another platform or to streamline our current processes. It's essential to assess the impacts on project deployment and distribution, especially regarding PyPI publishing previously handled by this GitLab CI configuration.
2024-04-15 18:12:25 +02:00
35db931f4a
feat: Add CI/CD workflow and support badge
Introduced a new CI/CD GitHub Actions workflow for automated testing and publishing to PyPI, targeting Python 3.10 containers. This setup ensures code is tested before release and automates the distribution process to PyPI whenever a new tag is pushed. Additionally, updated README.md to include a support badge from private.coffee, encouraging community support and visibility.

This enhancement simplifies the release process, improves code quality assurance, and fosters community engagement by providing a direct way to support the project.
2024-04-15 18:11:42 +02:00
1e59c90df2
feat: Bump version to 0.3.6 with message type fix
Upgraded project version to 0.3.6 to introduce a critical fix for message type detection failing on certain messages. This version also amends the package directory structure for improved organization, moving from `src/gptbot` to just `gptbot`. Additionally, updated the CHANGELOG to reflect this fix and organizational change, ensuring that it stays current with the project's progress.

- Fixes message type detection issue
2024-04-11 07:41:52 +02:00
7edc69897b
Version bump to 0.3.5 2024-04-11 07:31:05 +02:00
cece8cfb24
feat(bot): enhance event processing robustness
Improve event type determination in the message fetching logic by adding try-except blocks to handle AttributeError and KeyError exceptions gracefully. This change allows the bot to continue processing other events if it encounters an event without a recognizable type or msgtype, avoiding premature termination and enhancing its ability to process diverse event streams more robustly. This approach also includes logging unprocessable events for debugging purposes, providing clearer insights into event handling anomalies.

Fixes #5
2024-04-11 07:20:44 +02:00
7e64dd5245
feat: Update repository URLs in README
Updated the repository URLs for the matrix-gptbot installation
instructions and cloning directions in the README. The change points to
a new hosting location on `git.private.coffee` from the previous
`kumig.it`. This adjustment ensures users access the most current
version of the code and contributes to a streamlined setup process by
guiding them directly to the updated repository.

This update is crucial for users looking to install the bot or
contribute to its development, ensuring they're interfacing with the
latest version and accurate information.
2024-04-01 07:48:52 +02:00
0289100a2d
feat(changelog): Updated changelog 2024-04-01 07:47:04 +02:00
a9c23ee9c4
feat: implement room state retrieval and
conditional avatar update

Introduces a new method `get_state_event` to asynchronously retrieve
state events for a given room and event type, enhancing the bot's
ability to fetch specific room states before performing actions. This
functionality is leveraged to conditionally update room avatars only if
they are not already set, reducing unnecessary updates and improving
efficiency. Additionally, the commit includes minor formatting
adjustments for better code readability.

Refactoring the avatar updating process to assess the current state
before action prevents redundant network calls and aligns with optimal
resource usage practices, contributing to a smoother operation and
potentially reducing the workload on the server.
2024-04-01 07:42:44 +02:00
d5a96aebb6
Version bump 2024-02-18 11:03:13 +01:00
c47f947f80
Refine message filtering in bot event processing
Enhanced event processing in the bot's message retrieval logic to
improve message relevance and accuracy. Changes include accepting all
'gptbot' prefixed events, refining handling of 'ignoreolder' command
with exact match rather than starts with, and now passing through
'custom' commands that start with '!'. The default behavior now excludes
notices unless explicitly included. This update allows for more precise
command interactions and reduces clutter from irrelevant notices.
2024-02-18 10:49:27 +01:00
2d564afd97
Fix parameter passing in chat response calls
Standardize the passing of 'messages' argument across various calls to
generate_chat_response method to ensure consistency and prevent
potential bugs in the GPT bot's response generation. The 'model'
parameter in one instance has been corrected to 'original_model' for
proper context loading. These changes improve code clarity and maintain
the intended message flow within the bot's conversation handling.
2024-02-15 18:11:19 +01:00
10b74187eb
Optimize chat model and message handling
Refactored initialization of OpenAI APIs to correct a redundancy and
enhance clarity. Improved content extraction logic for robust handling
of various message types. Enhanced logging and messaging by including
user and room context, facilitating better debugging and user
interaction. Extended `send_message` to support custom message types,
allowing for richer interaction within the chat ecosystem. Updated
hardcoded chat models to leverage newer versions for potentially more
accurate tool overrides. Fixed async method call in recursion handling
to ensure proper response generation. Finally, increased message history
retrieval limit based on the `max_messages` attribute for more effective
conversation context.

Resolves issues with message context and enhances user feedback during
operations.
2024-02-14 17:45:57 +01:00
b65dcc7d83
Finalize release version 0.3.3
Removed the '-dev' suffix from the project version indicating the transition from a development state to the official release of version 0.3.3. This version bump aligns with the completion of features and fixes slated for this iteration.
2024-01-26 09:31:12 +01:00
fc92ac1ebb
Clarify bot's E2E encryption caveat
Update the README to specify that issues with file attachments primarily occur in non-encrypted rooms when the same user operates the bot in both encrypted and non-encrypted rooms. This detail aims to inform users of potential pitfalls more precisely when setting up the bot with end-to-end encryption enabled.
2024-01-26 09:20:30 +01:00
2b33f681cd
Update CHANGELOG 2024-01-26 09:18:40 +01:00
c4e23cb9d3
Fix recursion errors in OpenAI class
Improved the error handling in the OpenAI class to prevent infinite recursion issues by retaining the original chat model during recursive calls. Enhanced logging within the recursion depth check for better debugging and traceability. Ensured consistency in chat responses by passing the initial model reference throughout the entire call stack. This is crucial when fallbacks due to errors or tool usage occur.

Refactored code for clarity and readability, ensuring that any recursion retains the original model and tool parameters. Additionally, proper logging and condition checks now standardize the flow of execution, preventing unintended modifications to the model's state that could lead to incorrect bot behavior.
2024-01-26 09:17:01 +01:00
87173ae284
Enable per-room model overrides and clean up code
Introduced the ability to specify and retrieve different OpenAI models on a per-room basis, thereby allowing enhanced customization of the bot's response behavior according to the preferences for each room. Cleaned up code formatting across the bot implementation files for improved readability and maintainability. Additional logic now checks for model overrides when generating responses, ensuring the correct model is used as configured.

Refactors include streamlined database and API initializations and a refined method for processing message formatting to accommodate images, texts, and system messages consistently. This change differentiates default behavior from room-specific configurations, catering to diverse user needs without compromising on default settings.
2024-01-26 09:11:39 +01:00
ad0d694222
Update docs
Updated README to better describe issues related to end-to-end encryption affecting file attachments in certain circumstances. Updated CHANGELOG.
2023-12-29 23:01:03 +01:00
e6bc23e564
Implement recursion check in response generation
Added a safety check to prevent infinite recursion within the response generation function. When `use_tools` is active, the code now inspects the call stack and terminates the process if a certain recursion depth is exceeded. This ensures that the code is robust against potential infinite loops that could block or crash the service. A default threshold is set with a TODO for revisiting the hard-coded limit, and the recursion detection logs the occurrence for easier debugging and maintenance.

Note: Recursion limit handling may require future adjustments to the `allow_override` parameter based on real-world feedback or testing.
2023-12-29 22:56:22 +01:00
0acc1456f9
Enable tool emulation and improved error logging
Introduced a configuration option to emulate tool usage in models that do not natively support tools, facilitating the use of such functionality without direct model support. This should benefit users aiming to leverage tool-based features without relying on specific AI models. Additionally, enhanced error logging in the GPTBot class by including traceback details, aiding in debugging and incident resolution.

- Added `EmulateTools` option in the `config.dist.ini` for flexible tool handling.
- Enriched error logging with stack traces in `bot.py` for better insight during failures.
2023-12-29 22:46:19 +01:00
c7e448126d
Enhanced debug logging in bot initialization
Introduced additional debug log entries in the `GPTBot` class to provide clarity on the initial sync and callback setup process. This helps with monitoring and troubleshooting during the early stages of bot deployment, making it easier to pinpoint issues around bot startup and room joining behavior.
Bumped project version to 0.3.3-dev to signal ongoing development.
2023-12-29 20:37:42 +01:00
f206aa8f0f
Warn against using E2E encryption due to bugs
Updated README to caution users about the current issues with end-to-end encryption, specifically that it can disrupt file uploads and downloads. The aim is to prevent user frustration and potential data loss until a fix is implemented.
2023-12-29 20:30:46 +01:00
63e52169a3
Fix file handling in encrypted rooms and update dependencies
Resolved an issue that prevented the bot from responding when files were uploaded to encrypted rooms by implementing a workaround. The bot now tries to generate text from uploaded files and logs errors without interrupting the message flow. Upgraded the Pantalaimon dependency to ensure compatibility. Also, refined the message processing logic to handle different message types correctly and made the download_file method asynchronous to match the matrix client's expected behavior. Additionally, updated the changelog and bumped the project version to reflect these fixes and improvements.

Known issues have been documented, including a limitation when using Pantalaimon where the bot cannot download/use files uploaded to encrypted rooms.
2023-12-14 18:10:12 +01:00
e1630795ba
Update changelog 2023-12-07 19:44:19 +01:00
2b7813f715
Make "gptbot -v" actually output the correct version 2023-12-07 19:43:30 +01:00
04662fc1f3
Internal version bump 2023-12-07 19:43:17 +01:00
62982ce23b
Remove uploading of keys 2023-12-07 16:39:04 +01:00
d4cf70b273
Fix handling of KeysUploadError 2023-12-07 16:38:47 +01:00
2211edc25a
Fix missing " in pyproject.toml 2023-12-07 16:36:01 +01:00
f6b15ea6b9
version bump, changelog 2023-12-07 16:33:26 +01:00
ab62ecb877
fix: incorrect variable name use in newroom tool 2023-12-07 16:31:19 +01:00
11f11a369c
Enhanced GPTbot's capabilities and installation method
Upgraded bot features to interpret and respond to text, image, and voice prompts in Matrix rooms using advanced OpenAI models, including vision preview and text-to-speech. Streamlined installation process with bot now available via PyPI, simplifying setup and extending accessibility. Eliminated planned features section, signaling a shift towards realized functionalities over prospective development.

Configured Pantalaimon as an optional dependency to enable bot use in E2EE rooms while maintaining compatibility with non-encrypted rooms. Removed trackingmore dependency, indicating a refinement in the feature set towards core functionalities. Version bumped to 0.3.0, signifying major enhancements over previous iteration.
2023-12-05 14:50:37 +01:00
35f51e1201
Added systemd service for Pantalaimon integration
Introduced a new systemd service configuration for GPTbot to ensure Pantalaimon starts as a background process on system boot, maintaining persistent Matrix encryption handling. Ensures seamless restarts and network dependency management for improved reliability.
2023-12-05 14:18:18 +01:00
57b68ef3e3
Enhance Pantalaimon integration and config
Integrated Pantalaimon support with updated configuration instructions and examples, facilitating secure communication when using the Matrix homeserver. The .gitignore is now extended to exclude a Pantalaimon configuration file, preventing sensitive information from accidental commits. Removed encryption callbacks and related functions as the application leverages Pantalaimon for E2EE, simplifying the codebase and shifting encryption responsibilities externally. Streamlined dependency management by removing the requirements.txt in favor of pyproject.toml, aligning with modern Python practices. This change overall improves security handling and eases future maintenance.
2023-12-05 10:09:14 +01:00
4eb33a3c0a
Fix allowed_users property in GPTBot
Resolved a syntax error in the allowed_users property within the GPTBot class by adding the missing 'self' parameter. This correction ensures the proper functioning of the property method, enabling the bot to correctly retrieve the list of users authorized to use it.
2023-12-05 08:36:21 +01:00
1319371446
Handle mp3 attachments as audio messages
Extended the condition for the audio message handling in the chatbot to recognize MP3 audio files sent as file attachments. This ensures that MP3 files will be properly processed as audio messages, improving the bot's media handling capabilities. This is just a test at this point, and may be rolled back.
2023-12-05 08:18:39 +01:00
8a77c326aa
Refactor bot properties to be dynamic
Migrated several hardcoded bot configuration settings to dynamic properties with fallbacks, enhancing flexibility and customization. The properties now read from a configuration file, allowing changes without code modification. Simplified the instantiation logic by removing immediate attribute setting in favor of lazy-loaded properties. Additionally, prepared to segregate OpenAI-related settings into a dedicated class (noted with TODO comments).

Note: Verify the presence of necessary configuration parameters or include defaults to prevent potential runtime issues.
2023-12-04 18:44:19 +01:00
31f001057a
Enhance Wikipedia tool flexibility
Added options to extract specific info and summarize content from Wikipedia pages within the gptbot's Wikipedia tool. The 'extract' option enables partial retrieval of page data based on a user-defined string, leveraging the bot's existing chat API for extraction. The 'summarize' option allows users to get concise versions of articles, again utilizing the bot's chat capabilities. These additions provide users with more granular control over the information they receive, potentially reducing response clutter and focusing on user-specified interests.
2023-12-04 18:07:57 +01:00
c1986203e8
Ensure consistent user ID typing and improve logging
Cast user objects to strings to standardize ID handling across API calls. Enhanced logging statements now include user and room context, providing better traceability for response generation. Also, refined error handling for API token limits by falling back to an altered response flow, removing tool roles from messages when a max token error occurs, before reattempting. This targets more graceful handling of response generation without tool assistance when constraints are hit.
2023-12-04 18:07:19 +01:00
eccca2a624
Handle max tokens exception in chat response generation
Introduced error handling for the 'max_tokens' exception during chat response generation. In cases where the maximum token count is exceeded, the bot now falls back to a no-tools response, avoiding the halt of conversation. This ensures a smoother chat experience and persistence in responding, even when a limit is reached. Any other exceptions will still be raised as before, maintaining error transparency.
2023-11-30 14:18:47 +01:00
670667567e
Handle key upload errors and refine tool flow responses
- Introduce error handling for the keys upload process, logging failures to assist with troubleshooting.
- Improve exception handling in the OpenAI class by returning a more informative response based on the exception arguments if available.
- Replace a return statement in the Newroom tool with an exception raise to standardize tool action termination and provide clearer flow control.

Resolves issue with silent key upload failures. Refines response and control flow for better clarity and debugging.
2023-11-29 20:31:07 +01:00
75360d040a
Introduce Async Enhancements and New Room Tool
Enabled asynchronous key upload in the roommember callback to improve efficiency. Fixed the chat response generation by properly referencing the event sender rather than the room ID, aligning user context with chat messages. Corrected the user parameter misuse in the OpenAI class to utilize the room ID. Extended the toolkit to include a 'newroom' feature for creating and setting up new Matrix rooms, thereby enhancing bot functionality.

This commit significantly improves bot response times and contextual accuracy while interacting within rooms and adds a valuable feature for users to create rooms seamlessly.
2023-11-29 15:48:56 +01:00