feat: add source links to SITREP stories

This commit is contained in:
jae 2026-04-06 15:42:46 +00:00
parent 371e8cbb7d
commit 3d01e1e173

View file

@ -199,7 +199,8 @@ def build_ai_prompt(all_stories, crypto):
lines.append(f'\n--- {src_name.upper()} ---') lines.append(f'\n--- {src_name.upper()} ---')
for i, s in enumerate(sources[src_name][:25], 1): for i, s in enumerate(sources[src_name][:25], 1):
score_str = f" [score:{s.get('score', '?')}]" if s.get('score') else '' score_str = f" [score:{s.get('score', '?')}]" if s.get('score') else ''
lines.append(f"{i}. {s['title']}{score_str}") url_str = f"\n Link: {s['url']}" if s.get('url') else ''
lines.append(f"{i}. {s['title']}{score_str}{url_str}")
if s.get('summary'): if s.get('summary'):
lines.append(f" Summary: {s['summary'][:150]}") lines.append(f" Summary: {s['summary'][:150]}")
@ -207,7 +208,8 @@ def build_ai_prompt(all_stories, crypto):
if 'r/netsec' in sources: if 'r/netsec' in sources:
lines.append('--- R/NETSEC ---') lines.append('--- R/NETSEC ---')
for i, s in enumerate(sources['r/netsec'][:15], 1): for i, s in enumerate(sources['r/netsec'][:15], 1):
lines.append(f"{i}. {s['title']}") url_str = f"\n Link: {s['url']}" if s.get('url') else ''
lines.append(f"{i}. {s['title']}{url_str}")
if s.get('summary'): if s.get('summary'):
lines.append(f" Summary: {s['summary'][:150]}") lines.append(f" Summary: {s['summary'][:150]}")
@ -226,6 +228,8 @@ def build_ai_prompt(all_stories, crypto):
lines.append('\n--- SECURITY-RELATED FROM OTHER FEEDS ---') lines.append('\n--- SECURITY-RELATED FROM OTHER FEEDS ---')
for i, s in enumerate(sec_stories[:10], 1): for i, s in enumerate(sec_stories[:10], 1):
lines.append(f"{i}. [{s['source']}] {s['title']}") lines.append(f"{i}. [{s['source']}] {s['title']}")
if s.get('url'):
lines.append(f" Link: {s['url']}")
lines.append('\n=== CRYPTO MARKET DATA ===') lines.append('\n=== CRYPTO MARKET DATA ===')
for ticker, data in crypto.items(): for ticker, data in crypto.items():
@ -254,13 +258,13 @@ Format the SITREP in markdown with the following EXACT structure:
## SECTOR ALPHA — TECHNOLOGY ## SECTOR ALPHA — TECHNOLOGY
Summarise the top 8-10 most significant technology stories. Group loosely by theme (AI/ML, infrastructure, programming languages, open source, industry moves). Each item should be 1-2 sentences max. Use bullet points. Prioritise stories by significance and novelty. Summarise the top 8-10 most significant technology stories. Group loosely by theme (AI/ML, infrastructure, programming languages, open source, industry moves). Each item should be 1-2 sentences max. Use bullet points. Prioritise stories by significance and novelty. After each bullet point, on a new line add a small source link in this exact format: ` *[source read more](URL)*` using the Link URL provided in the raw data.
--- ---
## SECTOR BRAVO — CYBERSECURITY ## SECTOR BRAVO — CYBERSECURITY
Summarise any cybersecurity-related stories. Include CVEs, breaches, new tools, threat intel. If few dedicated security stories, note the relatively quiet SIGINT environment. 4-8 items. Summarise any cybersecurity-related stories. Include CVEs, breaches, new tools, threat intel. If few dedicated security stories, note the relatively quiet SIGINT environment. 4-8 items. After each bullet point, on a new line add a small source link in this exact format: ` *[source read more](URL)*` using the Link URL provided in the raw data.
--- ---
@ -285,7 +289,9 @@ Rules:
- If data is sparse for a sector, acknowledge it briefly - If data is sparse for a sector, acknowledge it briefly
- Use markdown formatting (headers, bold, bullets, horizontal rules) - Use markdown formatting (headers, bold, bullets, horizontal rules)
- Include the exact crypto prices provided do not round them differently - Include the exact crypto prices provided do not round them differently
- For each tech story, mention the source in brackets like [HN] [Reddit] [Lobsters]""" - For each tech/security story, mention the source in brackets like [HN] [Reddit] [Lobsters]
- CRITICAL: After EVERY bullet point story in SECTOR ALPHA and SECTOR BRAVO, include the original source link on a NEW indented line formatted exactly as: *[source read more](URL)*
- Use the Link URLs provided in the raw intelligence data NEVER invent or guess URLs"""
def generate_with_venice(user_prompt): def generate_with_venice(user_prompt):