Optimized conditions for ChatGPT Bridge for matrix

This commit is contained in:
Kevin Veen-Birkenbach 2025-05-16 13:00:05 +02:00
parent e9e9925bde
commit ae48aebcd7
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
11 changed files with 45 additions and 44 deletions

View File

@ -143,14 +143,14 @@
- name: create admin account - name: create admin account
command: command:
cmd: docker compose exec -it synapse register_new_matrix_user -u {{applications.matrix.users.administrator.username}} -p {{applications[application_id].credentials.administrator_password}} -a -c /data/homeserver.yaml http://localhost:8008 cmd: docker compose exec -it synapse register_new_matrix_user -u {{applications[application_id].users.administrator.username}} -p {{applications[application_id].credentials.administrator_password}} -a -c /data/homeserver.yaml http://localhost:8008
chdir: "{{ docker_compose.directories.instance }}" chdir: "{{ docker_compose.directories.instance }}"
ignore_errors: true ignore_errors: true
when: applications.matrix.setup | bool when: applications[application_id].setup | bool
- name: create chatgpt bot - name: create chatgpt bot
command: command:
cmd: docker compose exec -it synapse register_new_matrix_user -u chatgptbot -p {{applications[application_id].credentials.chatgpt_bridge_user_password}} -a -c /data/homeserver.yaml http://localhost:8008 cmd: docker compose exec -it synapse register_new_matrix_user -u chatgptbot -p {{applications[application_id].credentials.chatgpt_bridge_user_password}} -a -c /data/homeserver.yaml http://localhost:8008
chdir: "{{ docker_compose.directories.instance }}" chdir: "{{ docker_compose.directories.instance }}"
ignore_errors: true ignore_errors: true
when: applications.matrix.setup | bool when: applications[application_id].setup | bool

View File

@ -3,7 +3,7 @@ services:
{% include 'roles/docker-central-database/templates/services/' + database_type + '.yml.j2' %} {% include 'roles/docker-central-database/templates/services/' + database_type + '.yml.j2' %}
synapse: synapse:
image: matrixdotorg/synapse:{{applications.matrix.synapse.version}} image: matrixdotorg/synapse:{{applications[application_id].synapse.version}}
container_name: matrix-synapse container_name: matrix-synapse
restart: {{docker_restart_policy}} restart: {{docker_restart_policy}}
logging: logging:
@ -36,7 +36,7 @@ services:
{% endif %} {% endif %}
{% include 'templates/docker/container/networks.yml.j2' %} {% include 'templates/docker/container/networks.yml.j2' %}
element: element:
image: vectorim/element-web:{{applications.matrix.element.version}} image: vectorim/element-web:{{applications[application_id].element.version}}
container_name: matrix-element container_name: matrix-element
restart: {{docker_restart_policy}} restart: {{docker_restart_policy}}
volumes: volumes:
@ -64,7 +64,7 @@ services:
retries: 3 retries: 3
{% include 'templates/docker/container/networks.yml.j2' %} {% include 'templates/docker/container/networks.yml.j2' %}
{% endfor %} {% endfor %}
{% if applications[application_id] | bool %} {% if applications[application_id].plugins.chatgpt | bool %}
matrix-chatgpt-bot: matrix-chatgpt-bot:
restart: {{docker_restart_policy}} restart: {{docker_restart_policy}}
container_name: matrix-chatgpt container_name: matrix-chatgpt
@ -92,13 +92,13 @@ services:
KEYV_BOT_ENCRYPTION: 'false' KEYV_BOT_ENCRYPTION: 'false'
KEYV_BOT_STORAGE: 'true' KEYV_BOT_STORAGE: 'true'
MATRIX_HOMESERVER_URL: 'https://{{domains.synapse}}' MATRIX_HOMESERVER_URL: 'https://{{domains.synapse}}'
MATRIX_BOT_USERNAME: '@chatgptbot:{{applications.matrix.server_name}}' MATRIX_BOT_USERNAME: '@chatgptbot:{{applications[application_id].server_name}}'
MATRIX_ACCESS_TOKEN: '{{ applications[application_id].credentials.chatgpt_bridge_access_token | default('') }}' MATRIX_ACCESS_TOKEN: '{{ applications[application_id].credentials.chatgpt_bridge_access_token | default('') }}'
MATRIX_BOT_PASSWORD: '{{applications[application_id].credentials.chatgpt_bridge_user_password}}' MATRIX_BOT_PASSWORD: '{{applications[application_id].credentials.chatgpt_bridge_user_password}}'
MATRIX_DEFAULT_PREFIX: '!chatgpt' MATRIX_DEFAULT_PREFIX: '!chatgpt'
MATRIX_DEFAULT_PREFIX_REPLY: 'false' MATRIX_DEFAULT_PREFIX_REPLY: 'false'
#MATRIX_BLACKLIST: '' #MATRIX_BLACKLIST: ''
MATRIX_WHITELIST: ':{{applications.matrix.server_name}}' MATRIX_WHITELIST: ':{{applications[application_id].server_name}}'
MATRIX_AUTOJOIN: 'true' MATRIX_AUTOJOIN: 'true'
MATRIX_ENCRYPTION: 'true' MATRIX_ENCRYPTION: 'true'
MATRIX_THREADS: 'true' MATRIX_THREADS: 'true'
@ -108,6 +108,8 @@ services:
{% include 'templates/docker/compose/volumes.yml.j2' %} {% include 'templates/docker/compose/volumes.yml.j2' %}
synapse_data: synapse_data:
# chatgpt_data: {% if applications[application_id].plugins.chatgpt | bool %}
chatgpt_data:
{% endif %}
{% include 'templates/docker/compose/networks.yml.j2' %} {% include 'templates/docker/compose/networks.yml.j2' %}

