🔧 修复数据解析和添加英文报告
- 修正 data 字段解析路径:data.function.meta 而不是 data.meta - 现在正确显示插件类型 (action/filter) 和版本号 - 添加英文版详细报告 (community-stats.en.md) - generate_markdown 方法支持中英文切换
This commit is contained in:
4
.github/workflows/community-stats.yml
vendored
4
.github/workflows/community-stats.yml
vendored
@@ -42,13 +42,13 @@ jobs:
|
||||
- name: Check for changes
|
||||
id: check_changes
|
||||
run: |
|
||||
git diff --quiet docs/community-stats.md README.md README_CN.md || echo "changed=true" >> $GITHUB_OUTPUT
|
||||
git diff --quiet docs/community-stats.md docs/community-stats.en.md README.md README_CN.md || echo "changed=true" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Commit and push changes
|
||||
if: steps.check_changes.outputs.changed == 'true'
|
||||
run: |
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git add docs/community-stats.md docs/community-stats.json README.md README_CN.md
|
||||
git add docs/community-stats.md docs/community-stats.en.md docs/community-stats.json README.md README_CN.md
|
||||
git commit -m "📊 更新社区统计数据 $(date +'%Y-%m-%d')"
|
||||
git push
|
||||
|
||||
@@ -15,7 +15,7 @@ A collection of enhancements, plugins, and prompts for [OpenWebUI](https://githu
|
||||
|
||||
| 📝 Posts | ⬇️ Downloads | 👁️ Views | 👍 Upvotes | 💾 Saves |
|
||||
|:---:|:---:|:---:|:---:|:---:|
|
||||
| **11** | **731** | **7652** | **54** | **43** |
|
||||
| **11** | **731** | **7658** | **54** | **43** |
|
||||
|
||||
### 🔥 Top 5 Popular Plugins
|
||||
|
||||
@@ -24,7 +24,7 @@ A collection of enhancements, plugins, and prompts for [OpenWebUI](https://githu
|
||||
| 🥇 | [Turn Any Text into Beautiful Mind Maps](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 213 | 1896 |
|
||||
| 🥈 | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 167 | 433 |
|
||||
| 🥉 | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 110 | 1185 |
|
||||
| 4️⃣ | [Flash Card ](https://openwebui.com/posts/flash_card_65a2ea8f) | 70 | 1334 |
|
||||
| 4️⃣ | [Flash Card ](https://openwebui.com/posts/flash_card_65a2ea8f) | 70 | 1335 |
|
||||
| 5️⃣ | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 62 | 850 |
|
||||
|
||||
*See full stats in [Community Stats Report](./docs/community-stats.md)*
|
||||
|
||||
@@ -15,7 +15,7 @@ OpenWebUI 增强功能集合。包含个人开发与收集的插件、提示词
|
||||
|
||||
| 📝 发布 | ⬇️ 下载 | 👁️ 浏览 | 👍 点赞 | 💾 收藏 |
|
||||
|:---:|:---:|:---:|:---:|:---:|
|
||||
| **11** | **731** | **7652** | **54** | **43** |
|
||||
| **11** | **731** | **7658** | **54** | **43** |
|
||||
|
||||
### 🔥 热门插件 Top 5
|
||||
|
||||
@@ -24,7 +24,7 @@ OpenWebUI 增强功能集合。包含个人开发与收集的插件、提示词
|
||||
| 🥇 | [Turn Any Text into Beautiful Mind Maps](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 213 | 1896 |
|
||||
| 🥈 | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 167 | 433 |
|
||||
| 🥉 | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 110 | 1185 |
|
||||
| 4️⃣ | [Flash Card ](https://openwebui.com/posts/flash_card_65a2ea8f) | 70 | 1334 |
|
||||
| 4️⃣ | [Flash Card ](https://openwebui.com/posts/flash_card_65a2ea8f) | 70 | 1335 |
|
||||
| 5️⃣ | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 62 | 850 |
|
||||
|
||||
*完整统计请查看 [社区统计报告](./docs/community-stats.md)*
|
||||
|
||||
35
docs/community-stats.en.md
Normal file
35
docs/community-stats.en.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# 📊 OpenWebUI Community Stats Report
|
||||
|
||||
> 📅 Updated: 2026-01-06 02:01:58
|
||||
|
||||
## 📈 Overview
|
||||
|
||||
| Metric | Value |
|
||||
|------|------|
|
||||
| 📝 Total Posts | 11 |
|
||||
| ⬇️ Total Downloads | 731 |
|
||||
| 👁️ Total Views | 7658 |
|
||||
| 👍 Total Upvotes | 54 |
|
||||
| 💾 Total Saves | 43 |
|
||||
| 💬 Total Comments | 13 |
|
||||
|
||||
## 📂 By Type
|
||||
|
||||
- **action**: 9
|
||||
- **filter**: 2
|
||||
|
||||
## 📋 Posts List
|
||||
|
||||
| Rank | Title | Type | Version | Downloads | Views | Upvotes | Saves | Updated |
|
||||
|:---:|------|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
||||
| 1 | [Turn Any Text into Beautiful Mind Maps](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | action | 0.8.2 | 213 | 1896 | 10 | 15 | 2026-01-04 |
|
||||
| 2 | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | action | 0.3.6 | 167 | 433 | 3 | 2 | 2026-01-03 |
|
||||
| 3 | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | filter | 1.1.0 | 110 | 1185 | 5 | 9 | 2025-12-31 |
|
||||
| 4 | [Flash Card ](https://openwebui.com/posts/flash_card_65a2ea8f) | action | 0.2.4 | 70 | 1335 | 8 | 5 | 2026-01-04 |
|
||||
| 5 | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | action | 1.3.2 | 62 | 850 | 6 | 7 | 2026-01-04 |
|
||||
| 6 | [Export to Word (Enhanced Formatting)](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | action | 0.4.0 | 38 | 422 | 5 | 2 | 2026-01-05 |
|
||||
| 7 | [智能信息图](https://openwebui.com/posts/智能信息图_e04a48ff) | action | 1.3.1 | 31 | 372 | 3 | 0 | 2025-12-29 |
|
||||
| 8 | [导出为 Word-支持公式、流程图、表格和代码块](https://openwebui.com/posts/导出为_word_支持公式流程图表格和代码块_8a6306c0) | action | 0.4.1 | 13 | 523 | 7 | 1 | 2026-01-05 |
|
||||
| 9 | [闪记卡生成插件](https://openwebui.com/posts/闪记卡生成插件_4a31eac3) | action | 0.2.2 | 12 | 305 | 3 | 1 | 2026-01-01 |
|
||||
| 10 | [智能生成交互式思维导图,帮助用户可视化知识](https://openwebui.com/posts/智能生成交互式思维导图帮助用户可视化知识_8d4b097b) | action | 0.8.0 | 10 | 233 | 2 | 0 | 2025-12-31 |
|
||||
| 11 | [异步上下文压缩](https://openwebui.com/posts/异步上下文压缩_5c0617cb) | filter | 1.1.0 | 5 | 104 | 2 | 1 | 2025-12-31 |
|
||||
@@ -1,20 +1,23 @@
|
||||
{
|
||||
"total_posts": 11,
|
||||
"total_downloads": 731,
|
||||
"total_views": 7652,
|
||||
"total_views": 7658,
|
||||
"total_upvotes": 54,
|
||||
"total_downvotes": 0,
|
||||
"total_saves": 43,
|
||||
"total_comments": 13,
|
||||
"by_type": {
|
||||
"unknown": 11
|
||||
"action": 9,
|
||||
"filter": 2
|
||||
},
|
||||
"posts": [
|
||||
{
|
||||
"title": "Turn Any Text into Beautiful Mind Maps",
|
||||
"slug": "turn_any_text_into_beautiful_mind_maps_3094c59a",
|
||||
"type": "unknown",
|
||||
"version": "",
|
||||
"type": "action",
|
||||
"version": "0.8.2",
|
||||
"author": "Fu-Jie",
|
||||
"description": "Intelligently analyzes text content and generates interactive mind maps to help users structure and visualize knowledge.",
|
||||
"downloads": 213,
|
||||
"views": 1896,
|
||||
"upvotes": 10,
|
||||
@@ -27,8 +30,10 @@
|
||||
{
|
||||
"title": "Export to Excel",
|
||||
"slug": "export_mulit_table_to_excel_244b8f9d",
|
||||
"type": "unknown",
|
||||
"version": "",
|
||||
"type": "action",
|
||||
"version": "0.3.6",
|
||||
"author": "Fu-Jie",
|
||||
"description": "Extracts tables from chat messages and exports them to Excel (.xlsx) files with smart formatting.",
|
||||
"downloads": 167,
|
||||
"views": 433,
|
||||
"upvotes": 3,
|
||||
@@ -41,8 +46,10 @@
|
||||
{
|
||||
"title": "Async Context Compression",
|
||||
"slug": "async_context_compression_b1655bc8",
|
||||
"type": "unknown",
|
||||
"version": "",
|
||||
"type": "filter",
|
||||
"version": "1.1.0",
|
||||
"author": "Fu-Jie",
|
||||
"description": "This filter automatically compresses long conversation contexts by intelligently summarizing and removing intermediate messages while preserving critical information, thereby significantly reducing token consumption.",
|
||||
"downloads": 110,
|
||||
"views": 1185,
|
||||
"upvotes": 5,
|
||||
@@ -55,10 +62,12 @@
|
||||
{
|
||||
"title": "Flash Card ",
|
||||
"slug": "flash_card_65a2ea8f",
|
||||
"type": "unknown",
|
||||
"version": "",
|
||||
"type": "action",
|
||||
"version": "0.2.4",
|
||||
"author": "Fu-Jie",
|
||||
"description": "Quickly generates beautiful flashcards from text, extracting key points and categories.",
|
||||
"downloads": 70,
|
||||
"views": 1334,
|
||||
"views": 1335,
|
||||
"upvotes": 8,
|
||||
"saves": 5,
|
||||
"comments": 2,
|
||||
@@ -69,8 +78,10 @@
|
||||
{
|
||||
"title": "Smart Infographic",
|
||||
"slug": "smart_infographic_ad6f0c7f",
|
||||
"type": "unknown",
|
||||
"version": "",
|
||||
"type": "action",
|
||||
"version": "1.3.2",
|
||||
"author": "jeff",
|
||||
"description": "AI-powered infographic generator based on AntV Infographic. Supports professional templates, auto-icon matching, and SVG/PNG downloads.",
|
||||
"downloads": 62,
|
||||
"views": 850,
|
||||
"upvotes": 6,
|
||||
@@ -83,8 +94,10 @@
|
||||
{
|
||||
"title": "Export to Word (Enhanced Formatting)",
|
||||
"slug": "export_to_word_enhanced_formatting_fca6a315",
|
||||
"type": "unknown",
|
||||
"version": "",
|
||||
"type": "action",
|
||||
"version": "0.4.0",
|
||||
"author": "Fu-Jie",
|
||||
"description": "Export the current conversation to a formatted Word doc with syntax highlighting, AI-generated titles, and perfect Markdown rendering (tables, quotes, lists).",
|
||||
"downloads": 38,
|
||||
"views": 422,
|
||||
"upvotes": 5,
|
||||
@@ -97,8 +110,10 @@
|
||||
{
|
||||
"title": "智能信息图",
|
||||
"slug": "智能信息图_e04a48ff",
|
||||
"type": "unknown",
|
||||
"version": "",
|
||||
"type": "action",
|
||||
"version": "1.3.1",
|
||||
"author": "jeff",
|
||||
"description": "基于 AntV Infographic 的智能信息图生成插件。支持多种专业模板,自动图标匹配,并提供 SVG/PNG 下载功能。",
|
||||
"downloads": 31,
|
||||
"views": 372,
|
||||
"upvotes": 3,
|
||||
@@ -111,10 +126,12 @@
|
||||
{
|
||||
"title": "导出为 Word-支持公式、流程图、表格和代码块",
|
||||
"slug": "导出为_word_支持公式流程图表格和代码块_8a6306c0",
|
||||
"type": "unknown",
|
||||
"version": "",
|
||||
"type": "action",
|
||||
"version": "0.4.1",
|
||||
"author": "Fu-Jie",
|
||||
"description": "将当前对话内容从 Markdown 转换并导出为 Word (.docx) 文件,支持中英文无乱码。",
|
||||
"downloads": 13,
|
||||
"views": 518,
|
||||
"views": 523,
|
||||
"upvotes": 7,
|
||||
"saves": 1,
|
||||
"comments": 1,
|
||||
@@ -125,8 +142,10 @@
|
||||
{
|
||||
"title": "闪记卡生成插件",
|
||||
"slug": "闪记卡生成插件_4a31eac3",
|
||||
"type": "unknown",
|
||||
"version": "",
|
||||
"type": "action",
|
||||
"version": "0.2.2",
|
||||
"author": "Fu-Jie",
|
||||
"description": "快速将文本提炼为精美的学习记忆卡片,支持核心要点提取与分类。",
|
||||
"downloads": 12,
|
||||
"views": 305,
|
||||
"upvotes": 3,
|
||||
@@ -139,8 +158,10 @@
|
||||
{
|
||||
"title": "智能生成交互式思维导图,帮助用户可视化知识",
|
||||
"slug": "智能生成交互式思维导图帮助用户可视化知识_8d4b097b",
|
||||
"type": "unknown",
|
||||
"version": "",
|
||||
"type": "action",
|
||||
"version": "0.8.0",
|
||||
"author": "",
|
||||
"description": "智能分析文本内容,生成交互式思维导图,帮助用户结构化和可视化知识。",
|
||||
"downloads": 10,
|
||||
"views": 233,
|
||||
"upvotes": 2,
|
||||
@@ -153,8 +174,10 @@
|
||||
{
|
||||
"title": "异步上下文压缩",
|
||||
"slug": "异步上下文压缩_5c0617cb",
|
||||
"type": "unknown",
|
||||
"version": "",
|
||||
"type": "filter",
|
||||
"version": "1.1.0",
|
||||
"author": "Fu-Jie",
|
||||
"description": "在 LLM 响应完成后进行上下文摘要和压缩",
|
||||
"downloads": 5,
|
||||
"views": 104,
|
||||
"upvotes": 2,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 📊 OpenWebUI 社区统计报告
|
||||
|
||||
> 📅 更新时间: 2026-01-06 01:52:44
|
||||
> 📅 更新时间: 2026-01-06 02:01:58
|
||||
|
||||
## 📈 总览
|
||||
|
||||
@@ -8,27 +8,28 @@
|
||||
|------|------|
|
||||
| 📝 发布数量 | 11 |
|
||||
| ⬇️ 总下载量 | 731 |
|
||||
| 👁️ 总浏览量 | 7652 |
|
||||
| 👁️ 总浏览量 | 7658 |
|
||||
| 👍 总点赞数 | 54 |
|
||||
| 💾 总收藏数 | 43 |
|
||||
| 💬 总评论数 | 13 |
|
||||
|
||||
## 📂 按类型分类
|
||||
|
||||
- **unknown**: 11
|
||||
- **action**: 9
|
||||
- **filter**: 2
|
||||
|
||||
## 📋 发布列表
|
||||
|
||||
| 排名 | 标题 | 类型 | 版本 | 下载 | 浏览 | 点赞 | 收藏 | 更新日期 |
|
||||
|:---:|------|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
||||
| 1 | [Turn Any Text into Beautiful Mind Maps](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | unknown | | 213 | 1896 | 10 | 15 | 2026-01-04 |
|
||||
| 2 | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | unknown | | 167 | 433 | 3 | 2 | 2026-01-03 |
|
||||
| 3 | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | unknown | | 110 | 1185 | 5 | 9 | 2025-12-31 |
|
||||
| 4 | [Flash Card ](https://openwebui.com/posts/flash_card_65a2ea8f) | unknown | | 70 | 1334 | 8 | 5 | 2026-01-04 |
|
||||
| 5 | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | unknown | | 62 | 850 | 6 | 7 | 2026-01-04 |
|
||||
| 6 | [Export to Word (Enhanced Formatting)](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | unknown | | 38 | 422 | 5 | 2 | 2026-01-05 |
|
||||
| 7 | [智能信息图](https://openwebui.com/posts/智能信息图_e04a48ff) | unknown | | 31 | 372 | 3 | 0 | 2025-12-29 |
|
||||
| 8 | [导出为 Word-支持公式、流程图、表格和代码块](https://openwebui.com/posts/导出为_word_支持公式流程图表格和代码块_8a6306c0) | unknown | | 13 | 518 | 7 | 1 | 2026-01-05 |
|
||||
| 9 | [闪记卡生成插件](https://openwebui.com/posts/闪记卡生成插件_4a31eac3) | unknown | | 12 | 305 | 3 | 1 | 2026-01-01 |
|
||||
| 10 | [智能生成交互式思维导图,帮助用户可视化知识](https://openwebui.com/posts/智能生成交互式思维导图帮助用户可视化知识_8d4b097b) | unknown | | 10 | 233 | 2 | 0 | 2025-12-31 |
|
||||
| 11 | [异步上下文压缩](https://openwebui.com/posts/异步上下文压缩_5c0617cb) | unknown | | 5 | 104 | 2 | 1 | 2025-12-31 |
|
||||
| 1 | [Turn Any Text into Beautiful Mind Maps](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | action | 0.8.2 | 213 | 1896 | 10 | 15 | 2026-01-04 |
|
||||
| 2 | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | action | 0.3.6 | 167 | 433 | 3 | 2 | 2026-01-03 |
|
||||
| 3 | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | filter | 1.1.0 | 110 | 1185 | 5 | 9 | 2025-12-31 |
|
||||
| 4 | [Flash Card ](https://openwebui.com/posts/flash_card_65a2ea8f) | action | 0.2.4 | 70 | 1335 | 8 | 5 | 2026-01-04 |
|
||||
| 5 | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | action | 1.3.2 | 62 | 850 | 6 | 7 | 2026-01-04 |
|
||||
| 6 | [Export to Word (Enhanced Formatting)](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | action | 0.4.0 | 38 | 422 | 5 | 2 | 2026-01-05 |
|
||||
| 7 | [智能信息图](https://openwebui.com/posts/智能信息图_e04a48ff) | action | 1.3.1 | 31 | 372 | 3 | 0 | 2025-12-29 |
|
||||
| 8 | [导出为 Word-支持公式、流程图、表格和代码块](https://openwebui.com/posts/导出为_word_支持公式流程图表格和代码块_8a6306c0) | action | 0.4.1 | 13 | 523 | 7 | 1 | 2026-01-05 |
|
||||
| 9 | [闪记卡生成插件](https://openwebui.com/posts/闪记卡生成插件_4a31eac3) | action | 0.2.2 | 12 | 305 | 3 | 1 | 2026-01-01 |
|
||||
| 10 | [智能生成交互式思维导图,帮助用户可视化知识](https://openwebui.com/posts/智能生成交互式思维导图帮助用户可视化知识_8d4b097b) | action | 0.8.0 | 10 | 233 | 2 | 0 | 2025-12-31 |
|
||||
| 11 | [异步上下文压缩](https://openwebui.com/posts/异步上下文压缩_5c0617cb) | filter | 1.1.0 | 5 | 104 | 2 | 1 | 2025-12-31 |
|
||||
|
||||
@@ -147,14 +147,17 @@ class OpenWebUIStats:
|
||||
stats["total_saves"] += post.get("saveCount", 0)
|
||||
stats["total_comments"] += post.get("commentCount", 0)
|
||||
|
||||
# 按类型分类
|
||||
post_type = post.get("data", {}).get("meta", {}).get("type", "unknown")
|
||||
# 解析 data 字段 - 正确路径: data.function.meta
|
||||
function_data = post.get("data", {}).get("function", {})
|
||||
meta = function_data.get("meta", {})
|
||||
manifest = meta.get("manifest", {})
|
||||
post_type = meta.get("type", function_data.get("type", "unknown"))
|
||||
|
||||
if post_type not in stats["by_type"]:
|
||||
stats["by_type"][post_type] = 0
|
||||
stats["by_type"][post_type] += 1
|
||||
|
||||
# 单个帖子信息
|
||||
manifest = post.get("data", {}).get("meta", {}).get("manifest", {})
|
||||
created_at = datetime.fromtimestamp(post.get("createdAt", 0))
|
||||
updated_at = datetime.fromtimestamp(post.get("updatedAt", 0))
|
||||
|
||||
@@ -164,6 +167,8 @@ class OpenWebUIStats:
|
||||
"slug": post.get("slug", ""),
|
||||
"type": post_type,
|
||||
"version": manifest.get("version", ""),
|
||||
"author": manifest.get("author", ""),
|
||||
"description": meta.get("description", ""),
|
||||
"downloads": post.get("downloads", 0),
|
||||
"views": post.get("views", 0),
|
||||
"upvotes": post.get("upvotes", 0),
|
||||
@@ -224,40 +229,80 @@ class OpenWebUIStats:
|
||||
|
||||
print("=" * 60)
|
||||
|
||||
def generate_markdown(self, stats: dict) -> str:
|
||||
"""生成 Markdown 格式报告"""
|
||||
def generate_markdown(self, stats: dict, lang: str = "zh") -> str:
|
||||
"""
|
||||
生成 Markdown 格式报告
|
||||
|
||||
Args:
|
||||
stats: 统计数据
|
||||
lang: 语言 ("zh" 中文, "en" 英文)
|
||||
"""
|
||||
# 中英文文本
|
||||
texts = {
|
||||
"zh": {
|
||||
"title": "# 📊 OpenWebUI 社区统计报告",
|
||||
"updated": f"> 📅 更新时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}",
|
||||
"overview_title": "## 📈 总览",
|
||||
"overview_header": "| 指标 | 数值 |",
|
||||
"posts": "📝 发布数量",
|
||||
"downloads": "⬇️ 总下载量",
|
||||
"views": "👁️ 总浏览量",
|
||||
"upvotes": "👍 总点赞数",
|
||||
"saves": "💾 总收藏数",
|
||||
"comments": "💬 总评论数",
|
||||
"type_title": "## 📂 按类型分类",
|
||||
"list_title": "## 📋 发布列表",
|
||||
"list_header": "| 排名 | 标题 | 类型 | 版本 | 下载 | 浏览 | 点赞 | 收藏 | 更新日期 |",
|
||||
},
|
||||
"en": {
|
||||
"title": "# 📊 OpenWebUI Community Stats Report",
|
||||
"updated": f"> 📅 Updated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}",
|
||||
"overview_title": "## 📈 Overview",
|
||||
"overview_header": "| Metric | Value |",
|
||||
"posts": "📝 Total Posts",
|
||||
"downloads": "⬇️ Total Downloads",
|
||||
"views": "👁️ Total Views",
|
||||
"upvotes": "👍 Total Upvotes",
|
||||
"saves": "💾 Total Saves",
|
||||
"comments": "💬 Total Comments",
|
||||
"type_title": "## 📂 By Type",
|
||||
"list_title": "## 📋 Posts List",
|
||||
"list_header": "| Rank | Title | Type | Version | Downloads | Views | Upvotes | Saves | Updated |",
|
||||
},
|
||||
}
|
||||
|
||||
t = texts.get(lang, texts["en"])
|
||||
|
||||
md = []
|
||||
md.append("# 📊 OpenWebUI 社区统计报告")
|
||||
md.append(t["title"])
|
||||
md.append("")
|
||||
md.append(f"> 📅 更新时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
md.append(t["updated"])
|
||||
md.append("")
|
||||
|
||||
# 总览
|
||||
md.append("## 📈 总览")
|
||||
md.append(t["overview_title"])
|
||||
md.append("")
|
||||
md.append("| 指标 | 数值 |")
|
||||
md.append(t["overview_header"])
|
||||
md.append("|------|------|")
|
||||
md.append(f"| 📝 发布数量 | {stats['total_posts']} |")
|
||||
md.append(f"| ⬇️ 总下载量 | {stats['total_downloads']} |")
|
||||
md.append(f"| 👁️ 总浏览量 | {stats['total_views']} |")
|
||||
md.append(f"| 👍 总点赞数 | {stats['total_upvotes']} |")
|
||||
md.append(f"| 💾 总收藏数 | {stats['total_saves']} |")
|
||||
md.append(f"| 💬 总评论数 | {stats['total_comments']} |")
|
||||
md.append(f"| {t['posts']} | {stats['total_posts']} |")
|
||||
md.append(f"| {t['downloads']} | {stats['total_downloads']} |")
|
||||
md.append(f"| {t['views']} | {stats['total_views']} |")
|
||||
md.append(f"| {t['upvotes']} | {stats['total_upvotes']} |")
|
||||
md.append(f"| {t['saves']} | {stats['total_saves']} |")
|
||||
md.append(f"| {t['comments']} | {stats['total_comments']} |")
|
||||
md.append("")
|
||||
|
||||
# 按类型分类
|
||||
md.append("## 📂 按类型分类")
|
||||
md.append(t["type_title"])
|
||||
md.append("")
|
||||
for post_type, count in stats["by_type"].items():
|
||||
md.append(f"- **{post_type}**: {count}")
|
||||
md.append("")
|
||||
|
||||
# 详细列表
|
||||
md.append("## 📋 发布列表")
|
||||
md.append(t["list_title"])
|
||||
md.append("")
|
||||
md.append(
|
||||
"| 排名 | 标题 | 类型 | 版本 | 下载 | 浏览 | 点赞 | 收藏 | 更新日期 |"
|
||||
)
|
||||
md.append(t["list_header"])
|
||||
md.append("|:---:|------|:---:|:---:|:---:|:---:|:---:|:---:|:---:|")
|
||||
|
||||
for i, post in enumerate(stats["posts"], 1):
|
||||
@@ -462,13 +507,22 @@ def main():
|
||||
# 打印到终端
|
||||
stats_client.print_stats(stats)
|
||||
|
||||
# 保存 Markdown 报告
|
||||
# 保存 Markdown 报告 (中英文双版本)
|
||||
script_dir = Path(__file__).parent.parent
|
||||
md_path = script_dir / "docs" / "community-stats.md"
|
||||
md_content = stats_client.generate_markdown(stats)
|
||||
with open(md_path, "w", encoding="utf-8") as f:
|
||||
f.write(md_content)
|
||||
print(f"\n✅ Markdown 报告已保存到: {md_path}")
|
||||
|
||||
# 中文报告
|
||||
md_zh_path = script_dir / "docs" / "community-stats.md"
|
||||
md_zh_content = stats_client.generate_markdown(stats, lang="zh")
|
||||
with open(md_zh_path, "w", encoding="utf-8") as f:
|
||||
f.write(md_zh_content)
|
||||
print(f"\n✅ 中文报告已保存到: {md_zh_path}")
|
||||
|
||||
# 英文报告
|
||||
md_en_path = script_dir / "docs" / "community-stats.en.md"
|
||||
md_en_content = stats_client.generate_markdown(stats, lang="en")
|
||||
with open(md_en_path, "w", encoding="utf-8") as f:
|
||||
f.write(md_en_content)
|
||||
print(f"✅ 英文报告已保存到: {md_en_path}")
|
||||
|
||||
# 保存 JSON 数据
|
||||
json_path = script_dir / "docs" / "community-stats.json"
|
||||
|
||||
Reference in New Issue
Block a user