Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -424,7 +424,7 @@ def v1beta3_google_ai(item: ChatgptCustom, api_key: None = Depends(validate_api_
|
|
424 |
response_model=SuccessResponse,
|
425 |
responses={422: {"model": ErrorStatus}},
|
426 |
)
|
427 |
-
def gemini_pro(item: GeminiPro):
|
428 |
owner_base = TruAI
|
429 |
if item.is_multi_chat:
|
430 |
selected_api_key = ASSISTANT_GOOGLE_API_KEYS or item.gemini_api_key
|
@@ -436,14 +436,12 @@ def gemini_pro(item: GeminiPro):
|
|
436 |
user_id=item.user_id
|
437 |
)
|
438 |
cybersecuritydb(item.user_id, item.mongo_url)
|
439 |
-
answer, gemini_chat = geni._GeminiLatest__get_response_gemini(item.query)
|
440 |
return SuccessResponse(
|
441 |
status="True", randydev={"message": answer, "chat_history": gemini_chat}
|
442 |
)
|
443 |
-
except Exception:
|
444 |
-
return SuccessResponse(
|
445 |
-
status="False", randydev={"message": contact_support}
|
446 |
-
)
|
447 |
else:
|
448 |
if item.is_login:
|
449 |
token = item.bard_api_key
|
|
|
424 |
response_model=SuccessResponse,
|
425 |
responses={422: {"model": ErrorStatus}},
|
426 |
)
|
427 |
+
async def gemini_pro(item: GeminiPro):
|
428 |
owner_base = TruAI
|
429 |
if item.is_multi_chat:
|
430 |
selected_api_key = ASSISTANT_GOOGLE_API_KEYS or item.gemini_api_key
|
|
|
436 |
user_id=item.user_id
|
437 |
)
|
438 |
cybersecuritydb(item.user_id, item.mongo_url)
|
439 |
+
answer, gemini_chat = await geni._GeminiLatest__get_response_gemini(item.query)
|
440 |
return SuccessResponse(
|
441 |
status="True", randydev={"message": answer, "chat_history": gemini_chat}
|
442 |
)
|
443 |
+
except Exception as excep:
|
444 |
+
return SuccessResponse(status="False", randydev={"message": internal_error})
|
|
|
|
|
445 |
else:
|
446 |
if item.is_login:
|
447 |
token = item.bard_api_key
|