View File

@ -3,7 +3,7 @@ homeserver:
# The address that this appservice can use to connect to the homeserver. # The address that this appservice can use to connect to the homeserver.
address: http://synapse:8008 address: http://synapse:8008
# The domain of the homeserver (for MXIDs, etc). # The domain of the homeserver (for MXIDs, etc).
domain: {{applications.matrix.server_name}} domain: {{applications[application_id].server_name}}
# Whether or not to verify the SSL certificate of the homeserver. # Whether or not to verify the SSL certificate of the homeserver.
# Only applies if address starts with https:// # Only applies if address starts with https://
verify_ssl: true verify_ssl: true
@ -143,7 +143,7 @@ bridge:
sync_direct_chat_list: false sync_direct_chat_list: false
# Servers to always allow double puppeting from # Servers to always allow double puppeting from
double_puppet_server_map: double_puppet_server_map:
{{applications.matrix.server_name}}: {{domains.synapse}} {{applications[application_id].server_name}}: {{domains.synapse}}
# Allow using double puppeting from any server with a valid client .well-known file. # Allow using double puppeting from any server with a valid client .well-known file.
double_puppet_allow_discovery: false double_puppet_allow_discovery: false
# Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
@ -154,7 +154,7 @@ bridge:
# If using this for other servers than the bridge's server, # If using this for other servers than the bridge's server,
# you must also set the URL in the double_puppet_server_map. # you must also set the URL in the double_puppet_server_map.
login_shared_secret_map: login_shared_secret_map:
{{applications.matrix.server_name}}: {{applications[application_id].credentials.registration_shared_secret}} {{applications[application_id].server_name}}: {{applications[application_id].credentials.registration_shared_secret}}
# Should presence from Facebook be bridged? This doesn't use the same API as the Android app, # Should presence from Facebook be bridged? This doesn't use the same API as the Android app,
# so it might be more suspicious to Facebook. # so it might be more suspicious to Facebook.
presence_from_facebook: false presence_from_facebook: false
@ -380,8 +380,8 @@ bridge:
# mxid - Specific user # mxid - Specific user
permissions: permissions:
"*": relay "*": relay
"{{applications.matrix.server_name}}": user "{{applications[application_id].server_name}}": user
"@{{applications.matrix.users.administrator.username}}:{{applications.matrix.server_name}}": admin "@{{applications[application_id].users.administrator.username}}:{{applications[application_id].server_name}}": admin
relay: relay:
# Whether relay mode should be allowed. If allowed, `!fb set-relay` can be used to turn any # Whether relay mode should be allowed. If allowed, `!fb set-relay` can be used to turn any

View File

@ -10,7 +10,7 @@ homeserver:
# How often should the websocket be pinged? Pinging will be disabled if this is zero. # How often should the websocket be pinged? Pinging will be disabled if this is zero.
ping_interval_seconds: 0 ping_interval_seconds: 0
# The domain of the homeserver (also known as server_name, used for MXIDs, etc). # The domain of the homeserver (also known as server_name, used for MXIDs, etc).
domain: {{applications.matrix.server_name}} domain: {{applications[application_id].server_name}}
# What software is the homeserver running? # What software is the homeserver running?
# Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here. # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here.

