bep40 commited on
Commit
888a03b
·
verified ·
1 Parent(s): 87fe551

Upload auto_scheduler.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. auto_scheduler.py +6 -1
auto_scheduler.py CHANGED
@@ -157,6 +157,11 @@ async def _create_ai_post(topic):
157
  LOG.warning(f"No articles for topic: {topic}. Fallback.")
158
  return await _create_fallback_post(topic, ai_ext, ai_patch)
159
  posts = []
 
 
 
 
 
160
  wall = ai_ext._load_ai_wall()
161
  if not isinstance(wall, list): wall = []
162
  for art in articles:
@@ -168,7 +173,7 @@ async def _create_ai_post(topic):
168
  if 'Nguồn tham khảo:' not in (text or ''):
169
  text = (text or '') + "\n\n" + ai_patch._source_line(src)
170
  img = art.get('image') or ai_ext.pollination_image_url(art['title'])
171
- post = ai_ext.make_post(art['title'], text, img, art.get('url', ''), 'auto_scheduled', sources=src)
172
  try:
173
  page_data = ai_patch._scrape_article_images(art.get('url', ''))
174
  if page_data and page_data.get('paragraphs'):
 
157
  LOG.warning(f"No articles for topic: {topic}. Fallback.")
158
  return await _create_fallback_post(topic, ai_ext, ai_patch)
159
  posts = []
160
+ # Get schedule time label for title (7h sáng, 13h trưa, 19h tối)
161
+ now = datetime.now(VN_TZ)
162
+ hour = now.hour
163
+ time_label = "7h sáng" if hour == 7 else ("13h trưa" if hour == 13 else "19h tối")
164
+ title_prefix = f"Tin tóm tắt VNEWS {time_label}"
165
  wall = ai_ext._load_ai_wall()
166
  if not isinstance(wall, list): wall = []
167
  for art in articles:
 
173
  if 'Nguồn tham khảo:' not in (text or ''):
174
  text = (text or '') + "\n\n" + ai_patch._source_line(src)
175
  img = art.get('image') or ai_ext.pollination_image_url(art['title'])
176
+ post = ai_ext.make_post(title_prefix, text, img, art.get('url', ''), 'auto_scheduled', sources=src)
177
  try:
178
  page_data = ai_patch._scrape_article_images(art.get('url', ''))
179
  if page_data and page_data.get('paragraphs'):