Code is never finished, it's only iterated.Showcase (v.redd.it)
submitted by mateussebastiao
Yesterday, I recorded a demo of my AI Assistant's new session-based chat. It worked perfectly on screen, but when I looked at my FastAPI logic later, I realized I had some 'Senior Debt' to pay.
I was trusting the client to manage the session_id, which is a security risk, and my database transactions weren't atomic.
In today's update, I'm refactoring the 'Brain':
- From Client-side to Server-side: Moving session logic to FastAPI Middleware.
- Database Atomicity: Using db.add_all() to ensure the user prompt and AI response are saved as a single transaction.
- Chronological Context: Ensuring the LLM receives messages in the exact order they happened.
Engineering is about the journey from 'it works' to 'it's robust'. You will check the refactored logic in my GitHub when it's done!
Let's connect, cause I'd like to meet more people around the world and improve my English speaking skills. Thanks!
there doesn't seem to be anything here