View File

@ -3,7 +3,7 @@ homeserver:
# The address that this appservice can use to connect to the homeserver. # The address that this appservice can use to connect to the homeserver.
address: http://synapse:8008 address: http://synapse:8008
# The domain of the homeserver (also known as server_name, used for MXIDs, etc). # The domain of the homeserver (also known as server_name, used for MXIDs, etc).
domain: {{applications.matrix.server_name}} domain: {{applications[application_id].server_name}}
# Whether or not to verify the SSL certificate of the homeserver. # Whether or not to verify the SSL certificate of the homeserver.
# Only applies if address starts with https:// # Only applies if address starts with https://
verify_ssl: true verify_ssl: true
@ -134,7 +134,7 @@ bridge:
double_puppet_allow_discovery: false double_puppet_allow_discovery: false
# Servers to allow double puppeting from, even if double_puppet_allow_discovery is false. # Servers to allow double puppeting from, even if double_puppet_allow_discovery is false.
double_puppet_server_map: double_puppet_server_map:
{{applications.matrix.server_name}}: https://{{domains.synapse}} {{applications[application_id].server_name}}: https://{{domains.synapse}}
# Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
# #
# If set, custom puppets will be enabled automatically for local users # If set, custom puppets will be enabled automatically for local users
@ -143,7 +143,7 @@ bridge:
# If using this for other servers than the bridge's server, # If using this for other servers than the bridge's server,
# you must also set the URL in the double_puppet_server_map. # you must also set the URL in the double_puppet_server_map.
login_shared_secret_map: login_shared_secret_map:
{{applications.matrix.server_name}}: {{applications[application_id].credentials.registration_shared_secret}} {{applications[application_id].server_name}}: {{applications[application_id].credentials.registration_shared_secret}}
# Whether or not created rooms should have federation enabled. # Whether or not created rooms should have federation enabled.
# If false, created portal rooms will never be federated. # If false, created portal rooms will never be federated.
federate_rooms: true federate_rooms: true
@ -359,8 +359,8 @@ bridge:
# mxid - Specific user # mxid - Specific user
permissions: permissions:
"*": relay "*": relay
"{{applications.matrix.server_name}}": user "{{applications[application_id].server_name}}": user
"@{{applications.matrix.users.administrator.username}}:{{applications.matrix.server_name}}": admin "@{{applications[application_id].users.administrator.username}}:{{applications[application_id].server_name}}": admin
relay: relay:
# Whether relay mode should be allowed. If allowed, `!ig set-relay` can be used to turn any # Whether relay mode should be allowed. If allowed, `!ig set-relay` can be used to turn any

View File

@ -3,7 +3,7 @@ homeserver:
# The address that this appservice can use to connect to the homeserver. # The address that this appservice can use to connect to the homeserver.
address: http://synapse:8008 address: http://synapse:8008
# The domain of the homeserver (also known as server_name, used for MXIDs, etc). # The domain of the homeserver (also known as server_name, used for MXIDs, etc).
domain: {{applications.matrix.server_name}} domain: {{applications[application_id].server_name}}
# What software is the homeserver running? # What software is the homeserver running?
# Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here. # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here.
@ -141,7 +141,7 @@ bridge:
federate_rooms: true federate_rooms: true
# Servers to always allow double puppeting from # Servers to always allow double puppeting from
double_puppet_server_map: double_puppet_server_map:
{{applications.matrix.server_name}}: https://{{domains.synapse}} {{applications[application_id].server_name}}: https://{{domains.synapse}}
# Allow using double puppeting from any server with a valid client .well-known file. # Allow using double puppeting from any server with a valid client .well-known file.
double_puppet_allow_discovery: false double_puppet_allow_discovery: false
# Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
@ -150,7 +150,7 @@ bridge:
# instead of users having to find an access token and run `login-matrix` # instead of users having to find an access token and run `login-matrix`
# manually. # manually.
login_shared_secret_map: login_shared_secret_map:
{{applications.matrix.server_name}}: {{applications[application_id].credentials.registration_shared_secret}} {{applications[application_id].server_name}}: {{applications[application_id].credentials.registration_shared_secret}}
# Maximum time for handling Matrix events. Duration strings formatted for https://pkg.go.dev/time#ParseDuration # Maximum time for handling Matrix events. Duration strings formatted for https://pkg.go.dev/time#ParseDuration
# Null means there's no enforced timeout. # Null means there's no enforced timeout.
@ -274,8 +274,8 @@ bridge:
# mxid - Specific user # mxid - Specific user
permissions: permissions:
"*": relay "*": relay
"{{applications.matrix.server_name}}": user "{{applications[application_id].server_name}}": user
"@{{applications.matrix.users.administrator.username}}:{{applications.matrix.server_name}}": admin "@{{applications[application_id].users.administrator.username}}:{{applications[application_id].server_name}}": admin
# Settings for relay mode # Settings for relay mode
relay: relay:

