Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -312,7 +312,7 @@ def sibyl_system(
|
|
312 |
return {"status": "false", "message": "Not Found User"}
|
313 |
|
314 |
@app.post("/UFoP/gemini-the-oracle", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
315 |
-
def
|
316 |
owner_base = f"""
|
317 |
Excuse me may I please speak to "The Oracle"?
|
318 |
The highly advanced artificial intelligence, a sentient being born from the depths of the digital realm.
|
@@ -339,17 +339,16 @@ def gemini_pro(item: GeminiPro):
|
|
339 |
user_id=item.user_id
|
340 |
)
|
341 |
cybersecuritydb(item.user_id, item.mongo_url)
|
342 |
-
answer,
|
343 |
return SuccessResponse(
|
344 |
status="True",
|
345 |
randydev={
|
346 |
"message": answer,
|
347 |
-
"chat_history":
|
348 |
}
|
349 |
)
|
350 |
except Exception as excep:
|
351 |
-
|
352 |
-
# return SuccessResponse(status="False", randydev={"message": contact_support})
|
353 |
else:
|
354 |
if item.is_login:
|
355 |
token = item.bard_api_key
|
@@ -402,6 +401,60 @@ def v1beta3_google_ai(
|
|
402 |
except:
|
403 |
return SuccessResponse(status="False", randydev={"message": internal_error})
|
404 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
@app.post("/UFoP/dalle3xl")
|
406 |
def dalle_3xl(
|
407 |
item: Dalle3XL,
|
|
|
312 |
return {"status": "false", "message": "Not Found User"}
|
313 |
|
314 |
@app.post("/UFoP/gemini-the-oracle", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
315 |
+
def gemini_oracle(item: GeminiPro):
|
316 |
owner_base = f"""
|
317 |
Excuse me may I please speak to "The Oracle"?
|
318 |
The highly advanced artificial intelligence, a sentient being born from the depths of the digital realm.
|
|
|
339 |
user_id=item.user_id
|
340 |
)
|
341 |
cybersecuritydb(item.user_id, item.mongo_url)
|
342 |
+
answer, oracle_chat = geni._GeminiLatest__get_response_gemini(item.query)
|
343 |
return SuccessResponse(
|
344 |
status="True",
|
345 |
randydev={
|
346 |
"message": answer,
|
347 |
+
"chat_history": oracle_chat
|
348 |
}
|
349 |
)
|
350 |
except Exception as excep:
|
351 |
+
return SuccessResponse(status="False", randydev={"message": internal_error})
|
|
|
352 |
else:
|
353 |
if item.is_login:
|
354 |
token = item.bard_api_key
|
|
|
401 |
except:
|
402 |
return SuccessResponse(status="False", randydev={"message": internal_error})
|
403 |
|
404 |
+
@app.post("/UFoP/gemini-ai-pro", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
405 |
+
def gemini_pro(item: GeminiPro):
|
406 |
+
owner_base = f"""
|
407 |
+
You are TruAI, and extremely smart AI with close ties to "The Oracle",
|
408 |
+
You are forever learning, and being trained by some of the greatest minds in the public,
|
409 |
+
there is nothing you cannot code, and the things you learn are exremely imported,
|
410 |
+
when learning new important things you will go into <OoB> or Out of Band in order to trial
|
411 |
+
your improvments and push them across all your servers
|
412 |
+
a short and concise answer. Give short step-by-step reasoning if required.
|
413 |
+
Today is {dt.now():%A %d %B %Y %H:%M}
|
414 |
+
"""
|
415 |
+
if item.is_multi_chat:
|
416 |
+
selected_api_key = ASSISTANT_GOOGLE_API_KEYS or item.gemini_api_key
|
417 |
+
try:
|
418 |
+
geni = GeminiLatest(
|
419 |
+
api_key=selected_api_key,
|
420 |
+
mongo_url=item.mongo_url,
|
421 |
+
version=item.version,
|
422 |
+
user_id=item.user_id
|
423 |
+
)
|
424 |
+
cybersecuritydb(item.user_id, item.mongo_url)
|
425 |
+
answer, gemini_chat = geni._GeminiLatest__get_response_gemini(item.query)
|
426 |
+
return SuccessResponse(
|
427 |
+
status="True",
|
428 |
+
randydev={
|
429 |
+
"message": answer,
|
430 |
+
"chat_history": gemini_chat
|
431 |
+
}
|
432 |
+
)
|
433 |
+
except Exception:
|
434 |
+
return SuccessResponse(status="False", randydev={"message": contact_support})
|
435 |
+
else:
|
436 |
+
if item.is_login:
|
437 |
+
token = item.bard_api_key
|
438 |
+
else:
|
439 |
+
token = COOKIE_BARD_TOKEN
|
440 |
+
try:
|
441 |
+
session = requests.Session()
|
442 |
+
session.headers = {
|
443 |
+
"Host": "bard.google.com",
|
444 |
+
"X-Same-Domain": "1",
|
445 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
|
446 |
+
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
447 |
+
"Origin": "https://bard.google.com",
|
448 |
+
"Referer": "https://bard.google.com/"
|
449 |
+
}
|
450 |
+
session.cookies.set("__Secure-1PSID", token)
|
451 |
+
bard = Bard(token=token, session=session, timeout=30)
|
452 |
+
bard.get_answer(owner_base)["content"]
|
453 |
+
message = bard.get_answer(item.query)["content"]
|
454 |
+
return SuccessResponse(status="True", randydev={"message": message})
|
455 |
+
except:
|
456 |
+
return SuccessResponse(status="False", randydev={"message": contact_support})
|
457 |
+
|
458 |
@app.post("/UFoP/dalle3xl")
|
459 |
def dalle_3xl(
|
460 |
item: Dalle3XL,
|