Menu

1 / 2

Refactoring my Local AI Assistant: Moving from JSON to SQLite and Plugins (v1.2.0)

DEV Community·Jaime·6 months ago
#kzA01sz5
#comment#python#opensource#refactoring#jarvis
Reading 0:00
15s threshold

A few days ago, I built a local virtual assistant in Python (JARVIS) using Ollama , PyQt6 , and Piper TTS . It was a fun MVP, but as I started using it daily, the architectural flaws became obvious.

Hardcoding tool calls into the main loop made the file massive, and storing conversation history in flat .json files wasn't scalable.

I just released the v1.2.0 update , focusing purely on technical debt and scalability. Here is a breakdown of the refactoring process:

1. The Database Migration (SQLite)

Previously, JARVIS saved facts (like user preferences) and chat history in JSON. I ripped that out and implemented a jarvis_memory.db using SQLite. Now, when the LLM triggers the guardar_recuerdo (save memory) tool, it executes a clean SQL insert.

Note for dev newbies: When using SQLite in a desktop app, make sure to use sys.exit(0) instead of os._exit() on shutdown to prevent WAL (Write-Ahead Logging) corruption!

2.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.