This commit resolves all outstanding issues with the AI Insights feature.
- Corrects the transcript formatting logic in to properly handle the database JSON structure, ensuring the AI receives the correct context.
- Fixes the Gemini API client by using the correct model name ('gemini-2.0-flash') and the proper client initialization.
- Updates to securely pass the API key as an environment variable to the container.
- Cleans up the codebase by removing temporary debugging endpoints.
- Adds script for programmatic updates.
- Updates documentation with troubleshooting insights from the implementation process.
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
|
|
import sys
|
|
import os
|
|
import logging
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'company-explorer')))
|
|
|
|
from backend.database import SessionLocal, Company
|
|
|
|
def check_db_content():
|
|
db = SessionLocal()
|
|
try:
|
|
print("--- Checking content of 'companies' table ---")
|
|
companies = db.query(Company).limit(5).all()
|
|
|
|
if not companies:
|
|
print("!!! FATAL: The 'companies' table is EMPTY.")
|
|
# Let's check if the table is there at all
|
|
try:
|
|
count = db.query(Company).count()
|
|
print(f"Row count is confirmed to be {count}.")
|
|
except Exception as e:
|
|
print(f"!!! Could not even count rows. The table might be corrupt. Error: {e}")
|
|
|
|
else:
|
|
print(f"Found {len(companies)} companies. Data seems to be present.")
|
|
for company in companies:
|
|
print(f" - ID: {company.id}, Name: {company.name}")
|
|
|
|
finally:
|
|
db.close()
|
|
|
|
if __name__ == "__main__":
|
|
check_db_content()
|