bot
This commit is contained in:
parent
054e77a370
commit
6a286fb90b
8 changed files with 384 additions and 6 deletions
25
setup.md
25
setup.md
|
|
@ -19,7 +19,9 @@ npm install
|
|||
```env
|
||||
BOT_TOKEN=your_telegram_bot_token_here
|
||||
BOT_API_ROOT=
|
||||
BOT_CONNECTOR=local-codex
|
||||
BOT_CONNECTOR=agent-api
|
||||
AGENT_API_BASE_URL=http://127.0.0.1:8000
|
||||
AGENT_API_WORKSPACE_DIR=../agent/workspace
|
||||
LOCAL_CODEX_COMMAND=codex
|
||||
LOCAL_CODEX_WORKDIR=
|
||||
LOCAL_CODEX_SKILL_DIR=
|
||||
|
|
@ -48,6 +50,23 @@ npm start
|
|||
|
||||
The bot uses a connector strategy selected by `BOT_CONNECTOR`.
|
||||
|
||||
### `agent-api`
|
||||
|
||||
Connects to the websocket API of the external agent service.
|
||||
|
||||
Relevant variables:
|
||||
|
||||
- `BOT_CONNECTOR=agent-api`
|
||||
- `AGENT_API_BASE_URL=http://127.0.0.1:8000`: base URL of the agent service
|
||||
- `AGENT_API_WORKSPACE_DIR=../agent/workspace`: host path of the shared agent workspace
|
||||
|
||||
How it works:
|
||||
|
||||
- the bot saves incoming files to `assets/`
|
||||
- before sending a request to the agent, it copies message attachments to `AGENT_API_WORKSPACE_DIR/telegram-inbox/...`
|
||||
- the agent receives attachment paths relative to its `/workspace`
|
||||
- if the agent emits `AGENT_EVENT_SEND_FILE`, the bot resolves the file inside `AGENT_API_WORKSPACE_DIR` and uploads it back to Telegram
|
||||
|
||||
### `local-codex`
|
||||
|
||||
Runs the local `codex` CLI with `codex exec` for every supported Telegram message.
|
||||
|
|
@ -160,7 +179,7 @@ Then set this in `.env`:
|
|||
```env
|
||||
BOT_TOKEN=your_telegram_bot_token_here
|
||||
BOT_API_ROOT=http://127.0.0.1:8081
|
||||
BOT_CONNECTOR=local-codex
|
||||
BOT_CONNECTOR=agent-api
|
||||
```
|
||||
|
||||
Restart the bot after that:
|
||||
|
|
@ -174,4 +193,4 @@ npm start
|
|||
- `BOT_API_ROOT` is optional. Leave it empty to use the default Telegram hosted Bot API.
|
||||
- The local Bot API server listens over HTTP by default.
|
||||
- If both the bot and the local Bot API server run on the same machine, `127.0.0.1:8081` is enough.
|
||||
- `BOT_CONNECTOR` defaults to `local-codex` in the current setup.
|
||||
- `BOT_CONNECTOR` can be `agent-api` or `local-codex`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue