Commit graph

140 commits

Author SHA1 Message Date
9545ca1218
fix(bot): mark messages as read after processing
Added functionality to mark messages as read after processing events to enhance usability and tracking. Also corrected formatting in help command documentation by fixing escape characters.
2024-06-16 18:58:50 +02:00
6e1a50c606
fix(bot): conditionally send error messages in debug mode
All checks were successful
Python Package CI/CD / Setup and Test (push) Successful in 41s
Python Package CI/CD / Publish to PyPI (push) Successful in 43s
Modified the RSS feed error handling to send error messages to the chat room only in debug mode, reducing unnecessary messages for non-debug environments. Incremented project version to 0.1.8 to reflect these updates and improvements.
2024-06-16 18:51:11 +02:00
788b15b151
feat(help): add backfill option to addfeed command
Enhanced the addfeed command to support an optional --backfill
parameter, allowing users to include all current entries when
bridging a new feed. This provides more flexibility in feed
management and ensures no entries are missed during the initial
setup.
2024-06-16 17:59:25 +02:00
ea6bdd5e2e
chore(release): bump version to 0.1.7
All checks were successful
Python Package CI/CD / Setup and Test (push) Successful in 42s
Python Package CI/CD / Publish to PyPI (push) Successful in 44s
Updated the project version in pyproject.toml to 0.1.7. This release includes minor updates and improvements to enhance stability and performance. No breaking changes were introduced.
2024-06-16 17:55:29 +02:00
ec505cfc3b
feat(bot): add operator property to RSSBot class
Introduced a new 'operator' property to the RSSBot class that retrieves the bot operator's name from the configuration file. Defaults to "your Matrix administrator" if not specified. Enhances configuration clarity and accessibility by allowing easy retrieval of the bot operator information.
2024-06-16 17:54:29 +02:00
5933e35f68
chore: bump version to 0.1.6 in pyproject.toml
All checks were successful
Python Package CI/CD / Setup and Test (push) Successful in 1m8s
Python Package CI/CD / Publish to PyPI (push) Successful in 1m6s
Updated the project version from 0.1.5 to 0.1.6 to reflect recent changes and improvements in the codebase. Ensures compatibility and clarity in the project's release management.
2024-06-16 08:41:06 +02:00
e28dcaf942
fix(bot): order RSS entries by published or updated date
Sorted feed entries by published date first, falling back to
updated date if published date is unavailable. This ensures
RSS entries are processed in a consistent temporal order,
improving the accuracy of feed updates and user notifications.
2024-06-16 08:40:36 +02:00
709144c339
feat: add feedback messages on feed removal
Enhances user experience by adding confirmation messages after removing a feed, whether by index or URL. This improvement helps users quickly verify that their intended action was successfully completed and mitigates confusion about the state of their feeds list.
2024-06-16 08:33:50 +02:00
79391d1cc5
feat(bot): support backfilling RSS feed history
All checks were successful
Python Package CI/CD / Setup and Test (push) Successful in 1m12s
Python Package CI/CD / Publish to PyPI (push) Successful in 1m5s
Added the ability to backfill messages from an RSS feed upon adding it to a room. Users can now add the `--backfill` flag when using the `addfeed` command to retrieve and post historical entries from the feed. This enhancement improves user experience by ensuring no important feed information is missed.
2024-06-16 08:28:29 +02:00
acaf7b17f4
chore: bump version to 0.1.4
All checks were successful
Python Package CI/CD / Setup and Test (push) Successful in 41s
Python Package CI/CD / Publish to PyPI (push) Successful in 45s
Update project version to 0.1.4 to reflect recent changes and improvements. This version increment ensures the package metadata is up to date.
2024-06-15 19:58:51 +02:00
08fbba0e0a
feat: add support for proxying feed requests
Introduced optional proxy configuration for fetching RSS feeds,
including support for using Tor SOCKS5 proxy for enhanced privacy.
Added properties to manage proxy settings and updated fetch
functionality to utilize the proxy when necessary. This helps route
requests through specified proxies, supporting privacy use cases
like accessing .onion URLs.
2024-06-15 19:58:15 +02:00
6727d8eabe
fix: improve logging clarity by showing room ID
Updated the logging statement in the RSSBot class to display room IDs instead of room objects when processing feeds. This change ensures that log entries are more informative and easier to understand, especially when debugging issues related to specific rooms. The inclusion of room IDs aids in quick identification and resolution of problems by providing a clear reference to the affected chat room.
2024-05-18 09:08:38 +02:00
b70309a726
feat: add CI/CD workflow for Python package
All checks were successful
Python Package CI/CD / Setup and Test (push) Successful in 40s
Python Package CI/CD / Publish to PyPI (push) Successful in 43s
Introduces a GitHub Actions workflow specifically designed for continuous integration and continuous deployment (CI/CD) of Python packages. This workflow triggers on `workflow_dispatch` events and tag pushes, encapsulating processes for setup/testing and publishing the Python package to PyPI. It utilizes a Node 20 Bookworm container for both setup/tests and publication steps, ensuring a consistent environment. Notably, it prepares the Python environment, installs dependencies, builds the package, and then publishes it to PyPI using securely stored PyPI tokens.

