Update
Browse files- main.py +5 -1
- requirements.txt +3 -1
main.py
CHANGED
@@ -23,6 +23,8 @@ from argparse import ArgumentParser
|
|
23 |
|
24 |
from flask import Flask, request, abort, send_from_directory
|
25 |
import google.generativeai as genai
|
|
|
|
|
26 |
|
27 |
from linebot.v3 import (
|
28 |
WebhookHandler
|
@@ -739,10 +741,12 @@ def handle_text_message(event):
|
|
739 |
else:
|
740 |
chat = get_chat(event.source.user_id)
|
741 |
response = chat.send_message(text)
|
|
|
|
|
742 |
line_bot_api.reply_message(
|
743 |
ReplyMessageRequest(
|
744 |
reply_token=event.reply_token,
|
745 |
-
messages=[TextMessage(text=
|
746 |
)
|
747 |
)
|
748 |
|
|
|
23 |
|
24 |
from flask import Flask, request, abort, send_from_directory
|
25 |
import google.generativeai as genai
|
26 |
+
import markdown
|
27 |
+
from bs4 import BeautifulSoup
|
28 |
|
29 |
from linebot.v3 import (
|
30 |
WebhookHandler
|
|
|
741 |
else:
|
742 |
chat = get_chat(event.source.user_id)
|
743 |
response = chat.send_message(text)
|
744 |
+
html_msg = markdown.markdown(response.text)
|
745 |
+
soup = BeautifulSoup(html_msg, 'html.parser')
|
746 |
line_bot_api.reply_message(
|
747 |
ReplyMessageRequest(
|
748 |
reply_token=event.reply_token,
|
749 |
+
messages=[TextMessage(text=soup.get_text())]
|
750 |
)
|
751 |
)
|
752 |
|
requirements.txt
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
Flask
|
2 |
google-generativeai
|
3 |
gunicorn
|
4 |
-
line-bot-sdk
|
|
|
|
|
|
1 |
Flask
|
2 |
google-generativeai
|
3 |
gunicorn
|
4 |
+
line-bot-sdk
|
5 |
+
markdown
|
6 |
+
python3-bs4
|