nextcloud / talk-ios

📱😀 Video & audio calls through Nextcloud on iOS
GNU General Public License v3.0
148 stars 91 forks source link

Add Nextcloud Assistant (AI app) support #1631

Open e-caste opened 5 months ago

e-caste commented 5 months ago

Is your feature request related to a problem? Please describe. Is there any plan to integrate Nextcloud Assistant within Talk iOS? I see 3 main use cases:

  1. Same features as on Talk desktop, so suggest message to write, summarize, etc
  2. An LLM chat thread that can be used sort of like a local ChatGPT/HuggingChat, but from the comfort of the Talk UI with the ability to refer to files stored on Nextcloud [this would especially be very cool, I've experimented with it a few months back by calling an LLM through a local API server but I had to start every message with a prefix that would then call a Talk bot]
  3. Being able to call an LLM from within a chat with other people too, sort of like a Telegram group chat with a bot

Describe the solution you'd like LLamaTalk. Or TalkGPT. Anyway, easy access to LLMs within Talk iOS.

Describe alternatives you've considered Writing a custom Talk bot, using other services.

Additional context 🤖😎

e-caste commented 5 months ago

btw, if you want to try integrating Llama into Talk with a command, add this script:

#!/bin/bash

# Check if arguments are provided
if [ "$#" -lt 2 ]; then
    echo "Usage: $0 <user_name> <input_string>"
    exit 1
fi

# Save the first argument as the user name
user_name="$1"

# Remove the first argument from the array
shift

# Concatenate all remaining arguments into one string
input_string="$*"

# Make the curl request
response=$(curl -s -X POST http://<YOUR_LOCAL_AI_ENDPOINT>/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "llama-3-8b-Instruct.Q5_K_M", "messages": [{"role": "user", "content": "'"$input_string"'"}], "temperature": 0.1}')

# Extract the assistant's content from the response using Python
assistant_content=$(echo $response | python -c "import sys, json; print(json.load(sys.stdin)['choices'][0]['message']['content'].strip())")

echo "$user_name:"
echo "> $input_string"
echo
# Print the assistant's content
echo $assistant_content

and add the command: docker exec -it -u www-data nextcloud-aio-nextcloud php occ talk:command:add ai llama "/var/www/html/talk-bot/call_local_ai_api.sh {USER} {ARGUMENTS}" 2 2