cycneuramus / signal-aichat Goto Github PK
View Code? Open in Web Editor NEWAn AI chatbot for Signal powered by Google Bard, Bing Chat, ChatGPT, HuggingChat, and llama.cpp
License: GNU Affero General Public License v3.0
An AI chatbot for Signal powered by Google Bard, Bing Chat, ChatGPT, HuggingChat, and llama.cpp
License: GNU Affero General Public License v3.0
Maybe I'm missing something obvious here but I can't get this running.
I want to use only the openai integration.
My compose file looks like this:
version: "3.9"
services:
signald:
image: registry.gitlab.com/signald/signald
container_name: signal-aichat-signald
restart: unless-stopped
volumes:
- ./signald:/signald
bot:
image: ghcr.io/cycneuramus/signal-aichat
container_name: signal-aichat-bot
restart: unless-stopped
env_file:
- .env
volumes:
- ./signald:/signald
I had to remove the user: 1000, 1000 else it was showing errors when communicating with the socket
My .env file is this:
SIGNAL_PHONE_NUMBER=+491xxxxxxx
OPENAI_API_KEY=a-i-i
DEFAULT_MODEL=gpt
DISABLED_MODELS=bing llama
OPENAI_API_BASE=https://api.openai.com/v1
After following the steps, the signald container seems to work and logs when I send a message to myself:
Updating permissions on /signald (for info see "migrating from versions before 0.18.0" on https://signald.org/articles/install/docker/)
10:51:26.214 [main] INFO io.finn.signald.Main - all data migrations complete
10:51:26.218 [main] INFO io.finn.signald.Main - Binding to socket /signald/signald.sock
10:51:26.283 [main] INFO io.finn.signald.Main - Started signald 0.23.2
10:51:27.683 [subscribe] INFO manager-[redacted 33]979 - Created a manager for [redacted 33]979
10:51:28.693 [[redacted 33]979-receiver] INFO manager-[redacted 33]979 - received sent message transcript from device 2
10:51:46.557 [[redacted 33]979-receiver] INFO manager-[redacted 33]979 - received sent message transcript from device 2
However the chatbot itself doesn't seem to do anything:
It's logs show:
Traceback (most recent call last):
File "/home/signal-aichat/signal-aichat.py", line 175, in <module>
anyio.run(main)
File "/home/signal-aichat/.local/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
File "/home/signal-aichat/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/signal-aichat/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
return await func(*args)
File "/home/signal-aichat/signal-aichat.py", line 164, in main
async with Bot(
File "/home/signal-aichat/.local/lib/python3.10/site-packages/semaphore/bot.py", line 167, in __aenter__
self._send_socket = await Socket(self._username,
File "/home/signal-aichat/.local/lib/python3.10/site-packages/semaphore/socket.py", line 51, in __aenter__
self._socket = await (await anyio.connect_unix(sockets[i])).__aenter__()
File "/home/signal-aichat/.local/lib/python3.10/site-packages/anyio/_core/_sockets.py", line 251, in connect_unix
return await get_asynclib().connect_unix(path)
File "/home/signal-aichat/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 1706, in connect_unix
raw_socket.connect(path)
ConnectionRefusedError: [Errno 111] Connection refused
2023-05-14 10:51:27,484 bot: [INFO] Connected to socket (/signald/signald.sock)
2023-05-14 10:51:27,484 bot: [INFO] Handler <ai> registered ('')
2023-05-14 10:51:27,485 bot: [INFO] Bot started
2023-05-14 10:51:27,485 bot: [INFO] Connected to socket (/signald/signald.sock)
2023-05-14 10:51:27,485 bot: [INFO] Bot attempted to subscribe to +********525
2023-05-14 10:51:27,485 bot: [INFO] Job queue started
The readme is a bit vague in the final steps:
And start chatting.
So I assume that I have to talk to it using Note to Self
but that's not working.
Am I missing something obvious here?
Thank you for making this!! Excited to try. What would need to change to be able to support the Claude API? (https://docs.anthropic.com/claude/reference/getting-started-with-the-api).
Any chance of adding support for Ollama?
Not sure if this project is being actively worked on anymore. But I have really enjoyed playing with it to show friends and family a bit about AI without having to setup apps and API keys.
Ollama is another great project for newbies diving into AI.
It would be fantastic to use signal-ai-chat with it.
Thanks for yalls work and effort on this!
If you setup the volumes like that, and don't have the cookies.json file present, docker will create a cookies.json directory.
This is error prone and will cause confusions.
I suggest you to restructure it so that the cookies.json
is in a config
folder, i.e. config/cookies.json
.
Then you'd bind this as ./config:....
fixed
I'd like to use gpt4. Currently, gpt3 is hardcoded
Line 132 in cf05eaf
It would be great to have an option to select which model to use.
My compose file:
https://pastebin.com/i46LQgBS
Commands:
docker compose up -d signald
docker exec -it signal-aichat-signald /bin/bash
Result:
https://i.ibb.co/FXqLhRv/2023-05-09-183533.png
I managed to install the bot.
It was necessary to change the user in docker-compose from 1000:1000 to 0:0.
I added the phone number, connected via qr code.
In .env I added api openai and default_model to gpt.
When I send a message from the same phone number on the group, the console shows:
signal-aichat-signald | 18:03:25.187 [[redacted 33]9c4-receiver] INFO manager-[redacted 33]9c4 - received sent message transcript from device 1
But no response appears in the chat.
When I text from another phone number, I get a message in the console:
signal-aichat-bot | 2023-05-10 18:04:51,988 bot: [INFO] Chat context created for 0g7Ruz0qsQdUFDDUBP5dyVRhodjhmtgK2HX9U/hXyo=+17c52f31-605f-4fe2-862e-5f10e2a6f27e
signal-aichat-bot | 2023-05-10 18:04:51,988 bot: [ERROR] Processing message (139858331620142) by ai failed
signal-aichat-bot | Traceback (most recent call last):
signal-aichat-bot | File "/home/signal-aichat/.local/lib/python3.10/site-packages/semaphore/bot.py", line 128, in _handle_message
signal-aichat-bot | await func(context)
signal-aichat-bot | File "/home/signal-aichat/signal-aichat.py", line 52, in ai
signal-aichat-bot | ctx.data["bing"] = Chatbot(cookie_path="./cookies.json")
signal-aichat-bot | File "/home/signal-aichat/.local/lib/python3.10/site-packages/EdgeGPT.py", line 590, in __init__
signal-aichat-bot | self.cookies = json.load(f)
signal-aichat-bot | File "/usr/local/lib/python3.10/json/__init__.py", line 293, in load
signal-aichat-bot | return loads(fp.read(),
signal-aichat-bot | File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
signal-aichat-bot | return _default_decoder.decode(s)
signal-aichat-bot | File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
signal-aichat-bot | obj, end = self.raw_decode(s, idx=_w(s, 0).end())
signal-aichat-bot | File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
signal-aichat-bot | raise JSONDecodeError("Expecting value", s, err.value) from None
signal-aichat-bot | json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
When starting conversations with the image:
image: ghcr.io/cycneuramus/signal-aichat:master
There is no response and in the logs I can see:
Traceback (most recent call last):
File "/home/signal-aichat/signal-aichat.py", line 6, in <module>
import ai
File "/home/signal-aichat/ai.py", line 8, in <module>
from EdgeGPT import Chatbot as Bing
ImportError: cannot import name 'Chatbot' from 'EdgeGPT' (/home/signal-aichat/.local/lib/python3.10/site-packages/EdgeGPT/__init__.py)
Currently, - if I understand correctly - the whole history of messages gets transmitted for the chat completions.
This is problematic because sometimes the context changes:
You might first ask the chat bot for a recipe on how to make a good paella. And then at a later point want to know about the pros and cons of an FSME vaccination.
It would be great if we had the option to reset the history. This could for instance be done with a command like:
!new
That would also have the additional benefit of lowering the costs as there are less tokens (unnecessarily) transmitted.
2023-10-12 21:27:53,103 bot: [INFO] Connected to socket (/var/run/signald/signald.sock)
2023-10-12 21:27:53,105 bot: [INFO] Handler registered ('')
2023-10-12 21:27:53,106 bot: [INFO] Bot started
2023-10-12 21:27:53,111 bot: [INFO] Connected to socket (/var/run/signald/signald.sock)
Traceback (most recent call last):
File "/home/abdalnablse/signal-aichat/signal_aichat.py", line 64, in main
await bot.start()
File "/home/abdalnablse/.local/lib/python3.10/site-packages/semaphore/bot.py", line 184, in start
self._receive_socket = await Socket(self._username,
File "/home/abdalnablse/.local/lib/python3.10/site-packages/semaphore/socket.py", line 67, in aenter
self.log.info(f"Bot attempted to subscribe to +********{self._username[-3:]}")
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/abdalnablse/signal-aichat/signal_aichat.py", line 69, in
anyio.run(main)
File "/home/abdalnablse/.local/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
return asynclib.run(func, *args, backend_options)
File "/home/abdalnablse/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/abdalnablse/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
return await func(*args)
File "/home/abdalnablse/signal-aichat/signal_aichat.py", line 58, in main
async with Bot(
File "/home/abdalnablse/.local/lib/python3.10/site-packages/semaphore/bot.py", line 179, in aexit
await self._send_socket.aexit(*excinfo)
File "/home/abdalnablse/.local/lib/python3.10/site-packages/semaphore/socket.py", line 74, in aexit
self.log.info(f"Bot attempted to unsubscribe to +******{self._username[-3:]}")
TypeError: 'NoneType' object is not subscriptable
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.