|
@@ -29,6 +29,11 @@ app.recommend_messages = [
|
|
"content": "Give normalized total weight of each category in json based on headlines"
|
|
"content": "Give normalized total weight of each category in json based on headlines"
|
|
}
|
|
}
|
|
]
|
|
]
|
|
|
|
+app.summary_messages = [
|
|
|
|
+ {"role": "system",
|
|
|
|
+ "content": "Please summarize an article."
|
|
|
|
+ }
|
|
|
|
+]
|
|
UPLOAD_FOLDER = 'files'
|
|
UPLOAD_FOLDER = 'files'
|
|
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
|
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
|
|
|
|
|
@@ -101,6 +106,7 @@ def gpt():
|
|
chat_messages = app.chat_messages.copy()
|
|
chat_messages = app.chat_messages.copy()
|
|
use_video = False
|
|
use_video = False
|
|
suggest = False
|
|
suggest = False
|
|
|
|
+ summarize = False
|
|
category = []
|
|
category = []
|
|
headlines = []
|
|
headlines = []
|
|
image_url = ""
|
|
image_url = ""
|
|
@@ -126,6 +132,13 @@ def gpt():
|
|
else:
|
|
else:
|
|
chat_messages = app.chat_messages.copy()
|
|
chat_messages = app.chat_messages.copy()
|
|
json_payload['payload'][-1]['content'] = json_payload['payload'][-1]['content'] + f" What can I say to him/her?"
|
|
json_payload['payload'][-1]['content'] = json_payload['payload'][-1]['content'] + f" What can I say to him/her?"
|
|
|
|
+ elif 'summarize' in json_payload:
|
|
|
|
+ summarize = json_payload['summarize'] == "1"
|
|
|
|
+ if summarize:
|
|
|
|
+ chat_messages = app.summary_messages.copy()
|
|
|
|
+ else:
|
|
|
|
+ chat_messages = app.chat_messages.copy()
|
|
|
|
+ json_payload['payload'][-1]['content'] = f"Please summarize this article:\n" + json_payload['payload'][-1]['content']
|
|
else:
|
|
else:
|
|
chat_messages = app.chat_messages.copy()
|
|
chat_messages = app.chat_messages.copy()
|
|
json_payload = json_payload['payload']
|
|
json_payload = json_payload['payload']
|