Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

Application had multiple blocking issues: duplicate code in user module, incorrect database queries referencing non-existent columns, legacy Flask code mixed with FastAPI, and OpenAI client initialization failing at import time.

Changes

Database Query Fixes

  • vox/user.py, vox/chat.py, vox/recordings.py, vox/socketio_handlers.py: Fixed queries that incorrectly referenced session_id on users table. Schema uses sessions table to link sessions to users:
# Before (broken)
user = await conn.fetchrow("SELECT * FROM users WHERE session_id = $1", sid)

# After (correct)
session_row = await conn.fetchrow("SELECT user_id FROM sessions WHERE session_id = $1", sid)
user = await conn.fetchrow("SELECT * FROM users WHERE user_id = $1", session_row["user_id"])

Code Cleanup

  • vox/user.py: Removed duplicate module content (entire file was duplicated with slight variations)
  • vox/socket_handlers.py: Deleted legacy Flask-style socket handler that was incompatible with FastAPI

OpenAI Client Fix

  • vox/llm.py: Changed from module-level client initialization to lazy factory pattern to prevent import failures when API key is unset

Graceful Startup

  • vox/fastapi_app.py: App now starts without database connection for local development

Frontend Fixes

  • static/scripts.js: Fixed undefined pitch/hnr variables in socket handler, fixed references to non-existent DOM elements, added missing sendChat() function

Dependencies

  • requirements.txt: Added missing itsdangerous, bcrypt
  • init_db.py: Fixed schema path from 0.1.7/docs/ to docs/
Original prompt

I want you to make this functional and create issues if needed for additional bugs and problems we might occur.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…AI API

Co-authored-by: shelbeely <2256469+shelbeely@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix bugs and create issues for additional problems Fix application startup bugs and database query inconsistencies Nov 28, 2025
Copilot AI requested a review from shelbeely November 28, 2025 15:31
@shelbeely
Copy link
Owner

@copilot Is this fully OpenRouter compatible?

Copy link
Contributor Author

Copilot AI commented Nov 29, 2025

@copilot Is this fully OpenRouter compatible?

Yes, the code is fully OpenRouter compatible. The vox/llm.py module uses the OpenAI Python client configured for OpenRouter:

  • Base URL: OPENROUTER_API_BASE env var (defaults to https://openrouter.ai/api/v1)
  • API Key: OPENROUTER_API_KEY env var
  • Model: google/gemini-2.0-flash-001 (OpenRouter model format)

All LLM calls (chat_with_llm(), generate_feedback()) go through this centralized module. Just set your OPENROUTER_API_KEY in your .env file and it will work.

@shelbeely shelbeely marked this pull request as ready for review November 29, 2025 18:22
@shelbeely shelbeely merged commit 1c2ee33 into main Nov 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants