chore: remove RELEASE_NOTES.md and generate change notes dynamically

This commit is contained in:
mamad
2026-08-28 23:33:55 +03:30
parent fd1e2abdba
commit a554af27c8
3 changed files with 13 additions and 54 deletions
-21
View File
@@ -1,21 +0,0 @@
📢 <b>گزارش تغییرات و قابلیت‌های جدید سیستم (Release Notes):</b>
👤 <b>ویرایش‌کننده:</b> <code>mamad</code>
🔹 <b>سازمان‌دهی منوی مدیریت در ۵ هاب تخصصی (Copy, AI, Bots, System, Monitor):</b>
• تجمیع و ساختاردهی کامل امکانات ربات در ۵ دسته‌بندی استاندارد:
- 📋 <b>کپی و محتوا (Copy Hub):</b> ارسال پست‌های بررسی‌نشده، هاب افزودن منبع/مقصد و دسته‌بندی موضوعی کانال‌ها.
- 🧠 <b>هوش مصنوعی (AI Hub):</b> مدیریت ارائه‌دهنده‌ها و مدل‌ها، زنجیره پشتیبان خودکار (Fallback)، پردازش تصویر (Vision) و تست آنلاین.
- 🤖 <b>کانال‌ها و ربات‌ها (Bots Hub):</b> مدیریت کانال‌های مبدا، کانال‌های مقصد، وبسایت‌های مبدا و لاگین یوزربات.
- ⚙️ <b>کنترل سیستم (System Hub):</b> توقف اضطراری ناوگان، راه‌اندازی مجدد، گزارش تغییرات و راهنمای جامع.
- 📊 <b>مانیتورینگ و آمار (Monitor Hub):</b> گزارش لحظه‌ای صف‌ها و کانال‌ها، بررسی و رفع خطاهای ثبت‌شده سیستم و نمودارهای آماری.
📁 <i>فایل‌های تغییریافته:</i> <code>services/admin_bot.py</code>, <code>tests/test_target_context_and_website_custom_needs.py</code>, <code>tests/test_fallback_and_stop.py</code>
🔹 <b>اصلاح و ثبت کامل رویدادها و بهینه‌سازی چینش کیبورد:</b>
• ثبت هندلر اختصاصی <code>⚠️ خطاهای سیستم</code> و اصلاح الگوهای Regex جهت پاسخگویی آنی به تمام دکمه‌ها و دستورات.
• بهینه‌سازی چینش کیبورد در دو ستون متقارن و کوتاه کردن برچسب‌ها جهت نمایش بی‌نقص و بدون شکستگی در موبایل و دسکتاپ.
📁 <i>فایل‌های تغییریافته:</i> <code>services/admin_bot.py</code>
🔹 <b>رفع خطای 500 در پردازش تصویر ارائه‌دهنده داخلی هوش مصنوعی (AGY Bridge):</b>
• رفع خطای ناسازگاری ساختار ورودی‌های چندوجهی (Multimodal Image Payloads) و اطمینان از دریافت پاسخ موفق در بازنویسی پست‌های دارای تصویر.
📁 <i>فایل‌های تغییریافته:</i> <code>agy_bridge.py</code>, <code>core/llm.py</code>
-4
View File
@@ -84,10 +84,6 @@ async def main():
await publisher.start()
logger.info("All Copykar services are active and running.")
try:
await admin_bot.broadcast_change_notes()
except Exception as e:
logger.debug(f"Could not broadcast change notes on startup: {e}")
# Graceful shutdown event
stop_event = asyncio.Event()
+13 -29
View File
@@ -1601,38 +1601,22 @@ class AdminBotService:
await event.reply(help_text, parse_mode="html", buttons=menu)
def get_latest_change_notes(self) -> str:
"""Return the formatted change notes in Persian from RELEASE_NOTES.md."""
notes_file = os.path.join(os.path.dirname(os.path.dirname(__file__)), "RELEASE_NOTES.md")
if os.path.exists(notes_file):
try:
with open(notes_file, "r", encoding="utf-8") as f:
content = f.read().strip()
if content:
return content
except Exception as e:
logger.debug(f"Error reading RELEASE_NOTES.md: {e}")
"""Return the formatted change notes dynamically from the latest git commit."""
try:
res = subprocess.run(
["git", "log", "-1", "--pretty=format:🔹 <b>%s</b>%n%b"],
cwd=os.path.dirname(os.path.dirname(__file__)),
capture_output=True,
text=True,
timeout=5
)
if res.returncode == 0 and res.stdout.strip():
return f"📢 <b>آخرین تغییرات سیستم (Release Notes):</b>\n\n{res.stdout.strip()}"
except Exception as e:
logger.debug(f"Error reading git log for change notes: {e}")
return "📢 <b>گزارش تغییرات سیستم (Release Notes):</b>\nسیستم با آخرین به‌روزرسانی‌ها در حال اجرا است."
async def broadcast_change_notes(self):
"""Send latest change notes to admins and review channel if they are new."""
import hashlib
notes = self.get_latest_change_notes()
current_hash = hashlib.sha256(notes.encode("utf-8")).hexdigest()
last_hash = await self.repo.get_setting("last_broadcast_release_hash")
if last_hash == current_hash:
logger.info("Release notes have not changed since last broadcast. Skipping automatic broadcast.")
return
logger.info(f"Broadcasting new release notes directly to admin DMs (hash: {current_hash[:8]})...")
await self.notify_admins(notes, include_review_channel=False)
await self.repo.set_setting(
"last_broadcast_release_hash",
current_hash,
description="Hash of last broadcast release notes"
)
# --- Step-by-Step Parameter & Text Input Message Handler ---
@self.client.on(events.NewMessage)