Spaces:
Sleeping
Sleeping
Update agents.py
Browse files
agents.py
CHANGED
@@ -2778,7 +2778,25 @@ class Chaindesk:
|
|
2778 |
with st.sidebar:
|
2779 |
self.cont = st.empty()
|
2780 |
self.status = self.cont.status(label="Chaindesk agent", state="complete", expanded=False)
|
2781 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2782 |
async def askChaindesk(self, question):
|
2783 |
|
2784 |
url = f"https://api.chaindesk.ai/agents/{self.ID}/query"
|
|
|
2778 |
with st.sidebar:
|
2779 |
self.cont = st.empty()
|
2780 |
self.status = self.cont.status(label="Chaindesk agent", state="complete", expanded=False)
|
2781 |
+
|
2782 |
+
async def queryDatastore(self, question):
|
2783 |
+
|
2784 |
+
url = f"https://api.chaindesk.ai/datastores/clka5g9zc000drg6mxl671ekv/query"
|
2785 |
+
|
2786 |
+
payload = {"query": question}
|
2787 |
+
headers = {
|
2788 |
+
"Authorization": "Bearer fe77e704-bc5a-4171-90f2-9d4b0d4ac942",
|
2789 |
+
"Content-Type": "application/json"
|
2790 |
+
}
|
2791 |
+
try:
|
2792 |
+
response = requests.request("POST", url, json=payload, headers=headers)
|
2793 |
+
answer = f"Chaindesk datastore: {response.text}"
|
2794 |
+
print(answer)
|
2795 |
+
return answer
|
2796 |
+
|
2797 |
+
except Exception as e:
|
2798 |
+
print(e)
|
2799 |
+
|
2800 |
async def askChaindesk(self, question):
|
2801 |
|
2802 |
url = f"https://api.chaindesk.ai/agents/{self.ID}/query"
|