This addition streamlines the release process, automating the testing and deployment phases, and thereby enhancing reliability and efficiency in package management and distribution.
2024-05-18 09:01:25 +02:00
2752ace765
feat: Bump version to 0.1.3 for new features
Incremented the project version to 0.1.3 to prepare for the release of new functionalities and improvements. This version update signifies the addition of enhancements and possibly minor bug fixes, following our semantic versioning policy. This change is crucial for package management and distribution, ensuring users receive the latest updates and features promptly.
2024-05-18 08:59:14 +02:00
d8455ca1d3
feat: Add room-specific event type setting
Introduce the ability for users to override the default event type on a per-room basis in the Matrix RSS bot. By adding a new `eventtype` command and updating the help menu to include this command, users can now specify whether messages in a particular room should be sent as "text" or "notice". This feature provides greater flexibility and customization for room administrators, catering to diverse notification preferences and use cases. The implementation does not validate the event type beyond checking for "text" or "notice", ensuring simplicity in usage while relying on user input accuracy.

This change enhances the bot's versatility in different Matrix environments, allowing for more refined control over how feed updates are communicated within rooms.
2024-05-18 08:58:28 +02:00
7c8d957548
feat: add message event type configuration
Added support for configurable event types for sending messages, enabling use of either "text" or "notice" message types as per user preference. Additionally, this update brings along improvements including code cleanup, updated dependencies to improve functionality and fix potential security issues, and reorganization of example configuration files into a more structured directory. Significant refactorings standardize async task creations and remove unused imports, streamlining the codebase for better maintainability and performance.

- Introduced `EventType` in `config.dist.ini` to allow users to specify the desired event type for outbound messages.
- Upgraded dependency versions in `pyproject.toml`, adding `future` for forward compatibility.
- Removed the deprecated `rssbot-pantalaimon.service` and unused image/file send functions in `bot.py`, focusing on core functionalities.
- Reorganized `pantalaimon.example.conf` into `contrib` directory for better project structure.
- Simplified logging and callback handling, removing redundant code paths and improving code readability.
- Bumped project version to 0.1.2, paving the way for new features and fixes.

This enhancement is aimed at providing users with greater flexibility in how messages are sent, accommodating different use cases and preferences.
2024-05-17 16:49:27 +02:00
127cfc55e7
feat(dependabot): enable daily pip package updates
Added a Dependabot configuration file to automate daily updates for Python packages. This change ensures the project dependencies are regularly checked for updates, encouraging the use of the latest, most secure versions of dependencies. Regular updates help to maintain the project's security posture and reduce the risk of vulnerabilities.
2024-05-17 16:16:18 +02:00
02d7441f38
refactor: streamline entry point and update version
Reorganized the script's main execution logic into a `main` function for clearer entry point definition and better maintainability. Updated the project version to 0.1.1, reflecting these changes alongside minor fixes. Adjusted the script reference in `pyproject.toml` to align with the new entry point structure, ensuring proper package execution as a console script. This refactor enhances code readability and supports more flexible future updates.
2024-05-03 15:11:25 +02:00
3216df5bbb
feat: enhance README with badges and detailed docs
- Added informative badges for versioning, Python versions, license, and the latest commit to enhance project visibility and credibility.
- Expanded documentation to include detailed installation, usage instructions, and added a comprehensive guide on configuring and running the bot, emphasizing the ease of set up and operation.
- Recommended the use of pantalaimon for E2E encryption support, catering to user security concerns.
- Included commands for adding, listing, and removing feeds, ensuring users have clear guidance on bot interaction.

