Compare commits

..

No commits in common. "464548f338269be77bd0d6ebfefa2647e36a9daf" and "6e0770833e109e47c9035863013a8b71c8af9041" have entirely different histories.

9 changed files with 88 additions and 81 deletions

View File

@ -1,7 +0,0 @@
FROM ollama/ollama
COPY start.sh /start.sh
RUN chmod +x /start.sh
# Standardbefehl zum Starten des Servers
CMD ["/start.sh"]

View File

@ -1,75 +1,84 @@
# ollamarama-matrix-chatbot # ollamarama-matrix
Ollamarama is an AI chatbot for the [Matrix](https://matrix.org/) chat protocol using Ollama. It can roleplay as almost anything you can think of. You can set any default personality you would like. It can be changed at any time, and each user has their own separate chat history with their chosen personality setting. Users can interact with each others chat histories for collaboration if they would like, but otherwise, conversations are separated, per channel, per user.
### Zuerst das Wichtigste: This is based on my earlier project, [infinigpt-matrix](https://github.com/h1ddenpr0cess20/infinigpt-matrix), which uses OpenAI and costs money to use. (Now updated with OpenAI/Ollama model switching)
Dies ist ein Fork von [Dustin Whyte](https://github.com/h1ddenpr0cess20/ollamarama-matrix), welchen ich anschließend in Docker inpelementiert habe. IRC version available at [ollamarama-irc](https://github.com/h1ddenpr0cess20/ollamarama-irc)
Ollamarama ist ein KI-Chatbot für das [Matrix](https://matrix.org/) Chatprotokoll mit Ollama. Er kann fast alles spielen, was Du dir vorstellen kannst. Du kannst jede Standardpersönlichkeit einstellen, die du möchtest. Sie kann jederzeit geändert werden, und jeder Benutzer hat seinen eigenen Chatverlauf mit der von ihm gewählten Persönlichkeitseinstellung. Die Benutzer können mit den Chatverläufen der anderen interagieren, um zusammenzuarbeiten, wenn sie das möchten, aber ansonsten sind die Unterhaltungen getrennt, pro Kanal und pro Benutzer.
Dieser Chatbot kommt zusammen mit dem Ollama Docker, zu finden [hier](https://hub.docker.com/r/ollama/ollama).
Terminal-based version at [ollamarama](https://github.com/h1ddenpr0cess20/ollamarama)
## Setup ## Setup
Installiere dir zuerst Docker. Dies kannst du [hier](https://github.com/h1ddenpr0cess20/ollamarama-matrix) machen. Install and familiarize yourself with [Ollama](https://ollama.ai/), make sure you can run local LLMs, etc.
Anschließend clonst du mein Projekt: You can install and update it with this command:
```
```bash curl https://ollama.ai/install.sh | sh
git clone https://git.techniverse.net/scriptos/ollamarama-matrix
``` ```
Anschließend ins Verzeichnis wechseln und die Konfigurationsdatei für den Matrix-Chatbot konfigurieren:
```bash Once it's all set up, you'll need to [download the models](https://ollama.ai/library) you want to use. You can play with the available ones and see what works best for you. Add those to the config.json file. If you want to use the ones I've included, just run ollama pull _modelname_ for each.
cd ollamarama-matrix && nano data/chatbot/config.json)
You'll also need to install matrix-nio
```
pip3 install matrix-nio
``` ```
In der `config.json` werden die Zugangsdaten für den Chatbot gepflegt. Dieser muss im Vorfeld auf dem Matrix Server erstellt werden. Dies kann [hier](https://app.element.io/) gemacht werden. Set up a [Matrix account](https://app.element.io/) for your bot. You'll need the server, username and password.
Weiterhin können in dieser Konfigurationsdatei weitere Modelle gepflegt werden, welche vom Chatbot anschließend verwendet werden könnten.
In der Datei `start.sh` können weitere Modelle gepflegt werden, welche dann nach dem Starten vom Ollama Docker Container runtergeladen werden. Add those to the config.json file.
Weitere Modelle können [hier](https://ollama.ai/library) geladen werden. ```
python3 ollamarama.py
```
## Use
# Verwendung **.ai _message_** or **botname: _message_**
**.ai _nachricht_** oder **botname: _nachricht_**  Basic usage.
Grundlegende Verwendung.
**.x _benutzer_ _nachricht_** **.x _user_ _message_**
Erlaubt es dir, auf die Chat-Historie eines anderen Benutzers zuzugreifen.  This allows you to talk to another user's chat history.
_benutzer_ ist der Anzeigename des Benutzers, dessen Historie du verwenden möchtest.  _user_ is the display name of the user whose history you want to use
**.persona _persönlichkeit_**
Ändert die Persönlichkeit. Es kann eine Figur, ein Persönlichkeitstyp, ein Objekt, eine Idee, was auch immer sein. Nutze deine Fantasie. **.persona _personality_**
**.custom _eingabeaufforderung_**  Changes the personality. It can be a character, personality type, object, idea, whatever. Use your imagination.
Erlaubt die Verwendung einer benutzerdefinierten Systemaufforderung anstelle der Rollenspielaufforderung.
**.custom _prompt_**
 Allows use of a custom system prompt instead of the roleplaying prompt
**.reset** **.reset**
Verlauf löschen und auf voreingestellte Persönlichkeit zurücksetzen.  Clear history and reset to preset personality
**.stock** **.stock**
Verlauf löschen und ohne Systemaufforderung verwenden.  Clear history and use without a system prompt
**Nur für Admins**
**.model _modell_** **Admin only commands**
Lasse den Modellnamen weg, um das aktuelle Modell und verfügbare Modelle anzuzeigen.
Gib den Modellnamen ein, um das Modell zu wechseln. **.model _model_**
 Omit model name to show current model and available models
 Include model name to change model
**.clear** **.clear**
Setzt den Bot für alle zurück.  Reset bot for everyone

View File

@ -1,3 +1,6 @@
matrix-nio matrix-nio
requests requests
markdown markdown
asyncio
datetime
json

View File

@ -19,7 +19,7 @@
}, },
"ollama": "ollama":
{ {
"api_base": "http://ollama:11434", "api_base": "http://localhost:11434",
"options": "options":
{ {
"temperature": 0.8, "temperature": 0.8,

View File

@ -1,35 +1,16 @@
services: services:
ollama:
image: ollama/ollama
build:
context: .
dockerfile: Dockerfile.ollama
hostname: ollama
container_name: ollama
networks:
dockernet:
ipv4_address: 172.16.0.51
ports:
- "11434:11434"
volumes:
- ./data/ollama/history:/root/.ollama
restart: unless-stopped
matrix-chatbot: matrix-chatbot:
image: matrix-chatbot:latest
build:
context: .
dockerfile: Dockerfile.chatbot
container_name: matrix-chatbot container_name: matrix-chatbot
hostname: matrix-chatbot hostname: matrix-chatbot
build:
context: .
dockerfile: Dockerfile
networks: networks:
dockernet: dockernet:
ipv4_address: 172.16.0.50 ipv4_address: 172.16.0.50
depends_on:
- ollama
volumes: volumes:
- ./data/chatbot/config.json:/app/config.json:ro - ./data/config.json:/app/config.json:ro
restart: unless-stopped restart: unless-stopped
networks: networks:

33
help.txt Normal file
View File

@ -0,0 +1,33 @@
**.ai _message_** or **botname: _message_**
 Basic usage.
**.x _user_ _message_**
 This allows you to talk to another user's chat history.
 _user_ is the display name of the user whose history you want to use
**.persona _personality_**
 Changes the personality. It can be a character, personality type, object, idea, whatever. Use your imagination.
**.custom _prompt_**
 Allows use of a custom system prompt instead of the roleplaying prompt
**.reset**
 Clear history and reset to preset personality
**.stock**
 Clear history and use without a system prompt
**Available at** https://github.com/h1ddenpr0cess20/ollamarama-matrix
~~~
**Admin only commands**
**.model _model_**
 Omit model name to show current model and available models
 Include model name to change model
**.clear**
 Reset bot for everyone

View File

@ -1,12 +0,0 @@
#!/bin/bash
set -x
# Server starten
ollama serve&
# Modelle installieren
ollama pull llama3.1:8b-instruct-q5_K_M
ollama pull llama3.2
wait