Skip to content

Commit

Permalink
Merge pull request microsoft#23 from microsoft/sawidder/without-data-fix
Browse files Browse the repository at this point in the history
Update without data api
  • Loading branch information
sarah-widder authored May 25, 2023
2 parents 2836a5b + c91254c commit da75d37
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def prepare_body_headers_without_data(request):

for message in request_messages:
body_messages.append({
"role": "assistant" if message["role"] == "bot" else "user",
"content": message["content"]["parts"][0]
"role": message["role"] ,
"content": message["content"]
})

body = {
Expand Down Expand Up @@ -138,19 +138,10 @@ def conversation():

if not use_data and status_code == 200:
# convert to the same format as the data version
r = {
"message_id": r["id"],
"parent_message_id": "",
"role": "bot",
"content": {
"content_type": "text",
"parts": [
r["choices"][0]["message"]["content"]
],
"top_docs": [],
"intent": ""
},
}
r["choices"][0]["messages"] = [{
"content": r["choices"][0]["message"]["content"],
"role": "assistant"
}]

return jsonify(r), status_code
except Exception as e:
Expand Down

0 comments on commit da75d37

Please sign in to comment.