feat: Wave 3 - Dashboard redesign + RBAC + AI assistant updates
- Redesign index.html from system-monitor to user-centric workspace (welcome banner, summary cards, 今日待办, AI 智能建议, collapsible admin section) - Add fetchTodos/fetchSuggestions/getPriorityClass/isOverdue methods - Update uni-nav current-page from 'dashboard' to 'workspace' - Add require_role to 10 admin router imports (RBAC foundation) - Update ai-assistant.js: add factory/insights pages, org_id in chat requests
This commit is contained in:
@@ -169,13 +169,15 @@
|
||||
var token = localStorage.getItem('authToken');
|
||||
if (!token) return;
|
||||
|
||||
var pageMap = {
|
||||
'/': 'dashboard', '/index.html': 'dashboard',
|
||||
'topics.html': 'topics', 'metrics.html': 'metrics',
|
||||
'calendar.html': 'calendar', 'assets.html': 'assets',
|
||||
'tasks.html': 'tasks', 'platforms.html': 'platforms',
|
||||
'admin.html': 'admin'
|
||||
};
|
||||
var pageMap = {
|
||||
'/': 'dashboard', '/index.html': 'dashboard',
|
||||
'topics.html': 'topics', 'metrics.html': 'metrics',
|
||||
'calendar.html': 'calendar', 'assets.html': 'assets',
|
||||
'tasks.html': 'tasks', 'platforms.html': 'platforms',
|
||||
'admin.html': 'admin',
|
||||
'factory.html': 'factory',
|
||||
'insights.html': 'insights'
|
||||
};
|
||||
var path = window.location.pathname;
|
||||
var currentPage = pageMap[path] || pageMap['/'];
|
||||
|
||||
@@ -187,8 +189,10 @@
|
||||
'assets': '🖼️ 素材库管理图片和文件。我可以指导你如何上传素材、添加标签分类,或关联到相关选题。',
|
||||
'tasks': '⚡ 任务页面跟踪所有创作任务。我可以解释各任务的含义、查看执行进度,或排查任务失败原因。',
|
||||
'platforms': '🔗 平台配置管理各发布渠道。我可以帮你了解如何配置平台参数、设置发布格式。',
|
||||
'admin': '⚙️ 系统管理页面。我可以帮你管理用户、配置 LLM、查看运行日志,或设置采集类别和信息源。',
|
||||
};
|
||||
'admin': '⚙️ 系统管理页面。我可以帮你管理用户、配置 LLM、查看运行日志,或设置采集类别和信息源。',
|
||||
'factory': '🏭 这里是内容工厂。我可以帮你了解创作流程,从选题到发布的全链路跟踪,或排查任务失败原因。',
|
||||
'insights': '📈 数据洞察页面。我可以帮你解读内容表现数据、搜索排名变化趋势,或建议如何提升 GEO 就绪度。',
|
||||
};
|
||||
|
||||
var HISTORY_KEY = 'ai_assistant_history_' + currentPage;
|
||||
var saved = [];
|
||||
@@ -289,7 +293,9 @@
|
||||
var resp = await fetch('/api/assistant/chat', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
|
||||
body: JSON.stringify({ message: text, page: currentPage, history: history })
|
||||
var currentUser = null;
|
||||
try { currentUser = JSON.parse(localStorage.getItem('currentUser')); } catch(e) {}
|
||||
body: JSON.stringify({ message: text, page: currentPage, history: history, org_id: currentUser?.org_id || 'default' })
|
||||
});
|
||||
removeTyping();
|
||||
if (resp.ok) {
|
||||
|
||||
Reference in New Issue
Block a user