Spaces:
Sleeping
Sleeping
UPDATE: New Endpoints
Browse files
app.py
CHANGED
@@ -32,9 +32,9 @@ async def login(username: str, password: str):
|
|
32 |
|
33 |
@app.post("/newChatbot")
|
34 |
async def newChatbot(chatbotName: str, username: str):
|
35 |
-
currentBotCount = listTables(username = username)
|
36 |
-
limit = client.table("ConversAI_UserConfig").select("chatbotLimit").eq("username",
|
37 |
-
if currentBotCount
|
38 |
return {
|
39 |
"output": "CHATBOT LIMIT EXCEEDED"
|
40 |
}
|
@@ -146,7 +146,7 @@ async def crawlUrl(baseUrl: str):
|
|
146 |
|
147 |
@app.post("/getCurrentCount")
|
148 |
async def getCount(vectorstore: str):
|
149 |
-
username, chatbotName =
|
150 |
df = pd.DataFrame(client.table("ConversAI_ChatbotInfo").select("*").execute().data)
|
151 |
return {
|
152 |
"currentCount": df[(df['username'] == username) & (df['chatbotname'] == chatbotName)]['charactercount'].iloc[0]
|
|
|
32 |
|
33 |
@app.post("/newChatbot")
|
34 |
async def newChatbot(chatbotName: str, username: str):
|
35 |
+
currentBotCount = len(listTables(username = username)["output"])
|
36 |
+
limit = client.table("ConversAI_UserConfig").select("chatbotLimit").eq("username", username).execute().data[0]["chatbotLimit"]
|
37 |
+
if currentBotCount >= int(limit):
|
38 |
return {
|
39 |
"output": "CHATBOT LIMIT EXCEEDED"
|
40 |
}
|
|
|
146 |
|
147 |
@app.post("/getCurrentCount")
|
148 |
async def getCount(vectorstore: str):
|
149 |
+
username, chatbotName = vectorstore.split("-")[1], vectorstore.split("-")[2]
|
150 |
df = pd.DataFrame(client.table("ConversAI_ChatbotInfo").select("*").execute().data)
|
151 |
return {
|
152 |
"currentCount": df[(df['username'] == username) & (df['chatbotname'] == chatbotName)]['charactercount'].iloc[0]
|