refactor(i18n): translate codebase and documentation to English
- Rewrite README.md, DEPLOY.md and RULES.md in English - Translate module docstring, license string and inline comments - Rename Portuguese state variables (is_agendamento, is_useragenda, is_configia) to English equivalents (is_schedule, is_dailyroutine, is_configai) - Replace Portuguese web-search and file-creation trigger phrases with English keywords
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
# PsAgentAI - Deploy em Servidor
|
||||
# PsAgentAI - Server Deployment
|
||||
|
||||
Deploy como serviço systemd em Debian/Ubuntu para funcionar 24/7 em VPS.
|
||||
Deploy as a systemd service on Debian/Ubuntu to run 24/7 on a VPS.
|
||||
|
||||
---
|
||||
|
||||
## Pré-requisitos no servidor
|
||||
## Prerequisites on the server
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install -y python3 python3-venv python3-pip git ffmpeg
|
||||
```
|
||||
|
||||
Habilite o journal se quiser logs persistentes (opcional):
|
||||
Enable journal if you want persistent logs (optional):
|
||||
|
||||
```bash
|
||||
sudo apt install -y systemd-journal-remote
|
||||
@@ -19,58 +19,58 @@ sudo apt install -y systemd-journal-remote
|
||||
|
||||
---
|
||||
|
||||
## 1) Copie o projeto para o servidor
|
||||
## 1) Copy the project to the server
|
||||
|
||||
Use git ou scp/rsync. Exemplo com git:
|
||||
Use git or scp/rsync. Example with git:
|
||||
|
||||
```bash
|
||||
cd /opt
|
||||
sudo git clone <URL_DO_REPOSITORIO> psagentai
|
||||
sudo git clone <REPOSITORY_URL> psagentai
|
||||
sudo chown -R $USER:$USER /opt/psagentai
|
||||
cd /opt/psagentai/app
|
||||
```
|
||||
|
||||
Ajuste o caminho no serviço systemd para o diretório real:
|
||||
Adjust the path in the systemd service to the real directory:
|
||||
|
||||
```bash
|
||||
nano psagentai.service
|
||||
# altere /home/marco/PsAgentAI/app para /opt/psagentai/app
|
||||
# change /home/marco/PsAgentAI/app to /opt/psagentai/app
|
||||
```
|
||||
|
||||
> O serviço usa `User=marco` por padrão. Crie o usuário se não existir:
|
||||
> The service uses `User=marco` by default. Create the user if it doesn't exist:
|
||||
> ```bash
|
||||
> sudo useradd -m -s /bin/bash marco || true
|
||||
> sudo usermod -aG sudo marco
|
||||
> ```
|
||||
> Ou edite `User=` no `.service` para o usuário existente do seu VPS.
|
||||
> Or edit `User=` in the `.service` to an existing user on your VPS.
|
||||
|
||||
---
|
||||
|
||||
## 2) Configure o `.env`
|
||||
## 2) Configure `.env`
|
||||
|
||||
```bash
|
||||
cp .env.example .env # se existir exemplo
|
||||
cp .env.example .env # if example exists
|
||||
nano .env
|
||||
```
|
||||
|
||||
Preencha obrigatoriamente:
|
||||
Fill in the required fields:
|
||||
|
||||
- `TELEGRAM_BOT_TOKEN`
|
||||
- `TELEGRAM_CHAT_ID`
|
||||
- `AI_PROVIDER` (`openrouter`, `stepfun`, `qwencloud` ou `llamacpp`)
|
||||
- `AI_PROVIDER` (`openrouter`, `stepfun`, `qwencloud` or `llamacpp`)
|
||||
- `DEFAULT_MODEL`
|
||||
- pelo menos a chave de IA correspondente ao provider escolhido
|
||||
- at least the AI key corresponding to the chosen provider
|
||||
|
||||
Ajuste opcionalmente:
|
||||
Optionally adjust:
|
||||
|
||||
- `MIN_INTERVAL_MINUTES` / `MAX_INTERVAL_MINUTES`
|
||||
- `MIN_MESSAGE_LINES`
|
||||
|
||||
> Importante: no Telegram, envie `/start` uma vez para o bot antes de ligar o serviço, caso contrário ele não conseguirá enviar mensagens iniciantes.
|
||||
> Important: on Telegram, send `/start` once to the bot before turning on the service, otherwise it won't be able to send starting messages.
|
||||
|
||||
---
|
||||
|
||||
## 3) Instale as dependências
|
||||
## 3) Install dependencies
|
||||
|
||||
```bash
|
||||
sudo apt install -y ffmpeg
|
||||
@@ -80,26 +80,26 @@ chmod +x iniciar.sh
|
||||
./iniciar.sh
|
||||
```
|
||||
|
||||
Esse script cria o `venv`, instala dependências e valida as variáveis do `.env`.
|
||||
This script creates the `venv`, installs dependencies and validates the `.env` variables.
|
||||
|
||||
Se o comando acima não instalar `ffmpeg` na versão esperada, use também:
|
||||
If the above command doesn't install the expected `ffmpeg` version, also use:
|
||||
|
||||
```bash
|
||||
sudo apt install -y ffmpeg
|
||||
```
|
||||
|
||||
> O reconhecimento de voz usa `SpeechRecognition` + `pydub` + `ffmpeg`.
|
||||
> Voice recognition uses `SpeechRecognition` + `pydub` + `ffmpeg`.
|
||||
|
||||
---
|
||||
|
||||
## 4) Instale o serviço systemd
|
||||
## 4) Install the systemd service
|
||||
|
||||
```bash
|
||||
# caminho absoluto no seu servidor
|
||||
# absolute path on your server
|
||||
sudo nano /etc/systemd/system/psagentai.service
|
||||
```
|
||||
|
||||
Conteúdo mínimo:
|
||||
Minimum content:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
@@ -121,7 +121,7 @@ StandardError=journal
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
Ative e inicie:
|
||||
Enable and start:
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
@@ -131,25 +131,25 @@ sudo systemctl start psagentai
|
||||
|
||||
---
|
||||
|
||||
## 5) Comandos úteis
|
||||
## 5) Useful commands
|
||||
|
||||
```bash
|
||||
# status
|
||||
sudo systemctl status psagentai
|
||||
|
||||
# logs em tempo real
|
||||
# real-time logs
|
||||
sudo journalctl -u psagentai -f
|
||||
|
||||
# reiniciar após atualização
|
||||
# restart after update
|
||||
sudo systemctl restart psagentai
|
||||
|
||||
# parar
|
||||
# stop
|
||||
sudo systemctl stop psagentai
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6) Atualizações futuras
|
||||
## 6) Future updates
|
||||
|
||||
```bash
|
||||
cd /opt/psagentai/app
|
||||
@@ -160,70 +160,70 @@ sudo systemctl restart psagentai
|
||||
|
||||
---
|
||||
|
||||
## 7) Múltiplos usuários / VPSs
|
||||
## 7) Multiple users / VPSs
|
||||
|
||||
Cada instância do sistema é independente por chat ID do Telegram.
|
||||
Each system instance is independent by Telegram chat ID.
|
||||
|
||||
Para cada novo usuário/VPS:
|
||||
For each new user/VPS:
|
||||
|
||||
1. Crie o bot via @BotFather (`/newbot`) e pegue o token.
|
||||
2. Copie o projeto em um diretório separado, por exemplo `/opt/psagentai-user2`.
|
||||
3. Crie um `.env` próprio com `TELEGRAM_BOT_TOKEN`, `TELEGRAM_CHAT_ID` e suas chaves de IA.
|
||||
4. Instale dependências com `./iniciar.sh`.
|
||||
5. Crie um serviço systemd separado, ex: `psagentai-user2.service`, apontando para esse diretório.
|
||||
6. Habilite e inicie.
|
||||
1. Create the bot via @BotFather (`/newbot`) and get the token.
|
||||
2. Copy the project to a separate directory, for example `/opt/psagentai-user2`.
|
||||
3. Create your own `.env` with `TELEGRAM_BOT_TOKEN`, `TELEGRAM_CHAT_ID` and your AI keys.
|
||||
4. Install dependencies with `./iniciar.sh`.
|
||||
5. Create a separate systemd service, ex: `psagentai-user2.service`, pointing to that directory.
|
||||
6. Enable and start.
|
||||
|
||||
Nomes recomendados para evitar conflito:
|
||||
Recommended names to avoid conflicts:
|
||||
|
||||
- `/opt/psagentai-user1/`, `/opt/psagentai-user2/`
|
||||
- `psagentai-user1.service`, `psagentai-user2.service`
|
||||
|
||||
---
|
||||
|
||||
## 8) Variáveis do `.env`
|
||||
## 8) `.env` variables
|
||||
|
||||
| Variável | Obrigatória | Descrição |
|
||||
| Variable | Required | Description |
|
||||
|---|---|---|
|
||||
| `AI_PROVIDER` | não | Provider preferencial: `openrouter`, `stepfun`, `qwencloud` ou `llamacpp` |
|
||||
| `TELEGRAM_BOT_TOKEN` | sim | Token do bot do Telegram |
|
||||
| `TELEGRAM_CHAT_ID` | sim | Chat ID do usuário |
|
||||
| `DEFAULT_MODEL` | sim | Modelo de IA padrão |
|
||||
| `OPENROUTER_API_KEY` | 1 das chaves | Chave OpenRouter |
|
||||
| `STEPFUN_API_KEY` | 1 das chaves | Chave StepFun |
|
||||
| `QWENCLOUD_API_KEY` | 1 das chaves | Chave QwenCloud |
|
||||
| `MIN_INTERVAL_MINUTES` | não | Intervalo mínimo para mensagens proativas |
|
||||
| `MAX_INTERVAL_MINUTES` | não | Intervalo máximo para mensagens proativas |
|
||||
| `MIN_MESSAGE_LINES` | não | Mínimo de linhas por mensagem do agente |
|
||||
| `AUTO_ENRICH_EVERY` | não | Enriquece perfil a cada N mensagens |
|
||||
| `AUTO_IMPROVE_EVERY` | não | Melhoria automática a cada N mensagens |
|
||||
| `UPLOAD_CONTEXT_MAX_CHARS` | não | Limite de caracteres do upload enviado para a IA (`0` = sem limite) |
|
||||
| `VISION_MODEL` | não | Modelo de IA para análise de imagens |
|
||||
| `VISION_PROVIDER` | não | Provider do modelo de visão (`openrouter`, `stepfun`, `qwencloud`) |
|
||||
| `AI_PROVIDER` | no | Preferred provider: `openrouter`, `stepfun`, `qwencloud` or `llamacpp` |
|
||||
| `TELEGRAM_BOT_TOKEN` | yes | Telegram bot token |
|
||||
| `TELEGRAM_CHAT_ID` | yes | User chat ID |
|
||||
| `DEFAULT_MODEL` | yes | Default AI model |
|
||||
| `OPENROUTER_API_KEY` | 1 of the keys | OpenRouter key |
|
||||
| `STEPFUN_API_KEY` | 1 of the keys | StepFun key |
|
||||
| `QWENCLOUD_API_KEY` | 1 of the keys | QwenCloud key |
|
||||
| `MIN_INTERVAL_MINUTES` | no | Minimum interval for proactive messages |
|
||||
| `MAX_INTERVAL_MINUTES` | no | Maximum interval for proactive messages |
|
||||
| `MIN_MESSAGE_LINES` | no | Minimum lines per agent message |
|
||||
| `AUTO_ENRICH_EVERY` | no | Enriches profile every N messages |
|
||||
| `AUTO_IMPROVE_EVERY` | no | Auto improvement every N messages |
|
||||
| `UPLOAD_CONTEXT_MAX_CHARS` | no | Character limit of upload sent to AI (`0` = no limit) |
|
||||
| `VISION_MODEL` | no | AI model for image analysis |
|
||||
| `VISION_PROVIDER` | no | Vision model provider (`openrouter`, `stepfun`, `qwencloud`) |
|
||||
|
||||
---
|
||||
|
||||
## Comandos úteis via Telegram
|
||||
## Useful commands via Telegram
|
||||
|
||||
- `/veria` — mostra o provider e o modelo de IA atuais
|
||||
- `/configia` — configura interativamente o provider e o modelo de IA
|
||||
- `/veriavision` — mostra o provider e o modelo de visão atuais
|
||||
- `/configiavision` — configura interativamente o modelo de visão
|
||||
- `/about` — exibe informações do sistema, versão, autor e licença
|
||||
- `/viewai` — shows current AI provider and model
|
||||
- `/configai` — interactively configures AI provider and model
|
||||
- `/viewvision` — shows current vision provider and model
|
||||
- `/configvision` — interactively configures vision model
|
||||
- `/about` — displays system information, version, author and license
|
||||
|
||||
---
|
||||
|
||||
## 9) Backups importantes
|
||||
## 9) Important backups
|
||||
|
||||
Faça backup regular dos arquivos de dados dentro de `/app`:
|
||||
Regularly backup the data files inside `/app`:
|
||||
|
||||
- `user_profile.json`
|
||||
- `agent_profile.json`
|
||||
- `system_improvements.json`
|
||||
- `uploads_metadata.json`
|
||||
- pasta `contexts/`
|
||||
- pasta `workspace/`
|
||||
- `contexts/` folder
|
||||
- `workspace/` folder
|
||||
|
||||
Exemplo simples de backup diário:
|
||||
Simple daily backup example:
|
||||
|
||||
```bash
|
||||
tar czf /root/backups/psagentai-$(date +%F).tar.gz -C /opt/psagentai/app user_profile.json agent_profile.json system_improvements.json uploads_metadata.json contexts workspace
|
||||
@@ -231,9 +231,9 @@ tar czf /root/backups/psagentai-$(date +%F).tar.gz -C /opt/psagentai/app user_pr
|
||||
|
||||
---
|
||||
|
||||
## 10) Segurança
|
||||
## 10) Security
|
||||
|
||||
- Nunca comite o `.env` no repositório.
|
||||
- Restrinja permissões: `chmod 600 .env`.
|
||||
- Use um usuário exclusivo para cada instância do serviço.
|
||||
- Para maior isolamento, execute cada instância em um container Docker separado ou em VMs distintas.
|
||||
- Never commit `.env` to the repository.
|
||||
- Restrict permissions: `chmod 600 .env`.
|
||||
- Use an exclusive user for each service instance.
|
||||
- For greater isolation, run each instance in a separate Docker container or on distinct VMs.
|
||||
|
||||
Reference in New Issue
Block a user