Merge branch 'main' into power-levels

This commit is contained in:
bertybuttface 2023-11-04 14:29:04 +00:00 committed by GitHub
commit c06f0ebba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 311 additions and 1144 deletions

31
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build Docker Image
uses: docker/build-push-action@v3
with:
context: .
push: false
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
# -
# name: Run Tests
# run: |
# # Add commands to run your tests here

View File

@ -1,12 +1,9 @@
name: ci
name: release
on:
push:
tags:
- "v*.*.*"
branches: [main]
pull_request:
branches: [main]
jobs:
docker:
@ -20,15 +17,10 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/matrixgpt/matrix-chatgpt-bot
flavor: latest=true
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
@ -41,7 +33,6 @@ jobs:
uses: docker/setup-buildx-action@v2
-
name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
@ -52,7 +43,7 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.ref_type == 'tag' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64

View File

@ -1,4 +1,4 @@
FROM node:19-slim
FROM node:20-slim
WORKDIR /usr/src/app

View File

@ -37,7 +37,7 @@ Adjust all required settings in the `.env` file before running. Optional setting
- You need a Matrix account on [Matrix.org](https://matrix.org) (or any other server) for the bot user.
- By default, anyone that knows the name of your bot can invite it to rooms or chat with it.
- Restrict access with `MATRIX_BLACKLIST` or `MATRIX_WHITELIST`
- Restrict access with `MATRIX_BLACKLIST_ROOMS` or `MATRIX_WHITELIST_ROOMS`
- Restrict access with `MATRIX_ROOM_BLACKLIST` or `MATRIX_ROOM_WHITELIST`
- Restrict access with `MATRIX_POWER_LEVEL` (defaults to 0)
- When using a self-hosted setup, you could wildcard all your users with `MATRIX_WHITELIST=:yourhomeserver.example`.
@ -174,6 +174,9 @@ Here are some guidelines for setting the temperature:
| 0.5-0.9 (medium) | Tasks needing somewhat varied and creative content grounded in reality | E-mail response |
| Above 0.9 (high) | Tasks requiring more creative and unpredictable output | Story writing |
## The response I receive is excessively long and gets truncated. Unlike in ChatGPT, my matrix does not have a "Continue generating" button.
You can simply write `continue` to prompt the bot to continue from its previous answer.
# Reporting issues
Please report issues via Github. The chat room is for discussion.

View File

@ -1,6 +1,6 @@
{
"name": "matrix-chatgpt-bot",
"version": "3.1.1",
"version": "3.1.4",
"main": "dist/index.js",
"repository": "git@github.com:matrixgpt/matrix-chatgpt-bot.git",
"author": "Max Kammler <max.kammler@ucc.ovgu.de>",
@ -15,19 +15,18 @@
"typecheck": "yarn tsc"
},
"dependencies": {
"@keyv/mongo": "^2.2.8",
"@keyv/postgres": "^1.4.5",
"@keyv/redis": "^2.5.8",
"@keyv/sqlite": "^3.6.5",
"@waylaidwanderer/chatgpt-api": "^1.37.0",
"dotenv": "^16.1.3",
"@keyv/postgres": "^1.4.9",
"@keyv/redis": "^2.8.0",
"@keyv/sqlite": "^3.6.6",
"@waylaidwanderer/chatgpt-api": "^1.37.3",
"dotenv": "^16.3.1",
"hash.js": "^1.1.7",
"keyv": "^4.5.2",
"keyv": "^4.5.4",
"keyv-file": "^0.2.0",
"markdown-it": "^13.0.1",
"matrix-bot-sdk": "^0.6.3",
"typescript": "^5.0.4",
"znv": "^0.3.2",
"zod": "^3.21.4"
"markdown-it": "^13.0.2",
"matrix-bot-sdk": "0.7.0",
"typescript": "^5.2.2",
"znv": "^0.4.0",
"zod": "^3.22.4"
}
}

View File

@ -76,7 +76,12 @@ async function main() {
client.on("room.failed_decryption", async (roomId, event, error) => {
// handle `m.room.encrypted` event that could not be decrypted
LogService.error("index", `Failed decryption event!\n${{ roomId, event, error }}`);
await client.sendText(roomId, `I couldn't decrypt the message :( Please add me to an unencrypted room.`);
await client.sendText(roomId, `Room key error. I will leave the room, please reinvite me!`);
try {
await client.leaveRoom(roomId);
} catch (e) {
LogService.error("index", `Failed to leave room ${roomId} after failed decryption!`);
}
});
client.on("room.join", async (roomId: string, _event: any) => {

1372
yarn.lock

File diff suppressed because it is too large Load Diff