# kawtherah/project2-reception-robot architecture

> Architecture diagram of the GitHub repository kawtherah/project2-reception-robot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kawtherah/project2-reception-robot
- Repository: https://github.com/kawtherah/project2-reception-robot

## Overview

##### Project type and purpose
- This is a hybrid chatbot project (“Reception Robot”) combining a static web front-end (Panel.html + ss.css) and a Python-based voice interface module (watson-streaming-stt) that together interact with IBM Watson cloud services (Assistant, Speech-to-Text, Text-to-Speech).
- The overall goal is to receive customer queries (via text or spoken language), interpret intent/entities via Watson Assistant, respond via text on the web panel or synthesized speech, and log customer satisfaction.

##### File structure
Top-level:
- Panel.html / ss.css – the static web UI for the chatbot
- skill-Recommendation-Chatbot-skill.json – Assistant skill configuration (intents/entities/dialog)
- README.md – high-level project description
watson-streaming-stt/ (voice module):
- transcribe.py – Python script orchestrating STT → Assistant → TTS
- speech.cfg – credentials & endpoint config for Watson STT/TTS
- chatpotResponse.txt, UserInput.txt, OutputAsSpeech.mp3 – I/O artifacts for prototyping
- requirements.txt, setup.py – Python package & dependency config

##### README for additional insights
- The README highlights three Watson Assistant components (Intent, Entities, Dialog) and a separate “Voice Chatbot” task using IBM Watson services with Python.
- There is a deployed static web version (GitHub Pages) and a downloadable skill JSON.

##### Main components & interactions
a. Components
1) Web Front-End: Panel.html + ss.css (+ JavaScript logic to call APIs)
2) Voice Backend Service: Python module (transcribe.py)
3) IBM Watson Assistant service (cloud)
4) IBM Watson Speech-to-Text service (cloud)
5) IBM Watson Text-to-Speech service (cloud)
6) Optional Local File Store (UserInput.txt, chatpotResponse.txt, OutputAsSpeech.mp3) for prototyping/logging
b. Relationships / Data flows
- Text Chat Flow:
User types → Front-End JS → Watson Assistant API → Assistant returns JSON → Front-End renders response
- Voice Chat Flow:
User speaks → Python transcribe.py streams audio → Watson STT → transcripts written to UserInput.txt → Python sends transcript to Watson Assistant → assistant JSON response → Python calls Watson TTS → OutputAsSpeech.mp3 → front-end or local player plays audio
- In both flows, the Assistant skill (skill-Recommendation-Chatbot-skill.json) drives intent/entity extraction and dialog decisions.
c. Architectural patterns / design principles
- Separation of concerns: static UI vs. voice-processing backend
- API-driven microservice interaction: Python service and front-end each call IBM Cloud APIs
- Config-driven connectors: speech.cfg & setup.py manage credentials and dependencies
d. Key technologies
- Front-end: HTML, CSS, JavaScript (fetch or SDK for Assistant)
- Backend: Python 3.x, requests or IBM Watson SDK for Python
- Cloud services: IBM Watson Assistant, Speech-to-Text, Text-to-Speech

##### Elements
- Front-End (blue), Backend service (green), External cloud services (orange), Data stores/logs (gray)
- Annotations for configs (speech.cfg, skill JSON) attached to respective components

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Devices"
        Browser["Browser"]:::frontend
        Mic["Microphone"]:::frontend
    end

    subgraph "Front-End UI"
        Panel["Panel.html"]:::frontend
        SS["ss.css"]:::frontend
    end

    Browser --> Panel
    Panel -->|"HTTP REST"| ASST
    Panel --> SS

    subgraph "Voice Backend Service"
        Trans["transcribe.py"]:::backend
        click Trans "https://github.com/kawtherah/project2-reception-robot/blob/main/watson-streaming-stt/transcribe.py"
        CFG["speech.cfg"]:::backend
        click CFG "https://github.com/kawtherah/project2-reception-robot/blob/main/watson-streaming-stt/speech.cfg"
        Req["requirements.txt"]:::backend
        click Req "https://github.com/kawtherah/project2-reception-robot/blob/main/watson-streaming-stt/requirements.txt"
        SU["setup.py"]:::backend
        click SU "https://github.com/kawtherah/project2-reception-robot/blob/main/watson-streaming-stt/setup.py"
        SC["setup.cfg"]:::backend
        click SC "https://github.com/kawtherah/project2-reception-robot/blob/main/watson-streaming-stt/setup.cfg"
    end

    Mic --> Trans
    Trans -->|"audio stream"| STT
    STT -->|"transcript"| Trans
    Trans -->|"REST API"| ASST
    ASST -->|"JSON response"| Trans
    Trans -->|"TTS request"| TTS
    TTS -->|"audio"| Trans

    subgraph "IBM Cloud Services"
        STT["Watson Speech-to-Text"]:::cloud
        ASST["Watson Assistant\n(skill JSON)"]:::cloud
        click ASST "https://github.com/kawtherah/project2-reception-robot/blob/main/skill-Recommendation-Chatbot-skill.json"
        TTS["Watson Text-to-Speech"]:::cloud
    end

    subgraph "Local Artifacts"
        UI["UserInput.txt"]:::datastore
        click UI "https://github.com/kawtherah/project2-reception-robot/blob/main/watson-streaming-stt/UserInput.txt"
        CR["chatpotResponse.txt"]:::datastore
        click CR "https://github.com/kawtherah/project2-reception-robot/blob/main/watson-streaming-stt/chatpotResponse.txt"
        MP3["OutputAsSpeech.mp3"]:::datastore
        click MP3 "https://github.com/kawtherah/project2-reception-robot/blob/main/watson-streaming-stt/OutputAsSpeech.mp3"
    end

    Trans --> UI
    Trans --> CR
    Trans --> MP3

    subgraph "Documentation"
        R1["README.md"]:::datastore
        click R1 "https://github.com/kawtherah/project2-reception-robot/blob/main/README.md"
        R2["README.rst"]:::datastore
        click R2 "https://github.com/kawtherah/project2-reception-robot/blob/main/watson-streaming-stt/README.rst"
    end

    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef cloud fill:#FFA500,stroke:#000,stroke-width:1px;
    classDef datastore fill:#D3D3D3,stroke:#000,stroke-width:1px;
```
