Fix and improve the documentation by providing more relevant and illustrative examples.

This commit is contained in:
ben
2025-01-15 21:32:06 +01:00
parent bdbad23c2d
commit 683b1689b9

View File

@@ -34,12 +34,21 @@ Note that it is probably possible to run the project on other GPUs or modern Mac
## How to launch the server ## How to launch the server
Choose the models you wish to use in the docker-compose.yaml file and change the API token in the .env file as follows: Choose the models you wish to use in the docker-compose.yaml file.
```
environment:
- MODELS=....
```
Add an API key to secure server access by adding a `.env` file like this:
``` ```
LLM_API_KEY=1234567890 LLM_API_KEY=1234567890
``` ```
Next, start the servers and their configuration with Docker Compose: Next, start the servers and their configuration with Docker Compose:
```bash ```bash
docker compose up --build -d docker compose up --build -d
``` ```
@@ -50,54 +59,55 @@ The `setup_desktop.sh` script allows for copying a compiled static version of [A
### AIChat essentials ### AIChat essentials
To launch a chatbot while maintaining context: A request to populate a demo database:
```bash ```bash
aichat -m ollama:qwen2.5 -s aichat "10 fictitious identities with username, firstname, lastname and email then display in json format. The data must be realistic, especially from known email domains."
``` ```
With a prompt: Request a snippet of code:
```
aichat -m ollama:qwen2.5-coder:32b -c "if a docker image exist in bash"
```
To launch a chatbot while maintaining context:
```bash ```bash
aichat -m ollama:qwen2.5 --prompt "I want you to act as an English translator, spelling corrector and improver. I will speak to you in any language and you will detect the language, translate it and answer in the corrected and improved version of my text, in English. I want you to only reply the correction, the improvements and nothing else, do not write explanations." aichat -s
``` ```
Pipe a command and transform the result with the LLM: Pipe a command and transform the result with the LLM:
``` ```
ls | aichat -m ollama:qwen2.5 --prompt "transform to json" ps aux | aichat 'which process use the most memory'
```
Using roles:
```
aichat -r short "tcp port of mysql"
``` ```
Go to the [AIChat](https://github.com/sigoden/aichat) website for other possible use cases. Go to the [AIChat](https://github.com/sigoden/aichat) website for other possible use cases.
### Text To Speech ### Text To Speech & Speech To Text
To use text-to-speech, use the script in the `tools/tts.sh` file. For these two features, use the speech.sh script like this:
Example:
``` ```
./tools/tts.sh -l french -v pierre --play "Aujourd'hui, nous sommes le $(date +%A\ %d\ %B\ %Y)." ./speech.sh synthesize --play --lang fr --voice pierre "Bonjour, aujourd'hui nous somme le $(date +%A\ %d\ %B\ %Y)."
``` ./speech.sh transcript --lang fr --filename speech.wav
### Speech To Text
For the Speech to Text functionality, use `tools/stt.sh`.
The function record allows you to use PulseAudio to record the computer's audio (for example, a video in the browser).
The transcription function converts the audio file into text.
Example:
```bash
./tools/stt.sh record -s alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__Speaker__sink.monitor
./tools/stt.sh transcription -f record_20250112_125726.wav -l fr
``` ```
## How to Use Remotely ## How to Use Remotely
The API authentication via Nginx allows you to open the API on the internet and use it remotely. The API authentication via Nginx allows you to open the API on the internet and use it remotely.
By adding a reverse proxy like Caddy in front of it, you can also add TLS encryption. By adding a reverse proxy like Caddy in front of it, you can also add TLS encryption.
This way, you can securely use this environment remotely. This way, you can securely use this environment remotely.
To use script tools in a remote context, use the environment variables TTS_API_HOST and STT_API_HOST and modify AIChat config (~/.config/aichat/config.yaml) . To use script tools in a remote context, use the environment variables TTS_API_HOST and STT_API_HOST and modify AIChat config (~/.config/aichat/config.yaml) .
Example: Example:
``` ```
TTS_API_HOST="https://your-remote-domain" ./tools/tts.sh -l french -v pierre --play "Aujourd'hui, nous sommes le $(date +%A\ %d\ %B\ %Y)." export TTS_API_HOST="https://your-remote-domain"
STT_API_HOST="https://your-remote-domain" ./tools/stt.sh transcription -f speech_20250112_124805.wav -l fr export STT_API_HOST="https://your-remote-domain"
./tools/speech.sh ...
``` ```