View File

@ -3,7 +3,7 @@ homeserver:
# The address that this appservice can use to connect to the homeserver. # The address that this appservice can use to connect to the homeserver.
address: http://synapse:8008 address: http://synapse:8008
# The domain of the homeserver (also known as server_name, used for MXIDs, etc). # The domain of the homeserver (also known as server_name, used for MXIDs, etc).
domain: {{applications.matrix.server_name}} domain: {{applications[application_id].server_name}}
# What software is the homeserver running? # What software is the homeserver running?
# Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here. # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here.
@ -118,7 +118,7 @@ bridge:
# Servers to always allow double puppeting from # Servers to always allow double puppeting from
double_puppet_server_map: double_puppet_server_map:
{{applications.matrix.server_name}}: https://{{domains.synapse}} {{applications[application_id].server_name}}: https://{{domains.synapse}}
# Allow using double puppeting from any server with a valid client .well-known file. # Allow using double puppeting from any server with a valid client .well-known file.
double_puppet_allow_discovery: false double_puppet_allow_discovery: false
# Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
@ -127,7 +127,7 @@ bridge:
# instead of users having to find an access token and run `login-matrix` # instead of users having to find an access token and run `login-matrix`
# manually. # manually.
login_shared_secret_map: login_shared_secret_map:
{{applications.matrix.server_name}}: {{applications[application_id].credentials.registration_shared_secret}} {{applications[application_id].server_name}}: {{applications[application_id].credentials.registration_shared_secret}}
message_handling_timeout: message_handling_timeout:
# Send an error message after this timeout, but keep waiting for the response until the deadline. # Send an error message after this timeout, but keep waiting for the response until the deadline.
@ -278,8 +278,8 @@ bridge:
# mxid - Specific user # mxid - Specific user
permissions: permissions:
"*": relay "*": relay
"{{applications.matrix.server_name}}": user "{{applications[application_id].server_name}}": user
"@{{applications.matrix.users.administrator.username}}:{{applications.matrix.server_name}}": admin "@{{applications[application_id].users.administrator.username}}:{{applications[application_id].server_name}}": admin
# Logging config. See https://github.com/tulir/zeroconfig for details. # Logging config. See https://github.com/tulir/zeroconfig for details.
logging: logging:

View File

@ -3,7 +3,7 @@ homeserver:
# The address that this appservice can use to connect to the homeserver. # The address that this appservice can use to connect to the homeserver.
address: http://synapse:8008 address: http://synapse:8008
# The domain of the homeserver (for MXIDs, etc). # The domain of the homeserver (for MXIDs, etc).
domain: {{applications.matrix.server_name}} domain: {{applications[application_id].server_name}}
# Whether or not to verify the SSL certificate of the homeserver. # Whether or not to verify the SSL certificate of the homeserver.
# Only applies if address starts with https:// # Only applies if address starts with https://
verify_ssl: true verify_ssl: true
@ -62,7 +62,7 @@ appservice:
prefix: /public prefix: /public
# The base URL where the public-facing endpoints are available. The prefix is not added # The base URL where the public-facing endpoints are available. The prefix is not added
# implicitly. # implicitly.
external: https://{{applications.matrix.server_name}}/public external: https://{{applications[application_id].server_name}}/public
# Provisioning API part of the web server for automated portal creation and fetching information. # Provisioning API part of the web server for automated portal creation and fetching information.
# Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager). # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
@ -198,7 +198,7 @@ bridge:
sync_direct_chat_list: false sync_direct_chat_list: false
# Servers to always allow double puppeting from # Servers to always allow double puppeting from
double_puppet_server_map: double_puppet_server_map:
{{applications.matrix.server_name}}: https://{{domains.synapse}} {{applications[application_id].server_name}}: https://{{domains.synapse}}
# Allow using double puppeting from any server with a valid client .well-known file. # Allow using double puppeting from any server with a valid client .well-known file.
double_puppet_allow_discovery: false double_puppet_allow_discovery: false
# Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
@ -209,7 +209,7 @@ bridge:
# If using this for other servers than the bridge's server, # If using this for other servers than the bridge's server,
# you must also set the URL in the double_puppet_server_map. # you must also set the URL in the double_puppet_server_map.
login_shared_secret_map: login_shared_secret_map:
{{applications.matrix.server_name}}: {{applications[application_id].credentials.registration_shared_secret}} {{applications[application_id].server_name}}: {{applications[application_id].credentials.registration_shared_secret}}
# Set to false to disable link previews in messages sent to Telegram. # Set to false to disable link previews in messages sent to Telegram.
telegram_link_preview: true telegram_link_preview: true
# Whether or not the !tg join command should do a HTTP request # Whether or not the !tg join command should do a HTTP request
@ -530,9 +530,9 @@ bridge:
# mxid - Specific user # mxid - Specific user
permissions: permissions:
"*": "relaybot" "*": "relaybot"
"public.{{applications.matrix.server_name}}": "user" "public.{{applications[application_id].server_name}}": "user"
"{{applications.matrix.server_name}}": "full" "{{applications[application_id].server_name}}": "full"
"@{{applications.matrix.users.administrator.username}}:{{applications.matrix.server_name}}": "admin" "@{{applications[application_id].users.administrator.username}}:{{applications[application_id].server_name}}": "admin"
# Options related to the message relay Telegram bot. # Options related to the message relay Telegram bot.
relaybot: relaybot:

