Web WEB-12 · Nov 2026
Voice AI chatbot and Symfony REST API
An Angular chatbot that decides by itself whether to answer, draw an image or decline, then its Symfony API with JWT accounts, a database and conversation history. Two web services labs at ISIMA.
AThe context
The first lab is about calling AI web services from a frontend: an LLM to answer, Whisper to transcribe speech and an image generation model. The second lab builds the REST API that takes over: the browser now talks only to it, and it is the API that calls the AIs, stores the messages and protects each user's data.
BWhat I did
- Angular chatbot with keyboard or voice input (microphone recording sent to Whisper, answers read aloud) and image generation
- Routing by the LLM: a first call returns in JSON the action to take (answer, draw, decline) and writes a detailed image prompt; prompt enriched with examples and response parsed tolerantly
- Development proxy that adds the API keys on the server side and works around the image generator's missing CORS headers
- Symfony API: CRUD for authors and linked books (ManyToOne relation, form validation, status codes 201, 204, 404, 409 and 422, serialisation groups to avoid loops), documented with OpenAPI
- Chatbot API: messages stored in the database, context of the last 20 exchanges, images stored on disk, JWT authentication and per-user data isolation (404 rather than 403)
- Front end connected to the API: login screen, history reloaded from one session to the next, conversation clearing
CThe challenge
Moving from direct calls to the AIs to an API meant shifting all the logic to the server without breaking the chatbot's behaviour. Routing by the LLM is the fragile part: without examples in the prompt, “make me a red car” sometimes ended up as a text answer. I also had to handle the slowness of image generation (longer PHP and HTTP timeouts), stop storing images as base64 in MariaDB, and make sure an AI outage records an error message instead of a 500 error.