chore(web,server): 移除全套AI助手功能相关代码
删除后端AI助手服务文件及对应的/api/ai-assistant接口路由,移除前端ai-assistant.js脚本及所有HTML页面中的脚本引用,清理静态资源版本配置文件里的相关配置项,同时更新bump-web-asset-version.js脚本的示例命令与错误提示文本。
This commit is contained in:
@@ -13,8 +13,6 @@
|
||||
'/api/public/popular',
|
||||
'/api/assets/manifest'
|
||||
];
|
||||
const ASSISTANT_SCRIPT_ID = 'tm-ai-assistant-script';
|
||||
const ASSISTANT_ASSET_VERSION = '2';
|
||||
|
||||
const roots = () => Array.from(document.querySelectorAll('[data-server-status-root]'));
|
||||
|
||||
@@ -68,29 +66,8 @@
|
||||
};
|
||||
|
||||
let timerId = null;
|
||||
const isAssistantEligiblePage = (body) => {
|
||||
if (!body) return false;
|
||||
if (body.classList.contains('jr-admin-page') || body.classList.contains('jr-admin-login-page')) return false;
|
||||
return body.classList.contains('jr-public-page')
|
||||
|| body.classList.contains('public-search')
|
||||
|| body.classList.contains('jr-order-page')
|
||||
|| body.classList.contains('jr-ticket-board-page');
|
||||
};
|
||||
|
||||
const loadAssistant = () => {
|
||||
const body = document.body;
|
||||
if (!isAssistantEligiblePage(body)) return;
|
||||
if (document.getElementById(ASSISTANT_SCRIPT_ID) || window.__tmAiAssistantLoaded) return;
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.id = ASSISTANT_SCRIPT_ID;
|
||||
script.src = `/ai-assistant.js?v=${ASSISTANT_ASSET_VERSION}`;
|
||||
script.defer = true;
|
||||
document.head.appendChild(script);
|
||||
};
|
||||
|
||||
const init = () => {
|
||||
loadAssistant();
|
||||
if (!roots().length || timerId !== null) return;
|
||||
|
||||
refresh();
|
||||
|
||||
Reference in New Issue
Block a user