View File

@ -3,7 +3,7 @@ homeserver:
# The address that this appservice can use to connect to the homeserver. # The address that this appservice can use to connect to the homeserver.
address: http://synapse:8008 address: http://synapse:8008
# The domain of the homeserver (also known as server_name, used for MXIDs, etc). # The domain of the homeserver (also known as server_name, used for MXIDs, etc).
domain: {{applications.matrix.server_name}} domain: {{applications[application_id].server_name}}
# What software is the homeserver running? # What software is the homeserver running?
# Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here. # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here.
@ -236,7 +236,7 @@ bridge:
force_active_delivery_receipts: false force_active_delivery_receipts: false
# Servers to always allow double puppeting from # Servers to always allow double puppeting from
double_puppet_server_map: double_puppet_server_map:
{{applications.matrix.server_name}}: https://{{domains.synapse}} {{applications[application_id].server_name}}: https://{{domains.synapse}}
# Allow using double puppeting from any server with a valid client .well-known file. # Allow using double puppeting from any server with a valid client .well-known file.
double_puppet_allow_discovery: false double_puppet_allow_discovery: false
# Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
@ -245,7 +245,7 @@ bridge:
# instead of users having to find an access token and run `login-matrix` # instead of users having to find an access token and run `login-matrix`
# manually. # manually.
login_shared_secret_map: login_shared_secret_map:
{{applications.matrix.server_name}}: {{applications[application_id].credentials.registration_shared_secret}} {{applications[application_id].server_name}}: {{applications[application_id].credentials.registration_shared_secret}}
# Whether to explicitly set the avatar and room name for private chat portal rooms. # Whether to explicitly set the avatar and room name for private chat portal rooms.
# If set to `default`, this will be enabled in encrypted rooms and disabled in unencrypted rooms. # If set to `default`, this will be enabled in encrypted rooms and disabled in unencrypted rooms.
# If set to `always`, all DM rooms will have explicit names and avatars set. # If set to `always`, all DM rooms will have explicit names and avatars set.
@ -434,8 +434,8 @@ bridge:
# mxid - Specific user # mxid - Specific user
permissions: permissions:
"*": relay "*": relay
"{{applications.matrix.server_name}}": user "{{applications[application_id].server_name}}": user
"@{{applications.matrix.users.administrator.username}}:{{applications.matrix.server_name}}": admin "@{{applications[application_id].users.administrator.username}}:{{applications[application_id].server_name}}": admin
# Settings for relay mode # Settings for relay mode
relay: relay:

View File

@ -1,4 +1,4 @@
server_name: "{{applications.matrix.server_name}}" server_name: "{{applications[application_id].server_name}}"
pid_file: /data/homeserver.pid pid_file: /data/homeserver.pid
listeners: listeners:
- port: 8008 - port: 8008

View File

@ -39,4 +39,3 @@ plugins:
slack: false slack: false
telegram: false telegram: false
whatsapp: false whatsapp: false