How cchioru/tax_legal_final_version works
This repository implements a Thai personal-income-tax advisory chatbot on LINE, with workflow-automated, retrieval-grounded answers and deterministic tax calculations. The main path is a LINE message through n8n’s consent-aware answering flow to a reply or push response; separate branches cover legal-text lookup, feedback, user reports, and a privacy-restricted admin portal. Evaluation scripts support the research and quality-measurement capability. Workflow internals are represented from the README rather than inspected source; their edges cite that documentation.
Main entry points: tax-advisor-workflow.json Event and answer workflow · postgres PostgreSQL tax data · server.js Admin web server · knowledge.js Knowledge management
Components 19
LINE interaction
- LINE Messaging API
- ngrok endpoint
- Reply or push dispatch
n8n/workflows/tax-advisor-workflow.json
Answering workflow
- Event and answer workflow
n8n/workflows/tax-advisor-workflow.json - Consent and routing
n8n/workflows/tax-advisor-workflow.json - AI answer agent
n8n/workflows/tax-advisor-workflow.json - Gemini language model
- Tax and penalty calculator
n8n/tools/tax-calculator.js - Answer checks and formatting
n8n/workflows/tax-advisor-workflow.json
Tax knowledge
- Keyword retrieval
n8n/workflows/tax-advisor-workflow.json - Revenue Code lookup
n8n/workflows/tax-advisor-workflow.json - PostgreSQL tax data
postgres
Admin operations
- Admin web server
admin/server.js - Knowledge management
admin/knowledge.js - Read-only admin database access
admin/db.js - Search preview
admin/retrieval.js - Admin charts and pages
admin/chart.js
Evaluation
- Accuracy and coverage evaluation
evaluation
Other components
- LINE user
Connections 25
- LINE user → LINE Messaging API: sends messages
README.md - LINE Messaging API → ngrok endpoint: webhook events
README.md - ngrok endpoint → Event and answer workflow: forwards events
README.md - Event and answer workflow → Consent and routing: routes events
README.md - Event and answer workflow → Keyword retrieval: retrieves knowledge
README.md - Event and answer workflow → PostgreSQL tax data: stores user data
README.md - Consent and routing → AI answer agent: routes by consent
README.md - Consent and routing → PostgreSQL tax data: records consent
README.md - AI answer agent → Gemini language model: generates answers
README.md - AI answer agent → Tax and penalty calculator: calls tools
README.md - AI answer agent → Revenue Code lookup: calls tools
README.md - AI answer agent → PostgreSQL tax data: stores consented chats
README.md - Keyword retrieval → PostgreSQL tax data: searches knowledge
README.md - Revenue Code lookup → PostgreSQL tax data: reads current code
README.md - Event and answer workflow → Answer checks and formatting: checks and formats
README.md - Event and answer workflow → Reply or push dispatch: selects reply channel
README.md - Reply or push dispatch → LINE Messaging API: sends answer
README.md - Admin web server → Read-only admin database access: queries data
admin/server.js - Admin web server → Knowledge management: routes knowledge pages
admin/server.js - Admin web server → Admin charts and pages: renders dashboard
admin/server.js - Knowledge management → Read-only admin database access: reads and writes entries
admin/knowledge.js - Knowledge management → Search preview: previews searches
admin/knowledge.js - Read-only admin database access → PostgreSQL tax data: queries PostgreSQL
admin/db.js - Accuracy and coverage evaluation → Tax and penalty calculator: measures calculations
evaluation/run-accuracy-test.js - Accuracy and coverage evaluation → Keyword retrieval: checks coverage
evaluation/check-knowledge-coverage.js