Spaces:
Sleeping
Sleeping
UPDATE: QnA Functionality
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ async def addPDFData(vectorstore: str, pdf: UploadFile = File(...)):
|
|
48 |
df = pd.DataFrame(client.table("ConversAI_ChatbotInfo").select("*").execute().data)
|
49 |
currentCount = df[(df["username"] == username) & (df["chatbotname"] == chatbotname)]["charactercount"].iloc[0]
|
50 |
newCount = currentCount + len(text)
|
51 |
-
if newCount <
|
52 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("username", username).eq("chatbotname", chatbotname).execute()
|
53 |
return addDocuments(text = text, vectorstore = vectorstore)
|
54 |
else:
|
@@ -63,7 +63,7 @@ async def addText(vectorstore: str, text: str):
|
|
63 |
df = pd.DataFrame(client.table("ConversAI_ChatbotInfo").select("*").execute().data)
|
64 |
currentCount = df[(df["username"] == username) & (df["chatbotname"] == chatbotname)]["charactercount"].iloc[0]
|
65 |
newCount = currentCount + len(text)
|
66 |
-
if newCount <
|
67 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("username", username).eq("chatbotname", chatbotname).execute()
|
68 |
return addDocuments(text = text, vectorstore = vectorstore)
|
69 |
else:
|
@@ -86,7 +86,7 @@ async def addText(addQaPair: AddQAPair):
|
|
86 |
currentCount = df[(df["username"] == username) & (df["chatbotname"] == chatbotname)]["charactercount"].iloc[0]
|
87 |
qa = f"QUESTION: {addQaPair.question}\tANSWER: {addQaPair.answer}"
|
88 |
newCount = currentCount + len(qa)
|
89 |
-
if newCount <
|
90 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("username", username).eq("chatbotname", chatbotname).execute()
|
91 |
return addDocuments(text = qa, vectorstore = addQaPair.vectorstore)
|
92 |
else:
|
@@ -105,7 +105,7 @@ async def addWebsite(vectorstore: str, websiteUrls: list[str]):
|
|
105 |
df = pd.DataFrame(client.table("ConversAI_ChatbotInfo").select("*").execute().data)
|
106 |
currentCount = df[(df["username"] == username) & (df["chatbotname"] == chatbotname)]["charactercount"].iloc[0]
|
107 |
newCount = currentCount + len(text)
|
108 |
-
if newCount <
|
109 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("username", username).eq("chatbotname", chatbotname).execute()
|
110 |
return addDocuments(text = text, vectorstore = vectorstore)
|
111 |
else:
|
|
|
48 |
df = pd.DataFrame(client.table("ConversAI_ChatbotInfo").select("*").execute().data)
|
49 |
currentCount = df[(df["username"] == username) & (df["chatbotname"] == chatbotname)]["charactercount"].iloc[0]
|
50 |
newCount = currentCount + len(text)
|
51 |
+
if newCount < 1000000:
|
52 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("username", username).eq("chatbotname", chatbotname).execute()
|
53 |
return addDocuments(text = text, vectorstore = vectorstore)
|
54 |
else:
|
|
|
63 |
df = pd.DataFrame(client.table("ConversAI_ChatbotInfo").select("*").execute().data)
|
64 |
currentCount = df[(df["username"] == username) & (df["chatbotname"] == chatbotname)]["charactercount"].iloc[0]
|
65 |
newCount = currentCount + len(text)
|
66 |
+
if newCount < 1000000:
|
67 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("username", username).eq("chatbotname", chatbotname).execute()
|
68 |
return addDocuments(text = text, vectorstore = vectorstore)
|
69 |
else:
|
|
|
86 |
currentCount = df[(df["username"] == username) & (df["chatbotname"] == chatbotname)]["charactercount"].iloc[0]
|
87 |
qa = f"QUESTION: {addQaPair.question}\tANSWER: {addQaPair.answer}"
|
88 |
newCount = currentCount + len(qa)
|
89 |
+
if newCount < 1000000:
|
90 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("username", username).eq("chatbotname", chatbotname).execute()
|
91 |
return addDocuments(text = qa, vectorstore = addQaPair.vectorstore)
|
92 |
else:
|
|
|
105 |
df = pd.DataFrame(client.table("ConversAI_ChatbotInfo").select("*").execute().data)
|
106 |
currentCount = df[(df["username"] == username) & (df["chatbotname"] == chatbotname)]["charactercount"].iloc[0]
|
107 |
newCount = currentCount + len(text)
|
108 |
+
if newCount < 1000000:
|
109 |
client.table("ConversAI_ChatbotInfo").update({"charactercount": str(newCount)}).eq("username", username).eq("chatbotname", chatbotname).execute()
|
110 |
return addDocuments(text = text, vectorstore = vectorstore)
|
111 |
else:
|