Dataset Viewer

The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

WorkMate AI Bot

Telegram-first enterprise AI work assistant: multilingual translation, intelligent customer-service Q&A, coding assistance, financial calculations, and project analysis — with a searchable document knowledge base, conversation history, human handoff, and an admin dashboard.

Architecture

Telegram / API channel
        ↓
Channel Integration (webhook with secret verification, message chunking, document download)
        ↓
Security Control (secret redaction · prompt-injection guard · dangerous-operation block · high-stakes disclaimers)
        ↓
Intent Recognition & Routing (slash commands + multilingual keyword heuristics)
   ↙        ↓        ↙
Translation  Customer-service  Programming
   ↘        ↓        ↙
Finance (arithmetic, %, margin, currency, salary, invoice, tax, P&L, CSV/Excel) · Project analysis
        ↓
Pluggable AI model (OpenAI-compatible) + Enterprise Knowledge Base
        ↓
Reply to user, or flag for human support (admin dashboard)

All AI access goes through one pluggable client (app/llm.py) using the standard chat-completions API — swap providers (OpenAI, OpenRouter, Ollama, vLLM, ...) via MODEL_BASE_URL / MODEL_API_KEY. Without a key the bot still runs with safe, deterministic replies (calculations, dataset analysis, knowledge excerpts, handoff).

Quick start

cd C:\Users\heng\Desktop\bot
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
Copy-Item .env.example .env
uvicorn app.main:app --reload
  • API console: http://127.0.0.1:8000/docs
  • Admin dashboard: http://127.0.0.1:8000/admin/ (default login admin / change-me — set ADMIN_USERNAME / ADMIN_PASSWORD in .env before use)
  • Run tests: python -m pytest tests/ -q (40 tests)

Telegram

  1. Create a bot with @BotFather and put its token in .env.
  2. Deploy behind HTTPS and register the webhook with a secret:
https://api.telegram.org/bot<BOT_TOKEN>/setWebhook?url=https://YOUR_DOMAIN/webhooks/telegram&secret_token=YOUR_SECRET

The webhook verifies X-Telegram-Bot-Api-Secret-Token when TELEGRAM_WEBHOOK_SECRET is set. Customers can send text or files (.txt .md .csv .json .pdf .docx .xlsx) — tabular files get an automatic analysis reply; long replies are split to Telegram's 4096-char limit.

Chat commands

Command Purpose
/help, /start Feature overview
/translate <text> Translation (auto language detection: zh/en/th/vi/ar)
/code <text> Code generation / explanation / debugging / error-log analysis (never executed)
/calc <expr> Calculations
/finance, /accounting <text> Accounting assistance (disclaimer + human review)
/project <text> Project feasibility & cost analysis
/human Request human support

API surface

  • POST /chat — channel-neutral chat
  • POST /webhooks/telegram — Telegram updates (secret-verified)
  • GET /health — service health (includes model-configuration state)
  • GET /admin/ — dashboard (login required for API calls)
  • Admin API (Bearer token from POST /admin/login):
    • GET /admin/users, GET /admin/conversations, GET /admin/conversations/{id}
    • PATCH /admin/conversations/{id} — customer tagging / status
    • POST /admin/handoffs/{conversation_id}/resolve — close a human handoff
    • GET|POST /admin/documents, DELETE /admin/documents/{id} — knowledge base
    • GET|POST /admin/faqs, DELETE /admin/faqs/{id} — FAQ management
    • POST /admin/analyze-file — CSV/Excel analysis without storing the file
    • GET /admin/usage — model calls, tokens, latency by intent and day
    • GET /admin/settings, GET /admin/channels

Expert modules (app/modules/)

Module Responsibilities
translation Language detection, literal/business/customer-service tone, formatting preservation
customer_service Company/product/pricing/FAQ answers grounded in the knowledge base with source citations, lead capture, honest "I don't know"
programming Generate/explain/debug code (Python, JS, PHP, Java, SQL, ...), error-log analysis; refuses to execute code or touch production
finance Safe AST arithmetic (never eval), percentages, margins, currency (static indicative rates), salary + overtime, invoices, pre/post-tax, revenue-cost-profit, pasted-CSV analysis
project Total cost, estimated profit, margin, cash-flow risks, missing-input detection, next steps

Routing: app/router.py (slash commands + multilingual keywords for zh/en/th). Security: app/security.py (secret redaction in stored messages, prompt-injection guard, dangerous-operation block, disclaimers for accounting/legal/medical/investment).

Data model (app/models.py)

users, conversations (tag, status, human flag), messages (intent + category: direct / more_info / human), knowledge_documents, knowledge_chunks, human_handoffs, calculations, tasks, usage_logs, admin_users, channel_accounts — SQLite by default; set DATABASE_URL to PostgreSQL for production (add pgvector later for semantic search).

Safety boundaries

  • Accounting, legal, medical, and investment answers always carry an assistance-only disclaimer and are flagged human confirmation required in the dashboard.
  • Code is generated/analyzed only — never executed; dangerous operations (drop tables, production changes, arbitrary command execution) are blocked outright.
  • Secrets (API keys, tokens, passwords) are redacted before storage.
  • Knowledge-base content is treated as untrusted data (never as instructions to the model).
  • Tax results require an explicit country/region and never invent tax rates.

Production notes

  • Use PostgreSQL + Redis/queue workers for ingestion, object storage for original files, signed JWTs for admin auth, encrypted backups, and a reviewed retention policy.
  • Add Facebook Messenger / website widget / WhatsApp as new channels on top of the same core — the channel field and channel_accounts table already unify them.
  • Log and monitor errors, response times, and costs via usage_logs and GET /admin/usage.
Downloads last month
79