Skip to content

Commit 001e7d1

Browse files
committed
feat(nytimes): update news_bot.py
1 parent 179e93f commit 001e7d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/nytimes/news_bot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ def ai_summarize(text, url=None):
162162
print("No MISTRAL_API_KEY set. Returning first 15 words as summary.")
163163
return limit_to_n_words(text, 15)
164164
prompt = (
165+
"If the original text is in Chinese, first translate it to English, then summarize. "
165166
"Summarize the following web page content in clear, concise English. "
166167
"Focus on the single most important point or insight. "
167168
"Your summary should be around 300 characters. "
@@ -188,7 +189,7 @@ def generate_summarized_report(summaries, source_name):
188189
summary = url_pattern.sub('', summary)
189190
# Truncate each summary to 300 chars as a last resort
190191
summary = summary[:300]
191-
text += f"{idx}. {summary}\n"
192+
text += f"{idx}. {summary}\n\n" # Add an extra newline between summaries
192193
text += "\n"
193194
return text
194195

0 commit comments

Comments
 (0)