Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,15 +18,16 @@ sf = Salesforce(username=username, password=password, security_token=security_to
|
|
| 18 |
|
| 19 |
|
| 20 |
def search_knowledge(prompt):
|
| 21 |
-
|
| 22 |
-
information = sf.search(searchstring)
|
| 23 |
-
|
| 24 |
try:
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
return slack_msg
|
| 31 |
@app.route("/")
|
| 32 |
def index():
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
def search_knowledge(prompt):
|
| 21 |
+
slack_msg= "Here are knowledge articles related to "+prompt
|
|
|
|
|
|
|
| 22 |
try:
|
| 23 |
+
searchstring="Find {"+prompt+"}"
|
| 24 |
+
information = sf.search(searchstring)
|
| 25 |
+
df = pd.DataFrame(information['searchRecords'])
|
| 26 |
+
for i in (df.index):
|
| 27 |
+
slack_msg=slack_msg+df['Id'][i]
|
| 28 |
+
except requests.exceptions:
|
| 29 |
+
print("Failed to retrieve knowledge articles")
|
| 30 |
+
pass
|
| 31 |
return slack_msg
|
| 32 |
@app.route("/")
|
| 33 |
def index():
|