---
title: ryfg
canonical_url: "https://www.modelscope.ai/studios/tendied/ryfg"
md_url: "https://www.modelscope.ai/studios/tendied/ryfg.md"
repository: tendied/ryfg
last_updated: 2026-09-11
sdk_type: docker
sdk_version: 6.17.3
downloads: 0
stars: 2
---

# ryfg

> ryfg - An interactive demo by tendied on ModelScope. Telegram AI Bot on ModelScope (Docker + Node.js)

tendied/ryfg is an interactive demo (Studio) on ModelScope. built with docker 6.17.3.

- **Repository**: tendied/ryfg
- **SDK**: docker
- **SDK version**: 6.17.3
- **Downloads**: 0
- **Stars**: 2
- **Last updated**: 2026-09-11

Source: https://www.modelscope.ai/studios/tendied/ryfg

---

# Telegram AI Bot on ModelScope (Docker + Node.js)

A Telegram AI chatbot powered by the **Mistral AI** API (`mistral-medium-latest`).
Packaged as a Docker container (Node.js) so it runs on ModelScope Studios.

Bot: [@neuro_tenaimodel_bot](https://t.me/neuro_tenaimodel_bot)

## How it works
- `Dockerfile` builds a `node:20-slim` image.
- `index.js` runs:
  1. A tiny Express HTTP server on port `7860` (health checks + status page).
  2. The Telegram bot via long polling (receives messages without a public webhook URL).
- Commands:
  - `/start` → replies `hello`
  - `/clear` → clears the conversation history for your chat
- Any other text message is sent to the **Mistral AI** chat completions API and the
  reply is sent back to the user. Per-chat history (last 12 turns) is kept in memory
  for conversational context.

## Files
- `index.js` — bot + Mistral client + HTTP server
- `package.json` — dependencies (`express`, `node-telegram-bot-api`)
- `Dockerfile` — container definition
- `.dockerignore` / `.gitignore`

## Configuration (environment variables)
Set these in the ModelScope studio's environment settings
(Studio → Settings → Environment Variables):

| Variable          | Required | Default                  | Description                         |
|-------------------|----------|--------------------------|-------------------------------------|
| `BOT_TOKEN`       | yes      | —                        | Telegram bot token from @BotFather  |
| `MISTRAL_API_KEY` | yes      | —                        | API key from https://console.mistral.ai |
| `MISTRAL_MODEL`   | no       | `mistral-medium-latest`  | Mistral model to use                |
| `SYSTEM_PROMPT`   | no       | (helpful assistant)      | System prompt for the AI            |
| `MAX_HISTORY`     | no       | `12`                     | Conversation turns kept per chat    |

## Run locally
```bash
npm install
BOT_TOKEN=<telegram token> MISTRAL_API_KEY=<mistral key> PORT=7860 npm start
# then open http://localhost:7860 and message your bot on Telegram
```

## Run with Docker
```bash
docker build -t ryfg-telegram-bot .
docker run -p 7860:7860 \
  -e BOT_TOKEN=<telegram token> \
  -e MISTRAL_API_KEY=<mistral key> \
  ryfg-telegram-bot
```

#### Clone with HTTP
```bash
git clone https://www.modelscope.ai/studios/tendied/ryfg.git
```
