Rauhan commited on
Commit
6febb6b
1 Parent(s): 6187b6c

UPDATE: New Endpoints

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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", "rauhan").execute().data[0]["chatbotLimit"]
37
- if currentBotCount < limit:
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 = chatbotName.split("-")[1], chatbotName.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]
 
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]