Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -748,15 +748,15 @@ def handle_text_message(event):
|
|
| 748 |
app.logger.info("Got x-line-request-id: " + e.headers['x-line-request-id'])
|
| 749 |
app.logger.info("Got response with http body: " + str(ErrorResponse.from_json(e.body)))
|
| 750 |
else:
|
| 751 |
-
chat = get_chat(event.source.user_id)
|
| 752 |
-
response = chat.send_message(text).text
|
| 753 |
-
|
| 754 |
html_msg = markdown.markdown(response)
|
| 755 |
soup = BeautifulSoup(html_msg, 'html.parser')
|
| 756 |
line_bot_api.reply_message(
|
| 757 |
ReplyMessageRequest(
|
| 758 |
reply_token=event.reply_token,
|
| 759 |
-
messages=[TextMessage(text=
|
| 760 |
)
|
| 761 |
)
|
| 762 |
|
|
|
|
| 748 |
app.logger.info("Got x-line-request-id: " + e.headers['x-line-request-id'])
|
| 749 |
app.logger.info("Got response with http body: " + str(ErrorResponse.from_json(e.body)))
|
| 750 |
else:
|
| 751 |
+
# chat = get_chat(event.source.user_id)
|
| 752 |
+
# response = chat.send_message(text).text
|
| 753 |
+
response = query({"inputs": input,"parameters":{"return_full_text":False,"max_length":1024}})[0]["generated_text"]
|
| 754 |
html_msg = markdown.markdown(response)
|
| 755 |
soup = BeautifulSoup(html_msg, 'html.parser')
|
| 756 |
line_bot_api.reply_message(
|
| 757 |
ReplyMessageRequest(
|
| 758 |
reply_token=event.reply_token,
|
| 759 |
+
messages=[TextMessage(text=soup.get_text())]
|
| 760 |
)
|
| 761 |
)
|
| 762 |
|