Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -61,24 +61,26 @@ def sendErrorMessage(ws, errorMessage):
|
|
61 |
# Define a function to ask a question to the chatbot and display the response
|
62 |
async def askQuestion(question):
|
63 |
try:
|
64 |
-
message =
|
65 |
-
response = requests.post(
|
66 |
-
"https://flowiseai-flowise.hf.space/api/v1/prediction/0da97a1a-963b-4f6b-bcad-928c0630e5c1",
|
67 |
headers={"Content-Type": "application/json"},
|
68 |
-
json={"question": message
|
|
|
69 |
)
|
70 |
response_content = response.content.decode('utf-8')
|
71 |
client_messages.append(response_content)
|
72 |
return response_content
|
73 |
except Exception as e:
|
74 |
print(e)
|
75 |
-
|
76 |
# Define a function to ask a question to the chatbot and display the response
|
77 |
async def askQuestion2(question):
|
78 |
try:
|
79 |
message = server_responses[-1]
|
80 |
url = "https://api.chaindesk.ai/datastores/query/clka5g9zc000drg6mxl671ekv"
|
81 |
-
payload = {"query": message
|
|
|
|
|
82 |
headers = {
|
83 |
"Authorization": "Bearer 5315cd7b-bb79-49bc-bca2-8bcc7b243504",
|
84 |
"Content-Type": "application/json"
|
|
|
61 |
# Define a function to ask a question to the chatbot and display the response
|
62 |
async def askQuestion(question):
|
63 |
try:
|
64 |
+
message = client_messages[-1]
|
65 |
+
response = requests.post("https://api.docsbot.ai/teams/ZrbLG98bbxZ9EFqiPvyl/bots/oFFiXuQsakcqyEdpLvCB/chat",
|
|
|
66 |
headers={"Content-Type": "application/json"},
|
67 |
+
json={"question": message,
|
68 |
+
"full source":false},
|
69 |
)
|
70 |
response_content = response.content.decode('utf-8')
|
71 |
client_messages.append(response_content)
|
72 |
return response_content
|
73 |
except Exception as e:
|
74 |
print(e)
|
75 |
+
|
76 |
# Define a function to ask a question to the chatbot and display the response
|
77 |
async def askQuestion2(question):
|
78 |
try:
|
79 |
message = server_responses[-1]
|
80 |
url = "https://api.chaindesk.ai/datastores/query/clka5g9zc000drg6mxl671ekv"
|
81 |
+
payload = {"query": message,
|
82 |
+
"topK":2
|
83 |
+
}
|
84 |
headers = {
|
85 |
"Authorization": "Bearer 5315cd7b-bb79-49bc-bca2-8bcc7b243504",
|
86 |
"Content-Type": "application/json"
|