This update makes the project more accessible and user-friendly, encouraging adoption and contribution by providing all necessary information upfront.

fix: ignore build directory in .gitignore

- The `build/` directory is now ignored, preventing compiled files or artifacts from being tracked in the repository, ensuring a cleaner project structure.
2024-05-03 15:03:45 +02:00
2729a29807
Improved timestamp handling 2024-03-02 18:03:07 +01:00
db37f31b93
Added error handling for feed processing errors
This commit adds error handling for feed processing errors in the RSS
bot's feed polling logic. The previous version was failing to handle
exceptions that were thrown during the feed parsing process, which could
lead to unpredictable behavior and potential data corruption. This new
version catches any exceptions that occur during the feed parsing step
and logs them, preventing the bot from becoming stuck in an infinite
loop due to these errors.

The changes include a try/except block around the feed parsing code,
where any exceptions are caught and logged using Python's logging
module. The bot's state is not modified when there is an error during
feed processing, which ensures that the bot does not become stuck in an
infinite loop due to errors. Additionally, the commit includes a new
logger method for logging exceptions, which helps identify any issues
with the feed parsing process and prevents them from affecting the bot's
overall performance.

This commit has several benefits:

* It improves the reliability of the RSS bot by handling errors that
could occur during feed processing and preventing the bot from becoming
stuck in an infinite loop due to these errors.
* It makes it easier for users to troubleshoot issues with the RSS bot,
since error messages are now being logged and can be easily identified.
* It helps to prevent data corruption by ensuring that the bot's state
is not modified when there is an error during feed processing.
2024-03-02 17:51:15 +01:00
ec815b1487
Improve feed list handling & ensure unique feeds
This commit improves the handling of the feed list by removing
duplicate entries and ensuring that each feed is only listed once. This
change was made to improve the overall stability and performance of the
RSS bot, as well as to simplify the code and make it easier to maintain.
Additionally, this commit addresses a bug where the `listfeeds` command
would not work correctly if there were multiple feeds with the same URL.

This commit also includes an optimization that reduces the number of
network requests made by the RSS bot when fetching feed content. This
should improve the overall performance and reduce the load on servers
hosting RSS feeds.
2024-03-02 17:44:42 +01:00
bd6210bb4a
Add new "removefeed" command to
support deleting feeds in the Matrix RSS Bot

This commit adds a new "removefeed" command to the Matrix RSS Bot,
which allows users to delete existing RSS feeds from the bot's list of
subscribed feeds. The "removefeed" command is added to the "__init__.py"
file in the "matrix_rssbot/classes/commands" directory.
2024-03-02 17:39:39 +01:00
3b95dc0d3e
Splitting feed processing off into async task 2024-03-02 17:13:04 +01:00
8ea8c9208a
Refactor bot state management logic
This commit refactors the code handling bot state management to
improve readability and modularity. The new implementation uses a more
structured approach to handling different types of events, making it
easier to reason about and maintain. Additionally, it fixes an issue
where the bot was not properly handling errors when putting state in
rooms.

This change should improve the overall stability and performance of the
RSS bot, as well as make it easier for developers to understand and work
with the codebase.
2024-03-02 16:24:47 +01:00
ebb9b245a8
Remove unused Join callback 2024-03-02 15:50:59 +01:00
f11a461ad9
Remove unused Join callback 2024-03-02 15:50:51 +01:00
967d738e64
Created RSSBot 2024-03-02 15:31:14 +01: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