A production-oriented LINE AI assistant backend built with ASP.NET Core, integrating text conversation, image understanding, document analysis, and cloud deployment workflows.
A practical backend foundation with secure webhook handling, background processing, resilient AI routing, and observable operations.
繁體中文 | English
- General user guide: USER_GUIDE.md
- Non-engineer decision and document-review guide (Traditional Chinese): USER_GUIDE_NON_ENGINEER.zh-TW.md
LINE-BOT is an AI assistant backend service that uses the LINE Messaging API as its entry point, designed for these goals:
- Natural language interaction within LINE
- Analyzing images uploaded by users
- Organizing and summarizing uploaded files
- Reducing hallucination risk through a grounded document pipeline
- Running a cloud-ready deployment flow with health verification
It is more than a basic webhook receiver. It includes signature verification, queue-based background dispatch, provider failover support, downloadable outputs, and runtime safeguards for stability.
Most LINE Bot examples only do "receive a message, send a reply."
This project goes several steps further:
- Handles text, image, file, and postback events through dedicated flows
- Adds throttling, short-window merge, response cache, and cooldown protection
- Uses queue + hosted worker to avoid request-thread fire-and-forget patterns
- Adds CI test gate and post-deploy verification before considering release complete
In other words, this repository is closer to an "extensible product foundation" rather than a minimal demo.
|
Processes user text with mention-gate rules, AI replies, optional web search, and quick-reply suggestions. |
Downloads image content and routes it to AI analysis with throttling and cooldown safeguards. |
Extracts document text, selects grounded chunks, generates summary output, and provides a downloadable result link. |
- Built on ASP.NET Core Web API
- Verifies LINE request signatures before any meaningful processing
- Enqueues events into a bounded background queue
- Processes queue items in a hosted worker and dispatches by message/event type
- Per-user throttling
- AI 429 cooldown mechanism
- AI quota exhaustion protection
- Reply caching
- Deduplication of repeated requests within short time windows
- Readiness endpoint with queue-aware operational snapshot
- Extracts document text content first
- Performs chunk organization and grounding
- Generates AI summary at the end
- Produces downloadable markdown output with temporary tokenized access
- Dockerfile included
- CI workflow includes restore, test gate, image build, deploy trigger, and deployment verification
- Clear structure for extending handlers, providers, and document capabilities
This project is particularly well-suited for the following scenarios:
| Scenario | Description |
|---|---|
| Personal AI Assistant | Ask questions and get concise responses directly in LINE |
| Team Knowledge Organization | Upload files and quickly extract highlights, conclusions, and action items |
| Image Content Interpretation | Send an image and receive structured key-point analysis |
| Custom AI Bot Backend | Reuse as a secure, extensible backend foundation |
| Deployment Validation Demo | Demonstrate test-gated CI and post-deploy health verification |
| Type | Description |
|---|---|
| Text message | Conversational AI reply |
| Image message | Image content analysis |
| File message | Document extraction, summarization, and downloadable output |
| Format | Support Status |
|---|---|
.txt |
Supported |
.md |
Supported |
.csv |
Supported |
.json |
Supported |
.xml |
Supported |
.log |
Supported |
.pdf |
Supported for text-extractable PDFs |
.docx |
Supported |
.xlsx |
Supported |
.pptx |
Supported |
- Scanned PDFs are not yet supported
- Image-only PDFs are not yet supported
- Binary file summarization is not yet supported
- Process-local runtime state is not shared across instances
LINE Platform
|
v
POST /api/line/webhook
|
+-- Verify x-line-signature
+-- Parse webhook events
+-- Enqueue to bounded background queue
|
v
WebhookBackgroundService (hosted worker)
|
v
Dispatcher
| | | \
| | | +-- Postback handling
| | +------------ FileMessageHandler
| +-------------------- ImageMessageHandler
+---------------------------- TextMessageHandler (mention gate in group/room)
|
+-- AI Failover Service
+-- Web Search Service (optional)
+-- Cache / Throttle / Backoff / Merge
Other HTTP endpoints:
- GET /
- GET /health
- GET /ready
- GET /downloads/{token}