Spaces:
Sleeping
Sleeping
Commit
·
e25acc0
1
Parent(s):
0f88fd2
app.py
CHANGED
@@ -57,7 +57,11 @@ async def sign_in(email, password):
|
|
57 |
access_token = res.session.access_token
|
58 |
refresh_token = res.session.refresh_token
|
59 |
store_session_check = supabase.table("Stores").select("*").filter("StoreID", "eq", user_id).execute()
|
60 |
-
r_=createUser(username=user_id)
|
|
|
|
|
|
|
|
|
61 |
try:
|
62 |
store_id = store_session_check[1][0]["StoreID"]
|
63 |
except:
|
@@ -158,7 +162,7 @@ async def addPDFData(vectorstore: str, pdf: UploadFile = File(...)):
|
|
158 |
if newCount < int(limit):
|
159 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("user_id", username).eq(
|
160 |
"chatbotname", chatbotname).execute()
|
161 |
-
return addDocuments(text=text, source
|
162 |
else:
|
163 |
return {
|
164 |
"output": "DOCUMENT EXCEEDING LIMITS, PLEASE TRY WITH A SMALLER DOCUMENT."
|
@@ -183,7 +187,7 @@ async def addText(vectorstore: str, text: str):
|
|
183 |
if newCount < int(limit):
|
184 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("user_id", username).eq(
|
185 |
"chatbotname", chatbotname).execute()
|
186 |
-
return addDocuments(text=text, source
|
187 |
else:
|
188 |
return {
|
189 |
"output": "WEBSITE EXCEEDING LIMITS, PLEASE TRY WITH A SMALLER DOCUMENT."
|
@@ -208,7 +212,7 @@ async def addText(addQaPair: AddQAPair):
|
|
208 |
if newCount < int(limit):
|
209 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("user_id", username).eq(
|
210 |
"chatbotname", chatbotname).execute()
|
211 |
-
return addDocuments(text=qa, source
|
212 |
else:
|
213 |
return {
|
214 |
"output": "WEBSITE EXCEEDING LIMITS, PLEASE TRY WITH A SMALLER DOCUMENT."
|
@@ -231,7 +235,7 @@ async def addWebsite(vectorstore: str, websiteUrls: list[str]):
|
|
231 |
if newCount < int(limit):
|
232 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("user_id", username).eq(
|
233 |
"chatbotname", chatbotname).execute()
|
234 |
-
return addDocuments(text=text, source
|
235 |
else:
|
236 |
return {
|
237 |
"output": "WEBSITE EXCEEDING LIMITS, PLEASE TRY WITH A SMALLER DOCUMENT."
|
@@ -296,4 +300,4 @@ async def analyzeAndAnswer(query: str, file: UploadFile = File(...)):
|
|
296 |
except:
|
297 |
return {
|
298 |
"output": "UNABLE TO ANSWER QUERY"
|
299 |
-
}
|
|
|
57 |
access_token = res.session.access_token
|
58 |
refresh_token = res.session.refresh_token
|
59 |
store_session_check = supabase.table("Stores").select("*").filter("StoreID", "eq", user_id).execute()
|
60 |
+
r_ = createUser(username=user_id)
|
61 |
+
if r_['output'] == 'SUCCESS':
|
62 |
+
pass
|
63 |
+
else:
|
64 |
+
return r_
|
65 |
try:
|
66 |
store_id = store_session_check[1][0]["StoreID"]
|
67 |
except:
|
|
|
162 |
if newCount < int(limit):
|
163 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("user_id", username).eq(
|
164 |
"chatbotname", chatbotname).execute()
|
165 |
+
return addDocuments(text=text, source=source, vectorstore=vectorstore)
|
166 |
else:
|
167 |
return {
|
168 |
"output": "DOCUMENT EXCEEDING LIMITS, PLEASE TRY WITH A SMALLER DOCUMENT."
|
|
|
187 |
if newCount < int(limit):
|
188 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("user_id", username).eq(
|
189 |
"chatbotname", chatbotname).execute()
|
190 |
+
return addDocuments(text=text, source="text", vectorstore=vectorstore)
|
191 |
else:
|
192 |
return {
|
193 |
"output": "WEBSITE EXCEEDING LIMITS, PLEASE TRY WITH A SMALLER DOCUMENT."
|
|
|
212 |
if newCount < int(limit):
|
213 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("user_id", username).eq(
|
214 |
"chatbotname", chatbotname).execute()
|
215 |
+
return addDocuments(text=qa, source="Q&A Pairs", vectorstore=addQaPair.vectorstore)
|
216 |
else:
|
217 |
return {
|
218 |
"output": "WEBSITE EXCEEDING LIMITS, PLEASE TRY WITH A SMALLER DOCUMENT."
|
|
|
235 |
if newCount < int(limit):
|
236 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("user_id", username).eq(
|
237 |
"chatbotname", chatbotname).execute()
|
238 |
+
return addDocuments(text=text, source="website", vectorstore=vectorstore)
|
239 |
else:
|
240 |
return {
|
241 |
"output": "WEBSITE EXCEEDING LIMITS, PLEASE TRY WITH A SMALLER DOCUMENT."
|
|
|
300 |
except:
|
301 |
return {
|
302 |
"output": "UNABLE TO ANSWER QUERY"
|
303 |
+
}
|