matrix-rasa

A rasa bot for matrix based on the data from matrix.org
git clone git://archive.git.mtrnord.blog/MTRNord/matrix-rasa.git
Log | Files | Refs | LICENSE

commit e3450fff21dac4a31f769b700b8e2d6a7b818c35
Author: MTRNord <mtrnord1@gmail.com>
Date:   Thu, 18 Jan 2024 13:30:19 +0100

Initial commit

Diffstat:
A.github/workflows/test.yml | 29+++++++++++++++++++++++++++++
A.gitignore | 8++++++++
A.python-version | 1+
A.vscode/settings.json | 4++++
ALICENSE | 201+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aactions/__init__.py | 0
Aactions/actions.py | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Aconfig.yml | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acredentials.yml | 33+++++++++++++++++++++++++++++++++
Adata/nlu.yml | 40++++++++++++++++++++++++++++++++++++++++
Adata/rules.yml | 19+++++++++++++++++++
Adata/stories.yml | 35+++++++++++++++++++++++++++++++++++
Adomain.yml | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aendpoints.yml | 42++++++++++++++++++++++++++++++++++++++++++
Aknowledge_base_data.json | 715+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/matrix_org_to_json.py | 38++++++++++++++++++++++++++++++++++++++
Ascripts/requirements.txt | 3+++
Atests/test_stories.yml | 22++++++++++++++++++++++
18 files changed, 1368 insertions(+), 0 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: Tests +on: + push: + pull_request: + +jobs: + training-testing: + name: Training and Testing + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Rasa Train and Test GitHub Action + uses: RasaHQ/rasa-train-test-gha@main + with: + requirements_file: requirements.txt + data_validate: true + rasa_train: true + cross_validation: true + rasa_test: true + test_type: all + publish_summary: true + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Upload model + if: github.ref == 'refs/heads/main' + uses: actions/upload-artifact@master + with: + name: model + path: models +\ No newline at end of file diff --git a/.gitignore b/.gitignore @@ -0,0 +1,7 @@ +.mypy_cache +models +results +__pycache__ +.rasa +graph.html +story_graph.dot +\ No newline at end of file diff --git a/.python-version b/.python-version @@ -0,0 +1 @@ +3.10 diff --git a/.vscode/settings.json b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "remote.autoForwardPorts": false +} +\ No newline at end of file diff --git a/LICENSE b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/actions/__init__.py b/actions/__init__.py diff --git a/actions/actions.py b/actions/actions.py @@ -0,0 +1,53 @@ +from rasa_sdk.knowledge_base.storage import InMemoryKnowledgeBase +from rasa_sdk.knowledge_base.actions import ActionQueryKnowledgeBase +from rasa_sdk.executor import CollectingDispatcher +from typing import Text + + +class ActionMyKB(ActionQueryKnowledgeBase): + def __init__(self): + # load knowledge base with data from the given file + knowledge_base = InMemoryKnowledgeBase("knowledge_base_data.json") + + # overwrite the representation function of the hotel object + # by default the representation function is just the name of the object + knowledge_base.set_representation_function_of_object( + "matrix_room", lambda obj: "https://matrix.to/#/" + obj["matrix_room"] + ) + knowledge_base.set_key_attribute_of_object("client", "name") + knowledge_base.set_key_attribute_of_object("provider", "name") + + super().__init__(knowledge_base) + + def utter_attribute_value( + self, + dispatcher: CollectingDispatcher, + object_name: Text, + attribute_name: Text, + attribute_value: Text, + ): + """ + Utters a response that informs the user about the attribute value of the + attribute of interest. + + Args: + dispatcher: the dispatcher + object_name: the name of the object + attribute_name: the name of the attribute + attribute_value: the value of the attribute + """ + # TODO: Make this work with the true/false lists of features and make it pretty + if attribute_value: + dispatcher.utter_message( + text=( + f"'{object_name}' has the value '{attribute_value}' " + f"for attribute '{attribute_name}'." + ) + ) + else: + dispatcher.utter_message( + text=( + f"Did not find a valid value for attribute '{attribute_name}' " + f"for object '{object_name}'." + ) + ) diff --git a/config.yml b/config.yml @@ -0,0 +1,70 @@ +# The config recipe. +# https://rasa.com/docs/rasa/model-configuration/ +recipe: default.v1 + +# The assistant project unique identifier +# This default value must be replaced with a unique assistant name within your deployment +assistant_id: matrix_helper_bot + +# Configuration for Rasa NLU. +# https://rasa.com/docs/rasa/nlu/components/ +language: en + +pipeline: +# # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model. +# # If you'd like to customize it, uncomment and adjust the pipeline. +# # See https://rasa.com/docs/rasa/tuning-your-model for more information. +# - name: WhitespaceTokenizer +# - name: RegexFeaturizer +# - name: LexicalSyntacticFeaturizer +# - name: CountVectorsFeaturizer +# - name: CountVectorsFeaturizer +# analyzer: char_wb +# min_ngram: 1 +# max_ngram: 4 +# - name: DIETClassifier +# epochs: 100 +# constrain_similarities: true +# - name: EntitySynonymMapper +# - name: ResponseSelector +# epochs: 100 +# constrain_similarities: true +# - name: FallbackClassifier +# threshold: 0.3 +# ambiguity_threshold: 0.1 + - name: SpacyNLP + model: en_core_web_trf + - name: SpacyTokenizer + - name: SpacyFeaturizer + - name: RegexFeaturizer + - name: LexicalSyntacticFeaturizer + - name: CountVectorsFeaturizer + - name: CountVectorsFeaturizer + analyzer: "char_wb" + min_ngram: 1 + max_ngram: 4 + - name: DIETClassifier + epochs: 100 + - name: EntitySynonymMapper + - name: ResponseSelector + epochs: 100 + - name: FallbackClassifier + threshold: 0.3 + ambiguity_threshold: 0.1 + + +# Configuration for Rasa Core. +# https://rasa.com/docs/rasa/core/policies/ +policies: +# # No configuration for policies was provided. The following default policies were used to train your model. +# # If you'd like to customize them, uncomment and adjust the policies. +# # See https://rasa.com/docs/rasa/policies for more information. +# - name: MemoizationPolicy +# - name: RulePolicy +# - name: UnexpecTEDIntentPolicy +# max_history: 5 +# epochs: 100 +# - name: TEDPolicy +# max_history: 5 +# epochs: 100 +# constrain_similarities: true diff --git a/credentials.yml b/credentials.yml @@ -0,0 +1,33 @@ +# This file contains the credentials for the voice & chat platforms +# which your bot is using. +# https://rasa.com/docs/rasa/messaging-and-voice-channels + +rest: +# # you don't need to provide anything here - this channel doesn't +# # require any credentials + + +#facebook: +# verify: "<verify>" +# secret: "<your secret>" +# page-access-token: "<your page access token>" + +#slack: +# slack_token: "<your slack token>" +# slack_channel: "<the slack channel>" +# slack_signing_secret: "<your slack signing secret>" + +#socketio: +# user_message_evt: <event name for user message> +# bot_message_evt: <event name for bot messages> +# session_persistence: <true/false> + +#mattermost: +# url: "https://<mattermost instance>/api/v4" +# token: "<bot token>" +# webhook_url: "<callback URL>" + +# This entry is needed if you are using Rasa Enterprise. The entry represents credentials +# for the Rasa Enterprise "channel", i.e. Talk to your bot and Share with guest testers. +rasa: + url: "http://localhost:5002/api" diff --git a/data/nlu.yml b/data/nlu.yml @@ -0,0 +1,39 @@ +version: "3.1" +nlu: +- intent: bot_challenge + examples: | + - are you a bot? + - are you a human? + - am I talking to a bot? + - am I talking to a human? +- intent: greet + examples: | + - hey + - hello + - hi + - good morning + - good evening + - hey there + - Hi +- intent: goodbye + examples: | + - bye + - goodbye + - see you around + - see you later +- intent: query_knowledge_base + examples: | + - What [matrix clients]{"entity": "object_type", "value": "client"} can you recommend? + - Which [features]{"entity": "attribute", "value": "features"} does [element-x]{"entity": "client"} have? + - Which [clients]{"entity": "object_type", "value": "client"} can you recommend? +- synonym: client + examples: | + - matrix clients + - matrix client + - client + - clients +- lookup: client + examples: | + - element + - nheko + - Fluffychat +\ No newline at end of file diff --git a/data/rules.yml b/data/rules.yml @@ -0,0 +1,18 @@ +version: "3.1" +rules: + - rule: greet + steps: + - intent: greet + - action: utter_greet + - rule: goodbye + steps: + - intent: goodbye + - action: utter_goodbye + - rule: query knowledge base + steps: + - intent: query_knowledge_base + - action: action_query_knowledge_base + - rule: bot challenge + steps: + - intent: bot_challenge + - action: utter_iamabot +\ No newline at end of file diff --git a/data/stories.yml b/data/stories.yml @@ -0,0 +1,35 @@ +version: "3.1" +stories: + - story: are you a bot? + steps: + - intent: bot_challenge + - action: utter_iamabot + - intent: greet + - action: utter_greet + - story: interactive_story_1 + steps: + - intent: greet + - action: utter_greet + - intent: query_knowledge_base + entities: + - object_type: client + - slot_was_set: + - object_type: client + - action: action_query_knowledge_base + - slot_was_set: + - object_type: null + - slot_was_set: + - mention: null + - slot_was_set: + - attribute: null + - slot_was_set: + - knowledge_base_last_object: null + - slot_was_set: + - knowledge_base_last_object_type: client + - slot_was_set: + - knowledge_base_listed_objects: + - 4 + - 17 + - 7 + - 1 + - 14 diff --git a/domain.yml b/domain.yml @@ -0,0 +1,55 @@ +version: '3.1' +intents: +- bot_challenge +- goodbye +- greet +- query_knowledge_base +entities: +- attribute +- object_type +- clients +- mention +- client + +slots: + object_type: + type: text + influence_conversation: false + mappings: + - type: from_entity + entity: object_type + mention: + type: text + influence_conversation: false + mappings: + - type: from_entity + entity: mention + attribute: + type: any + influence_conversation: false + mappings: + - type: from_entity + entity: attribute + client: + type: text + influence_conversation: false + mappings: + - type: from_entity + entity: client +actions: +- utter_greet +- action_query_knowledge_base +responses: + utter_greet: + - text: Hello! How can I help you? + utter_goodbye: + - text: Bye + - text: Goodbye. See you soon. + utter_ask_rephrase: + - text: Sorry, I'm not sure I understand. Can you rephrase? + - text: Can you please rephrase? I did not got that. + utter_iamabot: + - text: I am a bot, powered by Rasa. +session_config: + session_expiration_time: 60 + carry_over_slots_to_new_session: true diff --git a/endpoints.yml b/endpoints.yml @@ -0,0 +1,42 @@ +# This file contains the different endpoints your bot can use. + +# Server where the models are pulled from. +# https://rasa.com/docs/rasa/model-storage#fetching-models-from-a-server + +#models: +# url: http://my-server.com/models/default_core@latest +# wait_time_between_pulls: 10 # [optional](default: 100) + +# Server which runs your custom actions. +# https://rasa.com/docs/rasa/custom-actions + +action_endpoint: + url: "http://localhost:5055/webhook" + +# Tracker store which is used to store the conversations. +# By default the conversations are stored in memory. +# https://rasa.com/docs/rasa/tracker-stores + +#tracker_store: +# type: redis +# url: <host of the redis instance, e.g. localhost> +# port: <port of your redis instance, usually 6379> +# db: <number of your database within redis, e.g. 0> +# password: <password used for authentication> +# use_ssl: <whether or not the communication is encrypted, default false> + +#tracker_store: +# type: mongod +# url: <url to your mongo instance, e.g. mongodb://localhost:27017> +# db: <name of the db within your mongo instance, e.g. rasa> +# username: <username used for authentication> +# password: <password used for authentication> + +# Event broker which all conversation events should be streamed to. +# https://rasa.com/docs/rasa/event-brokers + +#event_broker: +# url: localhost +# username: username +# password: password +# queue: queue diff --git a/knowledge_base_data.json b/knowledge_base_data.json @@ -0,0 +1,714 @@ +{ + "client": [ + { + "thumbnail": "neochat.svg", + "maintainer": "Carl Schwan, Tobias Fella", + "licence": "GPL-3.0-only", + "language": "C++", + "last_release": "2023-11-09", + "maturity": "Beta", + "repo": "https://invent.kde.org/network/neochat", + "website": "https://apps.kde.org/neochat", + "matrix_room": "#neochat:kde.org", + "featured": false, + "features": { + "e2ee": true, + "spaces": true, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "sso": true, + "multi_account": true, + "multi_language": true + }, + "packages": { + "windows_installer": "https://www.microsoft.com/store/apps/9PNXWVNRC29H", + "macos_installer": "https://binary-factory.kde.org/search/?q=neochat", + "flathub": { + "app_id": "org.kde.neochat" + } + }, + "id": 0, + "name": "neochat", + "description": "A Matrix client for desktop and mobile" + }, + { + "thumbnail": "matrix-commander.svg", + "maintainer": "8go", + "licence": "GPL-3.0-or-later", + "language": "Python", + "last_release": "2023-10-12", + "maturity": "Stable", + "repo": "https://github.com/8go/matrix-commander", + "featured": false, + "features": { + "e2ee": true, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "sso": true, + "multi_account": false, + "multi_language": false + }, + "packages": { + "other_linux_link": "https://github.com/8go/matrix-commander#dependencies-and-installation" + }, + "id": 1, + "name": "matrix-commander", + "description": "Simple but convenient CLI-based Matrix client app for sending and receiving." + }, + { + "thumbnail": "thunderbird.svg", + "maintainer": "Mozilla", + "licence": "MPL-2.0", + "language": "Javascript", + "last_release": "2023-04-11", + "maturity": "Beta", + "repo": "https://hg.mozilla.org/comm-central", + "website": "https://www.thunderbird.net", + "matrix_room": "#thunderbird:mozilla.org", + "featured": false, + "features": { + "e2ee": true, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "sso": true, + "multi_account": true, + "multi_language": true + }, + "packages": { + "windows_installer": "https://www.thunderbird.net", + "macos_installer": "https://www.thunderbird.net", + "flathub": { + "app_id": "org.mozilla.Thunderbird" + } + }, + "id": 2, + "name": "thunderbird", + "description": "A free open-repo email, calendar & chat app" + }, + { + "thumbnail": "hydrogen.svg", + "maintainer": "Element", + "licence": "Apache-2.0", + "language": "Javascript", + "last_release": "2023-02-14", + "maturity": "Beta", + "repo": "https://github.com/vector-im/hydrogen-web", + "featured": false, + "features": { + "e2ee": true, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "threads": false, + "sso": true, + "multi_account": true, + "multi_language": true + }, + "packages": { + "webapp": "https://hydrogen.element.io" + }, + "id": 3, + "name": "hydrogen", + "description": "Lightweight matrix client with legacy and mobile browser support." + }, + { + "thumbnail": "watch-the-matrix.svg", + "maintainer": "pixlwave", + "licence": "MPL-2.0", + "language": "Swift", + "last_release": "2023-04-16", + "maturity": "Alpha", + "repo": "https://github.com/pixlwave/Watch-The-Matrix", + "matrix_room": "#watchthe:matrix.org", + "featured": false, + "features": { + "e2ee": false, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "sso": false, + "multi_account": false, + "multi_language": true + }, + "packages": { + "other_install_links": "https://github.com/pixlwave/Watch-The-Matrix/tags" + }, + "id": 4, + "name": "watch-the-matrix", + "description": "A Matrix client for watchOS written in Swift" + }, + { + "thumbnail": "element-x.svg", + "maintainer": "Element", + "maturity": "Beta", + "repo": "https://github.com/element-hq", + "matrix_room": "#element-x-ios:matrix.org", + "licence": "Apache-2.0", + "last_release": "2023-09-21", + "featured": true, + "features": { + "e2ee": true, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": true, + "threads": false, + "sso": false, + "multi_account": false, + "multi_language": true + }, + "packages": { + "google_play_store": { + "app_id": "io.element.android.x" + }, + "apple_app_store": { + "app_id": "id1631335820", + "org": "vector" + } + }, + "id": 5, + "name": "element-x", + "description": "Element X is pioneering the Matrix 2.0 implementation, notably supporting fast sync with sliding sync." + }, + { + "maintainer": "Stefan Tatschner", + "licence": "MIT", + "language": "Rust", + "last_release": "", + "maturity": "Alpha", + "repo": "https://github.com/rumpelsepp/mnotify/", + "matrix_room": "#mnotify:hackbrettl.de", + "featured": false, + "features": { + "e2ee": false, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "sso": false, + "multi_account": false, + "multi_language": false + }, + "packages": { + "other_linux_link": "https://github.com/rumpelsepp/mnotify/#build" + }, + "id": 6, + "name": "mnotify", + "description": "A matrix cli client" + }, + { + "thumbnail": "commet.svg", + "maintainer": "Airyz", + "licence": "AGPL-3.0", + "language": "Dart", + "last_release": "2023-11-17", + "maturity": "Alpha", + "repo": "https://github.com/commetchat/commet", + "website": "https://commet.chat", + "matrix_room": "#commet:matrix.org", + "featured": false, + "features": { + "e2ee": true, + "spaces": true, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "threads": false, + "sso": false, + "multi_account": true, + "multi_language": false + }, + "packages": { + "windows_installer": "https://github.com/commetchat/commet/releases", + "other_linux_link": "https://github.com/commetchat/commet/releases", + "webapp": "https://app.commet.chat/" + }, + "id": 7, + "name": "commet", + "description": "Focused on providing a feature rich experience while maintaining a simple interface" + }, + { + "maintainer": "diamondburned", + "licence": "AGPL-3.0-or-later", + "language": "Go", + "last_release": "2022-08-01", + "maturity": "Alpha", + "repo": "https://github.com/diamondburned/gotktrix", + "featured": false, + "features": { + "e2ee": false, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "threads": false, + "sso": true, + "multi_account": true, + "multi_language": false + }, + "packages": { + "other_linux_link": "https://github.com/diamondburned/gotktrix/releases" + }, + "id": 8, + "name": "gotktrix", + "description": "Matrix client in Go and GTK4." + }, + { + "thumbnail": "cinny.svg", + "maintainer": "Ajay Bura", + "licence": "AGPL-3.0", + "language": "Javascript", + "last_release": "2023-02-20", + "maturity": "Stable", + "repo": "https://github.com/cinnyapp/cinny", + "website": "https://cinny.in", + "matrix_room": "#cinny:matrix.org", + "featured": true, + "features": { + "e2ee": true, + "spaces": true, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "threads": false, + "sso": true, + "multi_account": false, + "multi_language": false + }, + "packages": { + "windows_installer": "https://github.com/cinnyapp/cinny-desktop/releases", + "macos_installer": "https://github.com/cinnyapp/cinny-desktop/releases", + "flathub": { + "app_id": "in.cinny.Cinny" + }, + "webapp": "https://app.cinny.in/" + }, + "id": 9, + "name": "cinny", + "description": "A Matrix client focusing primarily on simple, elegant and secure interface." + }, + { + "maintainer": "ulyssa", + "licence": "Apache-2.0", + "language": "Rust", + "last_release": "2023-03-24", + "maturity": "Beta", + "repo": "https://github.com/ulyssa/iamb", + "website": "https://iamb.chat/", + "matrix_room": "#iamb:0x.badd.cafe", + "featured": false, + "features": { + "e2ee": true, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "threads": false, + "sso": false, + "multi_account": true, + "multi_language": false + }, + "packages": { + "other_linux_link": "https://iamb.chat/install.html" + }, + "id": 10, + "name": "iamb", + "description": "A terminal-based Matrix client with Vim keybindings written in Rust." + }, + { + "thumbnail": "fractal.svg", + "maintainer": "Alexandre Franke, Kévin Commaille and Julian Sparber", + "licence": "GPL-3.0-or-later", + "language": "Rust", + "last_release": "2023-11-24", + "maturity": "Beta", + "repo": "https://gitlab.gnome.org/GNOME/fractal", + "matrix_room": "#fractal:gnome.org", + "featured": false, + "features": { + "e2ee": true, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "threads": false, + "sso": true, + "multi_account": true, + "multi_language": true + }, + "packages": { + "flathub": { + "app_id": "org.gnome.Fractal" + } + }, + "id": 11, + "name": "fractal", + "description": "A Matrix messaging app for GNOME, written in Rust. Its interface is optimized for collaboration in large groups, such as free software projects, and will fit all screens, big or small." + }, + { + "thumbnail": "fluffychat.svg", + "maintainer": "Christian Pauly", + "licence": "AGPL-3.0-only", + "language": "Flutter", + "last_release": "2021-12-01", + "maturity": "Stable", + "repo": "https://github.com/krille-chan/fluffychat", + "website": "https://fluffychat.im", + "matrix_room": "#fluffychat:matrix.org", + "featured": true, + "features": { + "e2ee": true, + "spaces": true, + "voip_1to1": true, + "voip_jitsi": true, + "widgets": false, + "threads": false, + "sso": true, + "multi_account": true, + "multi_language": true + }, + "packages": { + "google_play_store": { + "app_id": "chat.fluffy.fluffychat" + }, + "f_droid": { + "app_id": "chat.fluffy.fluffychat" + }, + "apple_app_store": { + "app_id": "id1551469600", + "org": "fluffychat" + }, + "flathub": { + "app_id": "im.fluffychat.Fluffychat" + }, + "webapp": "https://fluffychat.im/web" + }, + "id": 12, + "name": "fluffychat", + "description": "Cute instant messaging app for all platforms." + }, + { + "thumbnail": "schildichat.svg", + "maintainer": "SpiritCroc", + "licence": "Apache-2.0", + "language": "Javascript", + "last_release": "2023-03-28", + "maturity": "Stable", + "repo": "https://github.com/SchildiChat", + "website": "https://schildi.chat/", + "featured": false, + "features": { + "e2ee": true, + "spaces": true, + "voip_1to1": true, + "voip_jitsi": true, + "widgets": true, + "sso": true, + "multi_account": false, + "multi_language": true + }, + "packages": { + "windows_installer": "https://github.com/SchildiChat/schildichat-desktop/releases", + "macos_installer": "https://github.com/SchildiChat/schildichat-desktop/releases", + "google_play_store": { + "app_id": "de.spiritcroc.riotx" + }, + "f_droid": { + "app_id": "de.spiritcroc.riotx" + }, + "flathub": { + "app_id": "chat.schildi.desktop" + }, + "webapp": "https://app.schildi.chat/" + }, + "id": 13, + "name": "schildichat", + "description": "Based on Element, with a more traditional instant messaging experience." + }, + { + "maintainer": "Tulir", + "licence": "AGPL-3.0-or-later", + "language": "Go", + "last_release": "2022-11-19", + "maturity": "Beta", + "repo": "https://github.com/tulir/gomuks", + "matrix_room": "#gomuks:maunium.net", + "featured": false, + "features": { + "e2ee": true, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "threads": false, + "sso": true, + "multi_account": false, + "multi_language": false + }, + "packages": { + "other_linux_link": "https://github.com/tulir/gomuks/releases", + "macos_installer": "https://github.com/tulir/gomuks/releases" + }, + "id": 14, + "name": "gomuks", + "description": "A terminal Matrix client written in Go." + }, + { + "thumbnail": "syphon.svg", + "maintainer": "Syphon Org", + "licence": "AGPL-3.0", + "language": "Dart", + "last_release": "", + "maturity": "Alpha", + "repo": "https://github.com/syphon-org/syphon", + "website": "https://syphon.org/", + "matrix_room": "#syphon:matrix.org", + "featured": false, + "features": { + "e2ee": true, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "sso": true, + "multi_account": true, + "multi_language": true + }, + "packages": { + "google_play_store": { + "app_id": "org.tether.tether" + }, + "f_droid": { + "app_id": "org.tether.tether" + }, + "apple_app_store": { + "app_id": "id1496285352", + "org": "syphon" + }, + "flathub": { + "app_id": "org.syphon.Syphon" + } + }, + "id": 15, + "name": "syphon", + "description": "A privacy centric matrix client" + }, + { + "thumbnail": "quadrix.svg", + "maintainer": "Jean-François Alarie", + "licence": "GPL-3.0-or-later", + "language": "TypeScript", + "last_release": "", + "maturity": "Stable", + "repo": "https://github.com/alariej/quadrix", + "website": "https://quadrix.chat", + "matrix_room": "#quadrix:matrix.org", + "featured": false, + "features": { + "e2ee": false, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "sso": false, + "multi_account": false, + "multi_language": false + }, + "packages": { + "apple_app_store": { + "org": "quadrix-chat", + "app_id": "id1576110553" + }, + "google_play_store": { + "app_id": "chat.quadrix.android" + }, + "windows_installer": "https://apps.microsoft.com/store/detail/quadrixchat/9NPZ93X49V00", + "macos_installer": "https://apps.apple.com/us/app/quadrix-chat-desktop/id1577585119", + "flathub": { + "app_id": "chat.quadrix.Quadrix" + }, + "webapp": "https://quadrix.chat" + }, + "id": 16, + "name": "quadrix", + "description": "Minimal Matrix client available in all main app stores" + }, + { + "thumbnail": "quaternion.svg", + "maintainer": "The Quotient Project", + "licence": "GPL-3.0-only", + "language": "C++", + "last_release": "2021-10-07", + "maturity": "Beta", + "repo": "https://github.com/quotient-im/Quaternion", + "matrix_room": "#quotient:matrix.org", + "featured": false, + "features": { + "e2ee": false, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "sso": true, + "multi_account": true, + "multi_language": false + }, + "packages": { + "windows_installer": "https://github.com/quotient-im/Quaternion/releases/latest", + "macos_installer": "https://github.com/quotient-im/Quaternion/releases/latest", + "flathub": { + "app_id": "com.github.quaternion" + } + }, + "id": 17, + "name": "quaternion", + "description": "A Qt5-based IM client for Matrix." + }, + { + "thumbnail": "nheko.svg", + "maintainer": "mujx, red_sky, deepbluev7", + "licence": "GPL-3.0-or-later", + "language": "C++", + "last_release": "2023-02-20", + "maturity": "Beta", + "repo": "https://github.com/Nheko-Reborn/nheko", + "website": "https://nheko-reborn.github.io/", + "matrix_room": "#nheko-reborn:matrix.org", + "featured": false, + "features": { + "e2ee": true, + "spaces": true, + "voip_1to1": true, + "voip_jitsi": false, + "widgets": false, + "threads": true, + "sso": true, + "multi_account": false, + "multi_language": true + }, + "packages": { + "windows_installer": "https://github.com/Nheko-Reborn/nheko/releases", + "macos_installer": "https://github.com/Nheko-Reborn/nheko/releases", + "flathub": { + "app_id": "io.github.NhekoReborn.Nheko" + } + }, + "id": 18, + "name": "nheko", + "description": "Desktop client for Matrix using Qt and C++20." + }, + { + "thumbnail": "element.svg", + "maintainer": "Element", + "maturity": "Stable", + "repo": "https://github.com/element-hq", + "matrix_room": "#element-web:matrix.org", + "licence": "Apache-2.0", + "last_release": "2022-11-02", + "featured": true, + "features": { + "e2ee": true, + "spaces": true, + "voip_1to1": true, + "voip_jitsi": true, + "widgets": true, + "threads": true, + "sso": true, + "multi_account": false, + "multi_language": true + }, + "packages": { + "windows_installer": "https://element.io/download", + "macos_installer": "https://element.io/download", + "google_play_store": { + "app_id": "im.vector.app" + }, + "f_droid": { + "app_id": "im.vector.app" + }, + "apple_app_store": { + "app_id": "id1083446067", + "org": "vector" + }, + "flathub": { + "app_id": "im.riot.Riot" + }, + "webapp": "https://app.element.io" + }, + "id": 19, + "name": "element", + "description": "Element is a glossy client with an emphasis on performance and usability." + }, + { + "thumbnail": "kazv.png", + "maintainer": "The Kazv Project", + "licence": "AGPL-3.0-or-later", + "language": "C++", + "last_release": "", + "maturity": "Alpha", + "repo": "https://lily.kazv.moe/kazv/kazv", + "matrix_room": "#kazv:tusooa.xyz", + "featured": false, + "features": { + "e2ee": true, + "spaces": false, + "voip_1to1": false, + "voip_jitsi": false, + "widgets": false, + "sso": false, + "multi_account": false, + "multi_language": false + }, + "packages": { + "other_linux_link": "https://lily-is.land/kazv/kazv#compiled-executables" + }, + "id": 20, + "name": "kazv", + "description": "A convergent qml/kirigami client based on libkazv." + } + ], + "provider": [ + { + "name": "Element Matrix Services", + "website": "https://ems.element.io", + "operating_since": "2018", + "description": "- Hosted Homeservers\n- [Hosted Integrations including Slack, IRC, Github bridging](https://element.io/element-matrix-store)\n\nBrought to you by the creators of Matrix, who have been running the biggest homeserver in the network since 2014. Every homeserver comes with a custom instance of Element.\n", + "id": 0 + }, + { + "name": "Ungleich.ch", + "website": "https://matrix.zerocarbon.shop", + "operating_since": "2020", + "description": "* Hosted Homeservers\n* [Bridge solutions: bridging Slack, Telegram, Whatsapp, IRC and more](https://ungleich.ch/en-us/cms/matterbridge-matrix/)\n* [Customised Matrix development: Custom Authentication/Login, Integration into private networks](https://ungleich.ch/u/products/matrix-custom-development/)\n\n\nZero Carbon Matrix is provided by ungleich.ch in Switzerland, in their own\nDatacenter (datacenterlight.ch) with a strong focus on sustainability. Operating\nwithin a repurposed historic building, they utilise pre-owned server systems,\npassive cooling techniques, and 100% renewable energy. ungleich.ch also\nspecialises in customised Matrix development for communities and organisations.\n", + "id": 1 + }, + { + "name": "etke.cc", + "website": "https://etke.cc", + "operating_since": "TBC", + "description": "- Setup of hosted Homeserver on any hosting by your choice\n- Setup of hosted integrations (full list available on website)\n- Setup of additional services (wireguard, languagetool, miniflux, etc.)\n- Ongoing maintenance of host & Matrix components\n- Email services for your domain\n\nThat service will create your Matrix Homeserver on your domain and server (doesn't matter if it's cloud provider or on an old laptop in the corner of your room), (optional) maintains it (server's system updates, cleanup, security adjustments, tuning, etc.; Matrix Homeserver updates & maintenance) and (optional) provide full-featured email service for your domain.\n\n[Matrix Space](https://matrix.to/#/#service:etke.cc) | [Announcements on Matrix](https://matrix.to/#/#announcements:etke.cc)\n", + "id": 2 + }, + { + "name": "Ossrox", + "website": "https://ossrox.org", + "operating_since": "TBC", + "description": "- Hosted Homeservers\n\nOssrox is a company from Germany dedicated to hosting open-source services. Not only has the company name been derived from the motto \"Open-Source Software Rocks\", but also their corporate culture. The three most important principles of the company are security, privacy and sustainability - thanks to open-source software. In addition to Matrix, Ossrox also provides many other solutions e.g. in the messaging, groupware and web meeting segments.\n", + "id": 3 + }, + { + "name": "Federated Computer", + "website": "https://federated.computer", + "operating_since": "2022", + "description": "- Hosted Homeservers\n\nFederated Computer provides Element and Matrix hosting as part of a team collaboration suite (including Nextcloud, Jitsi, Listmonk, Vaultwarden, Baserow, Gitea, Caddy, Castopod, Wireguard, and single-sign-on LDAP).\n", + "id": 4 + } + ] +} +\ No newline at end of file diff --git a/scripts/matrix_org_to_json.py b/scripts/matrix_org_to_json.py @@ -0,0 +1,38 @@ +import frontmatter +from pathlib import Path +import json +import toml + +BASE_PATH = Path("../../matrix.org") +ECOSYSTEM_PATH = BASE_PATH / "content/ecosystem/" + +output_json = {"client": [], "provider": []} + +clients_path = (ECOSYSTEM_PATH / "clients").glob("*.md") +id = 0 +for file in clients_path: + filename = file.stem + if filename == "_index": + continue + with open(file) as f: + client = frontmatter.load(f) + client_json = client.metadata["extra"] + client_json["id"] = id + client_json["name"] = filename + client_json["description"] = client.content + output_json["client"].append(client_json) + id += 1 + + +providers_path = ECOSYSTEM_PATH / "hosting" / "providers.toml" +providers = toml.load(providers_path) +id = 0 +for provider in providers["providers"]: + provider_json = provider + provider_json["id"] = id + del provider_json["image"] + output_json["provider"].append(provider_json) + id += 1 + +with open("../knowledge_base_data.json", "w", encoding="utf-8") as f: + json.dump(output_json, f, ensure_ascii=False, indent=4) diff --git a/scripts/requirements.txt b/scripts/requirements.txt @@ -0,0 +1,2 @@ +python-frontmatter +toml +\ No newline at end of file diff --git a/tests/test_stories.yml b/tests/test_stories.yml @@ -0,0 +1,21 @@ +stories: + - story: A basic story test + steps: + - user: | + hello + intent: greet + - action: utter_greet + - user: | + Which [matrix client]{"entity": "object_type", "value": "client"} can you recommend? + intent: query_knowledge_base + - slot_was_set: + - object_type: client + - action: action_query_knowledge_base + - user: | + Which [features](attribute) does [element-x](client) have? + intent: query_knowledge_base + - slot_was_set: + - attribute: features + - slot_was_set: + - client: element-x + - action: action_query_knowledge_base +\ No newline at end of file