Telegram Bot Architecture
Khám phá quy trình tương tác đa tầng (Multi-stage AI Pipeline) giúp hệ thống thấu hiểu và thực thi các mệnh lệnh ngôn ngữ tự nhiên từ người dùng.
Quy Trình Xử Lý Chuẩn
Một pipeline 4 bước biến một câu lệnh nhập nhằng thành một tác vụ chính xác.
1. AI Routing
Đọc yêu cầu từ người dùng(qua telegram), đoán ý định (Intent Matching) và định tuyến chính xác tới các Function đang có trên hệ thống.
2. Input Extraction
Từ yêu cầu được định tuyến, tách rõ ra các input cần thiết cho Workflow(nếu có).
3. Native Execution
Khi đã có đầy đủ thông tin, AI gọi hàm Workflow để xử lý tương ứng (AWS, Cloudflare, Jenkins...).
4. AI Analysis
Thu thập raw Stdout/Stderr từ hệ thống, gửi lại cho AI để phân tích theo yêu cầu (nếu có).
Hệ Sinh Thái Commands
Phân tích chi tiết ranh giới giữa [Gọi AI xử lý] và [Hệ thống tự xử lý bằng code] cho từng Module.
gcloud compute instances list
<instance-name> và <zone> từ command text
gcloud compute instances start|stop rồi gửi kết quả về Telegram
Hướng Dẫn Cấu Hình Trong Settings
Bot chỉ chạy command khi cấu hình token, user allowlist, menu module và quyền function đều hợp lệ.
1. Configuration & Notifications
- Mở Settings → Configuration → Notifications → Telegram Notifications.
- Nhập Bot Token, giá trị được lưu vào Keychain dưới key
TELEGRAM_BOT_TOKEN. - Nhập Admin User IDs, cách nhau bằng dấu phẩy. Nếu
TELEGRAM_ADMIN_USER_IDStrống, mọi incoming command đều bị reject. - Điều chỉnh Command Poll và Update Batch Limit nếu cần thay đổi tần suất đọc update từ Telegram.
- Dùng Telegram Check → Detect User ID để bắt user ID từ message mới nhất, rồi Send Test tới admin user đã chọn trước khi bật workflow thật.
2. Permission Stack Khi Execute
3. Menu Modules & AI Provider
Settings → Menu Modules hiển thị từng module, số Telegram command tương ứng và lựa chọn AI provider nếu module hỗ trợ AI. Đây là lớp visibility của sidebar, đồng thời là kill-switch cho command thuộc module bị ẩn.
4. Lưu Ý Vận Hành
- Các command có side effect như Jenkins deploy, Cloudflare deploy, AWS workflow, SQL write, GCloud start/stop cần confirmation hoặc quyền rõ ràng trước khi chạy.
- Inline keyboard luôn có fallback nhập tay: user có thể chọn bằng button hoặc gõ số thứ tự, tên, command tương đương.
- Secret/token chỉ lưu qua Settings/Keychain, không hardcode trong Swift source và không đưa vào log.
Phạm Vi Module & Telegram Commands
Danh sách toàn bộ sidebar modules hiện có, tách rõ module đã expose qua Telegram và module chỉ dùng trong app.
GCloud
Google Cloud CLI wrapper.
AWS
AWS CLI ECS workflow runner.
Cloudflare
R2, Workers & Pages management.
Jenkins Deploy
Build and deploy pipeline collections.
SQL AI-Assistant
AI chat for MySQL, Postgres, SQL Server, and Oracle.
Business Document Chat
AI chat over business documents.
Docs to Markdown
Document conversion.
Website Automation
Website testing and NotebookLM Studio automation.
Bi-System Log Monitor
Daily BI log viewer.
Telegram Bot Control
Admin bot command center.
Auto Port Forward
SSH tunnel profiles.
SSH Command Center
Interactive SSH sessions.
Web Embedded
Configurable embedded web pages.
Daily Worker News
Scheduled AI website digests.
Project Packages Manager
GitHub package projects.