Переглянути джерело

Merge branch 'dev/permission' of https://git.zyuas.com/LLM/chat-admin-web into dev/permission

* 'dev/permission' of https://git.zyuas.com/LLM/chat-admin-web:
  优化更新通知组件的版本内容提取逻辑,移除不必要的备用正则表达式,并更新文档中的版本公告格式以去除图标。
Ryuiso 1 місяць тому
батько
коміт
b9fe485e97

+ 5 - 11
src/help/components/UpdateNotification/UpdateNotification.tsx

@@ -33,23 +33,17 @@ const UpdateNotification: React.FC<UpdateNotificationProps> = ({ version }) => {
       import('../../docs/update-history/index.md?raw')
         .then((module) => {
           const fullContent = module.default;
-          // 提取第一个版本的内容(从第一个 ## <CalendarOutlined /> 到下一个 <hr 之间的内容)
-          const versionRegex = /##\s+<CalendarOutlined\s*\/>\s+\d{4}-\d{2}-\d{2}\s+版本公告\s+\([^)]+\)\s*\n([\s\S]*?)(?=<hr\s+style=|$)/;
+          // 提取第一个版本的内容(从第一个 ## 到下一个 <hr 之间的内容)
+          const versionRegex = /##\s+\d{4}-\d{2}-\d{2}\s+版本公告\s+\([^)]+\)\s*\n([\s\S]*?)(?=<hr\s+style=|$)/;
           const match = fullContent.match(versionRegex);
           
           if (match && match[1]) {
             // 只取内容部分,不包括版本标题
             setContent(match[1].trim());
           } else {
-            // 如果匹配失败,尝试备用正则
-            const fallbackRegex = /##\s+.*?\d{4}-\d{2}-\d{2}\s+版本公告.*?\n([\s\S]*?)(?=<hr\s+style=|##\s+|$)/;
-            const fallbackMatch = fullContent.match(fallbackRegex);
-            if (fallbackMatch && fallbackMatch[1]) {
-              setContent(fallbackMatch[1].trim());
-            } else {
-              console.warn('无法提取最新版本内容,显示完整文档');
-              setContent(fullContent);
-            }
+            // 如果匹配失败,显示完整文档
+            console.warn('无法提取最新版本内容,显示完整文档');
+            setContent(fullContent);
           }
           
           setTimeout(() => {

+ 2 - 2
src/help/docs/update-history/index.md

@@ -3,7 +3,7 @@
 
 <hr style="margin: 48px 0; border-top: 1px solid #f5f5f5;"/>
 
-## <CalendarOutlined /> 2025-12-11 版本公告 (v1.2)
+## 2025-12-11 版本公告 (v1.2)
 本次更新涉及知识库中的一些功能改进,解决了使用过程中的一些体验问题。
 
 ### 【最新活动】
@@ -73,7 +73,7 @@
 
 <hr style="margin: 48px 0; border-top: 1px solid #f5f5f5;"/>
 
-## <CalendarOutlined /> 2025-11-04 版本公告 (v1.1)
+## 2025-11-04 版本公告 (v1.1)
 
 
 ### 【新增功能】