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.
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
|
|
import requests
|
|
import os
|
|
|
|
def test_export_endpoint():
|
|
# The app runs on port 8000 inside the container.
|
|
# The root_path is /ce, so the full URL is http://localhost:8000/ce/api/companies/export
|
|
url = "http://localhost:8000/ce/api/companies/export"
|
|
|
|
print(f"--- Testing Export Endpoint: GET {url} ---")
|
|
|
|
try:
|
|
response = requests.get(url)
|
|
response.raise_for_status() # Will raise an exception for 4xx/5xx errors
|
|
|
|
# Print the first few hundred characters to verify content
|
|
print("\n--- Response Headers ---")
|
|
print(response.headers)
|
|
|
|
print("\n--- CSV Output (first 500 chars) ---")
|
|
print(response.text[:500])
|
|
|
|
# A simple check
|
|
if "Metric Value" in response.text and "Source URL" in response.text:
|
|
print("\n[SUCCESS] New columns found in export.")
|
|
else:
|
|
print("\n[FAILURE] New columns seem to be missing from the export.")
|
|
|
|
except requests.exceptions.RequestException as e:
|
|
print(f"\n[FAILURE] Could not connect to the endpoint: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
test_export_endpoint()
|
|
|