randydev commited on
Commit
5de4d86
1 Parent(s): e846e9b

Upload 2 files

Browse files
Files changed (2) hide show
  1. main.py +3 -2
  2. models.py +2 -0
main.py CHANGED
@@ -768,9 +768,10 @@ def gemini_pro(item: GeminiPro):
768
  Today is {dt.now():%A %d %B %Y %H:%M}
769
  """
770
  if item.is_multi_chat:
 
771
  try:
772
- gt = GeminiLatest(api_key=ASSISTANT_GOOGLE_API_KEYS)
773
- answer, gemini_chat = gt._get_response_gemini(item.query)
774
  return SuccessResponse(
775
  status="True",
776
  randydev={
 
768
  Today is {dt.now():%A %d %B %Y %H:%M}
769
  """
770
  if item.is_multi_chat:
771
+ selected_api_key = ASSISTANT_GOOGLE_API_KEYS or item.gemini_api_key
772
  try:
773
+ gt = GeminiLatest(api_key=selected_api_key)
774
+ answer, gemini_chat = gt._get_response_gemini(item.query, item.gemini_chat)
775
  return SuccessResponse(
776
  status="True",
777
  randydev={
models.py CHANGED
@@ -72,6 +72,8 @@ class ChatgptCustom(BaseModel):
72
  class GeminiPro(BaseModel):
73
  query: str
74
  bard_api_key: Optional[str] = None
 
 
75
  is_login: Optional[bool] = False
76
  is_multi_chat: Optional[bool] = False
77
 
 
72
  class GeminiPro(BaseModel):
73
  query: str
74
  bard_api_key: Optional[str] = None
75
+ gemini_api_key: Optional[str] = None
76
+ gemini_chat: Optional[list] = None
77
  is_login: Optional[bool] = False
78
  is_multi_chat: Optional[bool] = False
79