mirror of
https://github.com/Rarebuffalo/securelens-backend.git
synced 2026-06-19 07:00:30 +00:00
fix backend router to use effective_ai_key instead of ai_api_key
This commit is contained in:
@@ -138,7 +138,7 @@ async def chat_with_scan(
|
|||||||
We load the scan from PostgreSQL using the scan_id, so this works
|
We load the scan from PostgreSQL using the scan_id, so this works
|
||||||
correctly across server restarts and multiple workers.
|
correctly across server restarts and multiple workers.
|
||||||
"""
|
"""
|
||||||
if not settings.ai_api_key:
|
if not settings.effective_ai_key:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=400,
|
status_code=400,
|
||||||
detail="AI Chat is disabled because no AI API key is configured.",
|
detail="AI Chat is disabled because no AI API key is configured.",
|
||||||
@@ -285,12 +285,12 @@ async def list_available_models():
|
|||||||
Lists AI models available to the configured provider.
|
Lists AI models available to the configured provider.
|
||||||
Only meaningful when using the Gemini provider.
|
Only meaningful when using the Gemini provider.
|
||||||
"""
|
"""
|
||||||
if not settings.ai_api_key:
|
if not settings.effective_ai_key:
|
||||||
raise HTTPException(status_code=500, detail="No AI API key is set.")
|
raise HTTPException(status_code=500, detail="No AI API key is set.")
|
||||||
try:
|
try:
|
||||||
from google import genai
|
from google import genai
|
||||||
|
|
||||||
client = genai.Client(api_key=settings.ai_api_key)
|
client = genai.Client(api_key=settings.effective_ai_key)
|
||||||
models = []
|
models = []
|
||||||
for model in client.models.list():
|
for model in client.models.list():
|
||||||
if "generateContent" in model.supported_actions:
|
if "generateContent" in model.supported_actions:
|
||||||
|
|||||||
Reference in New Issue
Block a user