docker #1
7
Dockerfile.ollama
Normal file
7
Dockerfile.ollama
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FROM ollama/ollama
|
||||||
|
|
||||||
|
COPY start.sh /start.sh
|
||||||
|
RUN chmod +x /start.sh
|
||||||
|
|
||||||
|
# Standardbefehl zum Starten des Servers
|
||||||
|
CMD ["/start.sh"]
|
81
README.md
81
README.md
@ -1,84 +1,75 @@
|
|||||||
# ollamarama-matrix
|
# ollamarama-matrix-chatbot
|
||||||
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.
|
|
||||||
|
|
||||||
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)
|
### Zuerst das Wichtigste:
|
||||||
|
|
||||||
IRC version available at [ollamarama-irc](https://github.com/h1ddenpr0cess20/ollamarama-irc)
|
Dies ist ein Fork von [Dustin Whyte](https://github.com/h1ddenpr0cess20/ollamarama-matrix), welchen ich anschließend in Docker inpelementiert habe.
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
Install and familiarize yourself with [Ollama](https://ollama.ai/), make sure you can run local LLMs, etc.
|
Installiere dir zuerst Docker. Dies kannst du [hier](https://github.com/h1ddenpr0cess20/ollamarama-matrix) machen.
|
||||||
|
|
||||||
You can install and update it with this command:
|
Anschließend clonst du mein Projekt:
|
||||||
```
|
|
||||||
curl https://ollama.ai/install.sh | sh
|
```bash
|
||||||
|
git clone https://git.techniverse.net/scriptos/ollamarama-matrix
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Anschließend ins Verzeichnis wechseln und die Konfigurationsdatei für den Matrix-Chatbot konfigurieren:
|
||||||
|
|
||||||
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.
|
```bash
|
||||||
|
cd ollamarama-matrix && nano data/chatbot/config.json)
|
||||||
|
|
||||||
You'll also need to install matrix-nio
|
|
||||||
```
|
|
||||||
pip3 install matrix-nio
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Set up a [Matrix account](https://app.element.io/) for your bot. You'll need the server, username and password.
|
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.
|
||||||
|
Weiterhin können in dieser Konfigurationsdatei weitere Modelle gepflegt werden, welche vom Chatbot anschließend verwendet werden könnten.
|
||||||
|
|
||||||
Add those to the config.json file.
|
In der Datei `start.sh` können weitere Modelle gepflegt werden, welche dann nach dem Starten vom Ollama Docker Container runtergeladen werden.
|
||||||
|
|
||||||
```
|
Weitere Modelle können [hier](https://ollama.ai/library) geladen werden.
|
||||||
python3 ollamarama.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Use
|
|
||||||
|
|
||||||
|
|
||||||
**.ai _message_** or **botname: _message_**
|
# Verwendung
|
||||||
|
|
||||||
 Basic usage.
|
**.ai _nachricht_** oder **botname: _nachricht_**
|
||||||
|
|
||||||
|
Grundlegende Verwendung.
|
||||||
**.x _user_ _message_**
|
|
||||||
|
|
||||||
 This allows you to talk to another user's chat history.
|
**.x _benutzer_ _nachricht_**
|
||||||
|
|
||||||
 _user_ is the display name of the user whose history you want to use
|
Erlaubt es dir, auf die Chat-Historie eines anderen Benutzers zuzugreifen.
|
||||||
|
|
||||||
|
_benutzer_ ist der Anzeigename des Benutzers, dessen Historie du verwenden möchtest.
|
||||||
**.persona _personality_**
|
|
||||||
|
|
||||||
 Changes the personality. It can be a character, personality type, object, idea, whatever. Use your imagination.
|
**.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.
|
||||||
|
|
||||||
**.custom _prompt_**
|
**.custom _eingabeaufforderung_**
|
||||||
|
|
||||||
 Allows use of a custom system prompt instead of the roleplaying prompt
|
Erlaubt die Verwendung einer benutzerdefinierten Systemaufforderung anstelle der Rollenspielaufforderung.
|
||||||
|
|
||||||
**.reset**
|
**.reset**
|
||||||
|
|
||||||
 Clear history and reset to preset personality
|
Verlauf löschen und auf voreingestellte Persönlichkeit zurücksetzen.
|
||||||
|
|
||||||
|
|
||||||
**.stock**
|
**.stock**
|
||||||
|
|
||||||
 Clear history and use without a system prompt
|
Verlauf löschen und ohne Systemaufforderung verwenden.
|
||||||
|
|
||||||
|
**Nur für Admins**
|
||||||
|
|
||||||
**Admin only commands**
|
**.model _modell_**
|
||||||
|
|
||||||
|
Lasse den Modellnamen weg, um das aktuelle Modell und verfügbare Modelle anzuzeigen.
|
||||||
|
|
||||||
**.model _model_**
|
Gib den Modellnamen ein, um das Modell zu wechseln.
|
||||||
|
|
||||||
 Omit model name to show current model and available models
|
|
||||||
|
|
||||||
 Include model name to change model
|
|
||||||
|
|
||||||
|
|
||||||
**.clear**
|
**.clear**
|
||||||
|
|
||||||
 Reset bot for everyone
|
Setzt den Bot für alle zurück.
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,4 +215,4 @@ class ollamarama:
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
ollamarama = ollamarama()
|
ollamarama = ollamarama()
|
||||||
asyncio.run(ollamarama.main())
|
asyncio.run(ollamarama.main())
|
@ -1,6 +1,3 @@
|
|||||||
matrix-nio
|
matrix-nio
|
||||||
requests
|
requests
|
||||||
markdown
|
markdown
|
||||||
asyncio
|
|
||||||
datetime
|
|
||||||
json
|
|
@ -19,7 +19,7 @@
|
|||||||
},
|
},
|
||||||
"ollama":
|
"ollama":
|
||||||
{
|
{
|
||||||
"api_base": "http://localhost:11434",
|
"api_base": "http://ollama:11434",
|
||||||
"options":
|
"options":
|
||||||
{
|
{
|
||||||
"temperature": 0.8,
|
"temperature": 0.8,
|
@ -1,16 +1,35 @@
|
|||||||
services:
|
services:
|
||||||
|
|
||||||
matrix-chatbot:
|
ollama:
|
||||||
container_name: matrix-chatbot
|
image: ollama/ollama
|
||||||
hostname: matrix-chatbot
|
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
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:
|
||||||
|
image: matrix-chatbot:latest
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.chatbot
|
||||||
|
container_name: matrix-chatbot
|
||||||
|
hostname: matrix-chatbot
|
||||||
networks:
|
networks:
|
||||||
dockernet:
|
dockernet:
|
||||||
ipv4_address: 172.16.0.50
|
ipv4_address: 172.16.0.50
|
||||||
|
depends_on:
|
||||||
|
- ollama
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/config.json:/app/config.json:ro
|
- ./data/chatbot/config.json:/app/config.json:ro
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
33
help.txt
33
help.txt
@ -1,33 +0,0 @@
|
|||||||
|
|
||||||
**.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
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user