chore: retire openhub and pi ts runtime
This commit is contained in:
@@ -1272,7 +1272,6 @@ const AI_ADMIN_SCRIPT: &str = r#"
|
||||
|
||||
function renderServicePanels(piStatus, effectivePayload) {
|
||||
var providers = effectivePayload && Array.isArray(effectivePayload.providers) ? effectivePayload.providers : [];
|
||||
var openhubStatus = '兼容保留';
|
||||
var defaultModel = effectivePayload && (effectivePayload.defaultModel || effectivePayload.default_model || '');
|
||||
var piDefaultModel = piStatus
|
||||
? normalizeModelRef(piStatus.defaultModelProvider || piStatus.default_model_provider, piStatus.defaultModelId || piStatus.default_model_id)
|
||||
@@ -1329,20 +1328,6 @@ const AI_ADMIN_SCRIPT: &str = r#"
|
||||
'</details>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="mnote-ai-admin-admin-card">' +
|
||||
'<div class="mnote-ai-admin-admin-card-head"><h3>OpenHub</h3><span class="mnote-ai-admin-actions-bar">' +
|
||||
renderTag(openhubStatus, 'orange') +
|
||||
'<a href="/page-ai/openhub/admin" class="mnote-ai-admin-policy-link">打开 OpenHub Admin</a>' +
|
||||
'</span></div>' +
|
||||
'<div class="mnote-ai-admin-admin-card-body">' +
|
||||
'<div class="mnote-ai-admin-kv-grid">' +
|
||||
renderKv('定位', '迁移期兼容 / admin 边界,不再作为默认 Page AI chat') +
|
||||
renderKv('MNote 侧入口', '/page-ai/openhub/ai') +
|
||||
renderKv('管理入口', '/page-ai/openhub/admin') +
|
||||
renderKv('后续策略', '只保留一个用户 Page AI 入口,OpenHub 不再扩展重复面板能力') +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
}
|
||||
if (channelsPanel) {
|
||||
@@ -1408,7 +1393,6 @@ const AI_ADMIN_SCRIPT: &str = r#"
|
||||
if (healthGrid) {
|
||||
healthGrid.innerHTML = [
|
||||
['Pi Rust Page AI', piRunning ? '运行中' : (piRuntimeAvailable ? '可启动' : '不可用'), 'impl=' + piRuntimeImpl + ' · runtime=' + piRuntime + ' · model=' + piDefaultModel],
|
||||
['OpenHub', '兼容保留', '迁移期 admin / fallback 边界,不再作为默认 Page AI chat'],
|
||||
['LightRAG', '默认', '唯一默认 knowledge provider,Pi 通过 MNote facade 查询'],
|
||||
['Control-plane', effectivePayload && (effectivePayload.sourceOfTruth || effectivePayload.source_of_truth) || 'directory_grants', '授权、策略、receipt 真相层']
|
||||
].map(function(item) {
|
||||
@@ -1605,7 +1589,7 @@ const AI_ADMIN_SCRIPT: &str = r#"
|
||||
'</div>';
|
||||
var body = '';
|
||||
if (activePanel === 'tools') {
|
||||
body = '<div class="mnote-ai-admin-user-section"><div class="mnote-ai-admin-user-section-title"><h3>工具权限</h3><small>按 OpenHub risk_level 分组</small></div>' + (tools || '<div class="mnote-ai-admin-empty">暂无工具</div>') + '</div>';
|
||||
body = '<div class="mnote-ai-admin-user-section"><div class="mnote-ai-admin-user-section-title"><h3>工具权限</h3><small>按 MNote policy 分组</small></div>' + (tools || '<div class="mnote-ai-admin-empty">暂无工具</div>') + '</div>';
|
||||
} else if (activePanel === 'skills') {
|
||||
body = '<div class="mnote-ai-admin-user-section"><div class="mnote-ai-admin-user-section-title"><h3>Skills</h3><small>全局启用后用户可单独降权</small></div>' + (skills || '<div class="mnote-ai-admin-empty">暂无 Skill</div>') + '</div>';
|
||||
} else if (activePanel === 'mcp') {
|
||||
@@ -1621,7 +1605,7 @@ const AI_ADMIN_SCRIPT: &str = r#"
|
||||
'</div>' +
|
||||
(roots || '<div class="mnote-ai-admin-empty">暂无可单独管理的目录权限</div>') + '</div>';
|
||||
} else {
|
||||
body = '<div class="mnote-ai-admin-user-section"><div class="mnote-ai-admin-user-section-title"><h3>模型权限</h3><small>按 provider 分组,参考 OpenHub 用户模型权限</small></div>' + (modelRows || '<div class="mnote-ai-admin-empty">暂无可用模型</div>') +
|
||||
body = '<div class="mnote-ai-admin-user-section"><div class="mnote-ai-admin-user-section-title"><h3>模型权限</h3><small>按 provider/model policy 分组</small></div>' + (modelRows || '<div class="mnote-ai-admin-empty">暂无可用模型</div>') +
|
||||
'<label class="mnote-ai-admin-label">默认模型</label><select class="mnote-ai-admin-select" data-user-default-model>' +
|
||||
catalogModels.filter(function(model) { return allowedIds.has(model.id); }).map(function(model) {
|
||||
return '<option value="' + escapeHtml(model.id) + '"' + (payload.defaultModel === model.id ? ' selected' : '') + '>' + escapeHtml(model.name || model.id) + '</option>';
|
||||
@@ -1719,10 +1703,21 @@ const AI_ADMIN_SCRIPT: &str = r#"
|
||||
var allowedModels = selectedUserSettings && selectedUserSettings.allowedModels
|
||||
? selectedUserSettings.allowedModels.map(function(model) { return model.id; })
|
||||
: [];
|
||||
var catalogModelIds = new Set((selectedUserSettings && selectedUserSettings.catalogModels || []).map(function(model) { return model.id; }).filter(Boolean));
|
||||
if (catalogModelIds.size) {
|
||||
allowedModels = allowedModels.filter(function(modelId) { return catalogModelIds.has(modelId); });
|
||||
}
|
||||
if (modelInputs.length) {
|
||||
allowedModels = Array.from(userSettingsEditor.querySelectorAll('[data-user-model]:checked')).map(function(input) { return input.getAttribute('data-user-model'); });
|
||||
}
|
||||
var defaultSelect = userSettingsEditor.querySelector('[data-user-default-model]');
|
||||
var defaultModel = defaultSelect ? defaultSelect.value : ((selectedUserSettings && selectedUserSettings.defaultModel) || '');
|
||||
if (catalogModelIds.size && defaultModel && !catalogModelIds.has(defaultModel)) {
|
||||
defaultModel = allowedModels[0] || '';
|
||||
}
|
||||
if (defaultModel && allowedModels.indexOf(defaultModel) === -1) {
|
||||
defaultModel = allowedModels[0] || '';
|
||||
}
|
||||
var tools = {};
|
||||
(selectedUserSettings && selectedUserSettings.tools || []).forEach(function(tool) {
|
||||
tools[tool.name] = tool.action;
|
||||
@@ -1752,16 +1747,19 @@ const AI_ADMIN_SCRIPT: &str = r#"
|
||||
piExtensions[input.getAttribute('data-user-pi-extension')] = input.checked;
|
||||
});
|
||||
try {
|
||||
var payload = {
|
||||
tools: tools,
|
||||
skills: skills,
|
||||
mcpServers: mcpServers,
|
||||
piExtensions: piExtensions
|
||||
};
|
||||
if (modelInputs.length || defaultSelect) {
|
||||
payload.allowedModels = allowedModels;
|
||||
payload.defaultModel = defaultModel;
|
||||
}
|
||||
await requestJson('/api/ai-admin/users/' + encodeURIComponent(selectedUserId) + '/settings', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({
|
||||
allowedModels: allowedModels,
|
||||
defaultModel: defaultSelect ? defaultSelect.value : ((selectedUserSettings && selectedUserSettings.defaultModel) || ''),
|
||||
tools: tools,
|
||||
skills: skills,
|
||||
mcpServers: mcpServers,
|
||||
piExtensions: piExtensions
|
||||
})
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
showSaveStatus(userSettingsStatus, 'success', '用户 AI 配置已保存');
|
||||
await loadUserSettings(selectedUserId);
|
||||
@@ -1835,7 +1833,7 @@ const AI_ADMIN_SCRIPT: &str = r#"
|
||||
try {
|
||||
piStatus = await requestJson('/api/page-ai/pi/status', { method: 'GET' });
|
||||
} catch (_err) {
|
||||
// Pi Lab 状态失败不阻塞 OpenHub / 管理页主面板。
|
||||
// Pi Lab 状态失败不阻塞管理页主面板。
|
||||
}
|
||||
renderServicePanels(piStatus, payload);
|
||||
}
|
||||
@@ -2518,13 +2516,18 @@ const AI_ADMIN_SCRIPT: &str = r#"
|
||||
}
|
||||
var allowedRaw = val('allowedModels');
|
||||
var failoverRaw = val('failoverChains');
|
||||
var allowedModels = allowedRaw ? allowedRaw.split(',').map(function(s) { return s.trim(); }).filter(Boolean) : [];
|
||||
var defaultModel = val('defaultModel');
|
||||
if (defaultModel && allowedModels.length && allowedModels.indexOf(defaultModel) === -1) {
|
||||
defaultModel = allowedModels[0];
|
||||
}
|
||||
return {
|
||||
id: val('id'),
|
||||
name: val('name'),
|
||||
baseUrl: val('baseUrl'),
|
||||
secretRef: val('secretRef'),
|
||||
allowedModels: allowedRaw ? allowedRaw.split(',').map(function(s) { return s.trim(); }).filter(Boolean) : [],
|
||||
defaultModel: val('defaultModel'),
|
||||
allowedModels: allowedModels,
|
||||
defaultModel: defaultModel,
|
||||
defaultBuildModel: val('defaultBuildModel'),
|
||||
defaultPlanModel: val('defaultPlanModel'),
|
||||
defaultTaskModel: val('defaultTaskModel'),
|
||||
@@ -3029,7 +3032,7 @@ pub fn AiManagementPage(
|
||||
<div class="mnote-ai-admin-section-header">
|
||||
<div>
|
||||
<h2>"用户管理"</h2>
|
||||
<p class="mnote-ai-admin-section-desc">"参考 OpenHub:用户、逐用户模型/工具/目录授权"</p>
|
||||
<p class="mnote-ai-admin-section-desc">"用户、逐用户模型/工具/目录授权"</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mnote-ai-admin-section-body">
|
||||
@@ -3083,9 +3086,8 @@ pub fn AiManagementPage(
|
||||
<div class="mnote-ai-admin-section-header">
|
||||
<div>
|
||||
<h2>"Pi Rust 服务"</h2>
|
||||
<p class="mnote-ai-admin-section-desc">"Pi Rust 是默认 Page AI runtime;OpenHub 仅保留为迁移期兼容 / admin 边界"</p>
|
||||
<p class="mnote-ai-admin-section-desc">"Pi Rust 是默认 Page AI runtime;历史 host 已软归档到 recycle 边界"</p>
|
||||
</div>
|
||||
<a href="/page-ai/openhub/admin" class="mnote-ai-admin-policy-link">"打开 OpenHub Admin"</a>
|
||||
</div>
|
||||
<div class="mnote-ai-admin-section-body">
|
||||
<div data-ai-admin-service-panel>
|
||||
@@ -3263,7 +3265,7 @@ pub fn AiManagementPage(
|
||||
<div class="mnote-ai-admin-section-header">
|
||||
<div>
|
||||
<h2>"渠道管理"</h2>
|
||||
<p class="mnote-ai-admin-section-desc">"OpenHub 的渠道管理在 MNote 中收敛为 provider/model policy"</p>
|
||||
<p class="mnote-ai-admin-section-desc">"渠道管理在 MNote 中收敛为 provider/model policy"</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mnote-ai-admin-section-body">
|
||||
@@ -3308,7 +3310,7 @@ pub fn AiManagementPage(
|
||||
<div class="mnote-ai-admin-section-header">
|
||||
<div>
|
||||
<h2>"系统监控"</h2>
|
||||
<p class="mnote-ai-admin-section-desc">"以 AI 相关服务健康为主,不复制 OpenHub 进程管理"</p>
|
||||
<p class="mnote-ai-admin-section-desc">"以 AI 相关服务健康为主,不复制已退役 host 进程管理"</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mnote-ai-admin-section-body">
|
||||
|
||||
@@ -2221,71 +2221,10 @@ button.wolai-page-ai-history-main span {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wolai-page-ai-drawer[data-page-ai-openhub-host="true"] .wolai-page-ai-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wolai-page-ai-drawer[data-page-ai-openhub-host="true"] .wolai-page-ai-resize-handle {
|
||||
left: -12px;
|
||||
}
|
||||
|
||||
.wolai-page-ai-opencode-header {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.wolai-page-ai-openhub-diagnostics {
|
||||
flex: 0 0 auto;
|
||||
max-height: 32px;
|
||||
overflow: hidden;
|
||||
border-bottom: 1px solid rgba(27, 28, 28, 0.08);
|
||||
background: rgba(247, 247, 245, 0.78);
|
||||
color: rgba(27, 28, 28, 0.58);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.wolai-page-ai-openhub-diagnostics[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.wolai-page-ai-openhub-diagnostics summary {
|
||||
min-height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 12px;
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.wolai-page-ai-openhub-diagnostics summary::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.wolai-page-ai-openhub-diagnostics:not([open]) > :not(summary) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.wolai-page-ai-openhub-diagnostics[open] {
|
||||
max-height: min(36vh, 220px);
|
||||
overflow: auto;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.wolai-page-ai-openhub-diagnostics[open] summary {
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.wolai-page-ai-openhub-diagnostics .wolai-page-ai-opencode-row,
|
||||
.wolai-page-ai-openhub-diagnostics .wolai-page-ai-opencode-empty,
|
||||
.wolai-page-ai-openhub-diagnostics .wolai-page-ai-opencode-badges {
|
||||
margin-right: 12px;
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
.wolai-page-ai-opencode-chrome {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
|
||||
Reference in New Issue
Block a user