# kikoyummy115-tech/ai-chatbot-financial architecture

> Architecture diagram of the GitHub repository kikoyummy115-tech/ai-chatbot-financial, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kikoyummy115-tech/ai-chatbot-financial
- Repository: https://github.com/kikoyummy115-tech/ai-chatbot-financial

## Overview

CAVI AI is a conversational financial-information platform for Cambodia–Vietnam investment topics. Its implemented chat workflow runs from the web interface through Flask, which saves the user message, calls the Rasa REST webhook, and stores and returns assistant replies. Rasa’s configured workflows invoke custom financial actions, including investment appraisal, DCF scenarios, investment statistics, and educational calculations. The README also describes multilingual and future verified-data integrations as product direction, not confirmed live capabilities. Relationships involving unsampled Rasa configuration are cited only where documented; no external market-data connection is shown in the inspected code.

Main entry points: [`actions`](https://github.com/kikoyummy115-tech/ai-chatbot-financial/tree/main/actions) (Custom actions), [`flaskapi/app.py`](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/flaskapi/app.py) (Flask API), [`config.yml`](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/config.yml) (Rasa runtime), [`flaskapi/static/js/script.js`](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/flaskapi/static/js/script.js) (Web chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Chat experience"]
  node_webchat["Web chat<br/>[script.js]"]
  node_flask["Flask API<br/>[app.py]"]
end

subgraph group_conversation["Conversation orchestration"]
  node_rasa["Rasa runtime<br/>[config.yml]"]
  node_dialogue["Flows and domain"]
  node_actionserver["Custom actions"]
end

subgraph group_finance["Financial capabilities"]
  node_appraisal["Investment appraisal"]
  node_npv["NPV calculation"]
  node_dcf["DCF scenarios<br/>[actions.py]"]
  node_financialmodel["Financial models<br/>[financial_model.py]"]
  node_basics["Investment basics"]
  node_statistics["Investment statistics"]
  node_investmentdata["Investment figures<br/>[investment.json]"]
end

subgraph group_persistence["Conversation storage"]
  node_conversationdb[("Conversation database<br/>[db.py]")]
end

node_investor(("Investor"))
node_postgres[("PostgreSQL")]
node_marketdata[("Trusted data sources")]

node_investor -->|"asks questions"| node_webchat
node_webchat -->|"sends requests"| node_flask
node_flask -->|"posts messages"| node_rasa
node_rasa -->|"orchestrates flows"| node_dialogue
node_rasa -->|"invokes actions"| node_actionserver
node_flask -->|"reads and writes"| node_conversationdb
node_conversationdb -->|"connects to"| node_postgres
node_actionserver -.->|"includes"| node_appraisal
node_appraisal -->|"calls"| node_npv
node_actionserver -.->|"includes"| node_dcf
node_actionserver -.->|"includes"| node_financialmodel
node_actionserver -.->|"includes"| node_basics
node_actionserver -.->|"includes"| node_statistics
node_statistics -->|"reads figures"| node_investmentdata
node_marketdata -.->|"future integration"| node_actionserver

click node_webchat "https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/flaskapi/static/js/script.js"
click node_flask "https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/flaskapi/app.py"
click node_rasa "https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/config.yml"
click node_dialogue "https://github.com/kikoyummy115-tech/ai-chatbot-financial/tree/main/data/flows"
click node_actionserver "https://github.com/kikoyummy115-tech/ai-chatbot-financial/tree/main/actions"
click node_appraisal "https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/financial_actions.py"
click node_npv "https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/investment_calculations.py"
click node_dcf "https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/actions.py"
click node_financialmodel "https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/financial_model.py"
click node_basics "https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/investment_basics.py"
click node_statistics "https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/investment_statistics.py"
click node_investmentdata "https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/knowledge/investment.json"
click node_conversationdb "https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/flaskapi/db/db.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webchat,node_flask toneBlue
class node_rasa,node_dialogue,node_actionserver,node_postgres,node_marketdata toneAmber
class node_appraisal,node_npv,node_dcf,node_financialmodel,node_basics,node_statistics,node_investmentdata toneMint
class node_conversationdb toneRose
class node_investor toneIndigo
```

## Components

### Chat experience

- [Web chat](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/flaskapi/static/js/script.js): `flaskapi/static/js/script.js`
- [Flask API](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/flaskapi/app.py): `flaskapi/app.py`

### Conversation orchestration

- [Rasa runtime](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/config.yml): `config.yml`
- [Flows and domain](https://github.com/kikoyummy115-tech/ai-chatbot-financial/tree/main/data/flows): `data/flows`
- [Custom actions](https://github.com/kikoyummy115-tech/ai-chatbot-financial/tree/main/actions): `actions`

### Financial capabilities

- [Investment appraisal](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/financial_actions.py): `actions/financial_actions.py`
- [NPV calculation](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/investment_calculations.py): `actions/investment_calculations.py`
- [DCF scenarios](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/actions.py): `actions/actions.py`
- [Financial models](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/financial_model.py): `actions/financial_model.py`
- [Investment basics](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/investment_basics.py): `actions/investment_basics.py`
- [Investment statistics](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/actions/investment_statistics.py): `actions/investment_statistics.py`
- [Investment figures](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/knowledge/investment.json): `knowledge/investment.json`

### Conversation storage

- [Conversation database](https://github.com/kikoyummy115-tech/ai-chatbot-financial/blob/main/flaskapi/db/db.py): `flaskapi/db/db.py`

### Other components

- **Investor**
- **PostgreSQL**
- **Trusted data sources**

## Connections

- Investor → Web chat: asks questions (evidence: `ReadMe.md`)
- Web chat → Flask API: sends requests (evidence: `flaskapi/static/js/script.js`)
- Flask API → Rasa runtime: posts messages (evidence: `flaskapi/app.py`)
- Rasa runtime → Flows and domain: orchestrates flows (evidence: `ReadMe.md`)
- Rasa runtime → Custom actions: invokes actions (evidence: `ReadMe.md`)
- Flask API → Conversation database: reads and writes (evidence: `flaskapi/app.py`)
- Conversation database → PostgreSQL: connects to (evidence: `flaskapi/db/db.py`)
- Custom actions → Investment appraisal: includes (evidence: `actions/financial_actions.py`)
- Investment appraisal → NPV calculation: calls (evidence: `actions/financial_actions.py`)
- Custom actions → DCF scenarios: includes
- Custom actions → Financial models: includes
- Custom actions → Investment basics: includes
- Custom actions → Investment statistics: includes
- Investment statistics → Investment figures: reads figures (evidence: `actions/investment_statistics.py`)
- Trusted data sources → Custom actions: future integration (evidence: `ReadMe.md`)
