feat: use dynamic badges for Top 6 plugin statistics in README

This commit is contained in:
fujie
2026-02-11 12:10:46 +08:00
parent cfb15808ef
commit 387ca8788b
3 changed files with 63 additions and 16 deletions

View File

@@ -7,7 +7,7 @@ A collection of enhancements, plugins, and prompts for [OpenWebUI](https://githu
<!-- STATS_START -->
## 📊 Community Stats
> 🕐 Auto-updated: 2026-02-11 12:09
> 🕐 Auto-updated: 2026-02-11 12:10
| 👤 Author | 👥 Followers | ⭐ Points | 🏆 Contributions |
| :---: | :---: | :---: | :---: |
@@ -20,12 +20,12 @@ A collection of enhancements, plugins, and prompts for [OpenWebUI](https://githu
### 🔥 Top 6 Popular Plugins
| Rank | Plugin | Version | Downloads | Views | Updated |
| :---: | :--- | :---: | :---: | :---: | :---: |
| 🥇 | [Smart Mind Map](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 0.9.2 | 954 | 8385 | 2026-01-29 |
| 🥈 | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 1.5.0 | 707 | 6701 | 2026-01-31 |
| 🥉 | [Export to Word Enhanced](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | 0.4.4 | 383 | 3026 | 2026-02-07 |
| 4⃣ | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 1.2.2 | 363 | 3754 | 2026-01-29 |
| 5⃣ | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 0.3.7 | 342 | 1671 | 2026-02-10 |
| 6⃣ | [Markdown Normalizer](https://openwebui.com/posts/markdown_normalizer_baaa8732) | 1.2.4 | 341 | 4711 | 2026-01-29 |
| 🥇 | [Smart Mind Map](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 0.9.2 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p1_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p1_vw.json) | 2026-01-29 |
| 🥈 | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 1.5.0 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p2_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p2_vw.json) | 2026-01-31 |
| 🥉 | [Export to Word Enhanced](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | 0.4.4 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p3_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p3_vw.json) | 2026-02-07 |
| 4⃣ | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 1.2.2 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p4_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p4_vw.json) | 2026-01-29 |
| 5⃣ | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 0.3.7 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p5_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p5_vw.json) | 2026-02-10 |
| 6⃣ | [Markdown Normalizer](https://openwebui.com/posts/markdown_normalizer_baaa8732) | 1.2.4 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p6_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p6_vw.json) | 2026-01-29 |
*See full stats and charts in [Community Stats Report](./docs/community-stats.md)*
<!-- STATS_END -->

View File

@@ -6,7 +6,7 @@ OpenWebUI 增强功能集合。包含个人开发与收集的插件、提示词
<!-- STATS_START -->
## 📊 社区统计
> 🕐 自动更新于 2026-02-11 12:09
> 🕐 自动更新于 2026-02-11 12:10
| 👤 作者 | 👥 粉丝 | ⭐ 积分 | 🏆 贡献 |
| :---: | :---: | :---: | :---: |
@@ -19,12 +19,12 @@ OpenWebUI 增强功能集合。包含个人开发与收集的插件、提示词
### 🔥 热门插件 Top 6
| 排名 | 插件 | 版本 | 下载 | 浏览 | 更新日期 |
| :---: | :--- | :---: | :---: | :---: | :---: |
| 🥇 | [Smart Mind Map](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 0.9.2 | 954 | 8385 | 2026-01-29 |
| 🥈 | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 1.5.0 | 707 | 6701 | 2026-01-31 |
| 🥉 | [Export to Word Enhanced](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | 0.4.4 | 383 | 3026 | 2026-02-07 |
| 4⃣ | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 1.2.2 | 363 | 3754 | 2026-01-29 |
| 5⃣ | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 0.3.7 | 342 | 1671 | 2026-02-10 |
| 6⃣ | [Markdown Normalizer](https://openwebui.com/posts/markdown_normalizer_baaa8732) | 1.2.4 | 341 | 4711 | 2026-01-29 |
| 🥇 | [Smart Mind Map](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 0.9.2 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p1_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p1_vw.json) | 2026-01-29 |
| 🥈 | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 1.5.0 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p2_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p2_vw.json) | 2026-01-31 |
| 🥉 | [Export to Word Enhanced](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | 0.4.4 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p3_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p3_vw.json) | 2026-02-07 |
| 4⃣ | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 1.2.2 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p4_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p4_vw.json) | 2026-01-29 |
| 5⃣ | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 0.3.7 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p5_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p5_vw.json) | 2026-02-10 |
| 6⃣ | [Markdown Normalizer](https://openwebui.com/posts/markdown_normalizer_baaa8732) | 1.2.4 | ![dl](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p6_dl.json) | ![vw](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6/raw/badge_p6_vw.json) | 2026-01-29 |
*完整统计与趋势图请查看 [社区统计报告](./docs/community-stats.zh.md)*
<!-- STATS_END -->

View File

@@ -202,6 +202,11 @@ class OpenWebUIStats:
- prev.get("points", 0),
"contributions": stats.get("user", {}).get("contributions", 0)
- prev.get("contributions", 0),
"posts": {
p["slug"]: p["downloads"]
- prev.get("posts", {}).get(p["slug"], p["downloads"])
for p in stats.get("posts", [])
},
}
def _resolve_post_type(self, post: dict) -> str:
@@ -701,6 +706,39 @@ class OpenWebUIStats:
"content": json.dumps(badge_data, ensure_ascii=False)
}
# 生成 Top 6 插件徽章 (基于槽位 p1, p2...)
post_deltas = delta.get("posts", {})
for i, post in enumerate(stats.get("posts", [])[:6]):
idx = i + 1
diff = post_deltas.get(post["slug"], 0)
# 下载量徽章
dl_msg = f"{post['downloads']}"
if diff > 0:
dl_msg += f" (+{diff}🚀)"
files_payload[f"badge_p{idx}_dl.json"] = {
"content": json.dumps(
{
"schemaVersion": 1,
"label": "Downloads",
"message": dl_msg,
"color": "brightgreen",
}
)
}
# 浏览量徽章 (由于历史记录没记单个 post 浏览量,暂时只显总数)
files_payload[f"badge_p{idx}_vw.json"] = {
"content": json.dumps(
{
"schemaVersion": 1,
"label": "Views",
"message": f"{post['views']}",
"color": "blue",
}
)
}
# 批量上传到 Gist
url = f"https://api.github.com/gists/{self.gist_id}"
headers = {"Authorization": f"token {self.gist_token}"}
@@ -819,9 +857,18 @@ class OpenWebUIStats:
medals = ["🥇", "🥈", "🥉", "4", "5", "6"]
for i, post in enumerate(top_plugins):
medal = medals[i] if i < len(medals) else str(i + 1)
idx = i + 1
medal = medals[i] if i < len(medals) else str(idx)
# 如果有 Gist使用动态徽章
dl_cell = f"{post['downloads']}"
vw_cell = f"{post['views']}"
if base_badge_url:
dl_cell = f"![dl]({base_badge_url}/badge_p{idx}_dl.json)"
vw_cell = f"![vw]({base_badge_url}/badge_p{idx}_vw.json)"
lines.append(
f"| {medal} | [{post['title']}]({post['url']}) | {post['version']} | {post['downloads']} | {post['views']} | {post['updated_at']} |"
f"| {medal} | [{post['title']}]({post['url']}) | {post['version']} | {dl_cell} | {vw_cell} | {post['updated_at']} |"
)
lines.append("")