feat: implement dual-layer summaries (V1 descriptive title + Rich English summary)

This commit is contained in:
Nubenetes Bot
2026-05-19 21:09:23 +02:00
parent 1246344cef
commit f911b54dee

View File

@@ -560,16 +560,40 @@ class V2VisionEngine:
color = "success" if "STANDARD" in tag else "warning" if "EMERGING" in tag else "secondary" if "CASE STUDY" in tag or "GUIDE" in tag else "info"
tag_html += f" <span class='md-tag md-tag--{color}'>{tag}</span>"
# Apply Visual Highlighting (Mandate 32)
# Dual-Layer Strategy: Preserve descriptive V1 title + Rich English Summary
title = l['title'].replace("==", "") # Title from V1, often descriptive
if is_gold:
img = f" ![Preview]({l.get('social_preview_url')})\n" if l.get('social_preview_url') else ""
md += f"!!! note \"{title}\"\n{img} **[Access Resource]({l['url']})** {'🌟'*l.get('stars',4)} | Level: {l.get('complexity', 'Beginner')}\n \n {l.get('ai_summary', l.get('description', ''))}\n\n"
else:
year = l.get('year', 'N/A')
year_prefix = f"**({year})** " if year != 'N/A' else ""
gh_info = f" <span class='md-tag md-tag--info'>⭐ {l.get('gh_stars',0)}</span>" if l.get('gh_stars') else ""
icon = " 🎥" if l.get("is_video") else ""
lang = l.get("language", "English")
lang_tag = f" <span class='md-tag md-tag--warning'>[{lang.upper()} CONTENT]</span>" if lang.lower() != "english" else ""
comp = l.get("complexity", "Intermediate")
level_tag = f" <span class='md-tag md-tag--critical'>[{comp.upper()} LEVEL]</span>" if comp.lower() in ["architect", "advanced"] else ""
res_type = l.get("resource_type", "Reference")
type_tag = f" <span class='md-tag md-tag--primary'>[{res_type.upper()}]</span>" if res_type.lower() in ["case study", "guide", "documentation"] else ""
rich = "".join([f" <small>by **{l['author']}**</small>" if l.get("author") else "", f" <span class='md-tag md-tag--info'>⏱️ {l['duration']}</span>" if l.get("duration") else "", f" <span class='md-tag md-tag--info'>📖 {l['reading_time']}</span>" if l.get("reading_time") else ""])
tag_html = ""
for tag in l.get("tags", ["[COMMUNITY-TOOL]"]):
color = "success" if "STANDARD" in tag else "warning" if "EMERGING" in tag else "secondary" if "CASE STUDY" in tag or "GUIDE" in tag else "info"
tag_html += f" <span class='md-tag md-tag--{color}'>{tag}</span>"
# Apply Visual Highlighting based on stars
raw_stars = l.get('stars', 0)
link_text = title
link_content = title
if raw_stars >= 5:
link_text = f"=={title}=="
link_content = f"=={title}=="
elif raw_stars >= 4:
link_text = f"**{title}**"
link_content = f"**{title}**"
md += f" - {year_prefix}[{link_text}]({l['url']}){icon}{gh_info}{lang_tag}{level_tag}{type_tag}{rich} {'🌟'*raw_stars}{tag_html}\n"
# Mandate 4: Render High-Density Summary with proper indentation (6 spaces for Markdown list nesting)
md += f" - {year_prefix}[{link_content}]({l['url']}){icon}{gh_info}{lang_tag}{level_tag}{type_tag}{rich} {'🌟'*raw_stars}{tag_html}\n"
# Layer 2: High-Density Technical Summary (Professional English)
summary = l.get('ai_summary', l.get('description', ''))
if summary:
indented_summary = "\n".join([f" {line}" if line.strip() else "" for line in summary.strip().split("\n")])