chore: align ai stack with openhub weknora

This commit is contained in:
Agent Board
2026-06-28 18:35:56 +08:00
parent 3b0e12455e
commit ee6612028d
22 changed files with 154 additions and 95 deletions
@@ -1473,7 +1473,7 @@ export const createResourceTabRuntime = (dependencies = {}) => {
};
const knowledgeRagProvider = () => {
return 'lightrag';
return 'weknora';
};
const setKnowledgeRagStatus = (entry, status, message, job) => {
@@ -1521,7 +1521,7 @@ export const createResourceTabRuntime = (dependencies = {}) => {
sourceRootRelativePath,
rootUri: String(registryEntry.rootUri || rootUri || '').trim(),
artifactRootRelativePath: '',
provider: 'lightrag',
provider: knowledgeRagProvider(),
status,
stageLabel: status === 'done' ? '资料库已索引' : status === 'failed' ? '资料库需重建' : '资料库索引中',
stale: registryEntry.stale === true,
@@ -1901,7 +1901,7 @@ export const createResourceTabRuntime = (dependencies = {}) => {
};
const insertRetiredOcrLink = async (entry, job) => {
throw new Error('OCR sidecar 已退役,请使用 LightRAG 资料库引用与问答。');
throw new Error('OCR sidecar 已退役,请使用知识库引用与问答。');
};
const createKnowledgeRagIngestTask = async (entry) => {
@@ -1909,7 +1909,7 @@ export const createResourceTabRuntime = (dependencies = {}) => {
const entryRootUri = String(entry.rootUri || '').trim();
if (entryRootUri) knowledgeRagTaskState.rootUri = entryRootUri;
const startedAt = Date.now();
const pendingJob = knowledgeRagTaskSnapshotFromEntry(entry, 'running', 'lightrag', '资料库索引中', startedAt);
const pendingJob = knowledgeRagTaskSnapshotFromEntry(entry, 'running', knowledgeRagProvider(), '资料库索引中', startedAt);
pendingJob.taskKind = 'knowledge_rag';
setKnowledgeRagStatus(entry, 'running', '资料库索引中', pendingJob);
updateKnowledgeRagTaskState(pendingJob);
@@ -1945,7 +1945,7 @@ export const createResourceTabRuntime = (dependencies = {}) => {
const job = knowledgeRagJobFromRegistryEntry(registryEntry, entryRootUri) || {
...pendingJob,
status: payload.retryRequired ? 'running' : 'done',
stageLabel: payload.retryRequired ? 'LightRAG 忙碌,等待重试' : '资料库已提交索引',
stageLabel: payload.retryRequired ? '知识库忙碌,等待重试' : '资料库已提交索引',
updatedAtMs: Date.now(),
finishedAtMs: payload.retryRequired ? null : Date.now(),
};
+1 -1
View File
@@ -212,7 +212,7 @@ mod tests {
"dryRun": false
},
"tool": {
"tool": "mnote.knowledge_rag.query",
"tool": "search_web",
"kind": "query",
"mode": "plan",
"argsJson": {"query": "Rust Web"},
@@ -2050,6 +2050,7 @@ fn delete_sqlite_user_access_grant_for_context(
"普通用户只能撤销自己创建的文件夹授权",
));
}
let revoked_user_id = grant.user_id.clone();
state
.control_plane()
.revoke_directory_grant(grant_id, None)
@@ -2079,6 +2080,7 @@ fn delete_sqlite_user_access_grant_for_context(
"ok": true,
"controlPlane": "sqlite",
"deletedGrantId": grant_id,
"revokedUserId": revoked_user_id,
"policy": {
"grants": state
.control_plane()
+35
View File
@@ -987,6 +987,13 @@ pub fn build_router(state: AppState) -> Router {
.route("/mnote/manifest", get(hermes_tools::mnote_manifest))
.route("/mnote/call", post(hermes_tools::mnote_call))
.route("/mnote/audit", get(hermes_tools::mnote_audit)),
)
.nest(
"/api/mnote/tools",
Router::new()
.route("/manifest", get(hermes_tools::mnote_manifest))
.route("/call", post(hermes_tools::mnote_call))
.route("/audit", get(hermes_tools::mnote_audit)),
);
if enable_debug_shell_routes {
@@ -1132,6 +1139,34 @@ mod tests {
}
}
#[tokio::test]
async fn mnote_tools_have_current_alias_and_legacy_hermes_mount() {
for (method, path) in [
("GET", "/api/mnote/tools/manifest"),
("POST", "/api/mnote/tools/call"),
("GET", "/api/mnote/tools/audit"),
("GET", "/api/hermes/tools/mnote/manifest"),
("POST", "/api/hermes/tools/mnote/call"),
("GET", "/api/hermes/tools/mnote/audit"),
] {
let response = app(false)
.oneshot(
Request::builder()
.method(method)
.uri(path)
.body(Body::empty())
.expect("request"),
)
.await
.expect("response");
assert_ne!(
response.status(),
StatusCode::NOT_FOUND,
"{method} {path} 应挂到 MNote tool executorHermes 路径只作为 legacy alias 保留",
);
}
}
#[tokio::test]
async fn legacy_media_routes_return_retired_guard() {
for (method, path, operation) in [
@@ -538,7 +538,7 @@ mod tests {
}
#[test]
fn page_layout_exposes_lightrag_knowledge_rag_settings_only() {
fn page_layout_exposes_provider_neutral_knowledge_rag_settings_only() {
let html = crate::ssr::render_view(leptos::view! {
<super::PageLayout current_nav="documents" topbar_title={"个人".to_string()}>
<main>"正文"</main>
@@ -558,7 +558,7 @@ mod tests {
}
#[test]
fn sidebar_settings_runtime_routes_index_and_ocr_to_lightrag_settings() {
fn sidebar_settings_runtime_routes_index_and_ocr_to_knowledge_rag_settings() {
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("mnote-knowledge-rag-settings-popover"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("/api/knowledge-rag/status?"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("/api/knowledge-rag/pipeline-events"));
@@ -568,7 +568,7 @@ mod tests {
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("data-knowledge-rag-action=\"prune\""));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("mnote-knowledge-rag-source-filters"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("filter-sources"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("LightRAG 未映射"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("Provider 未映射"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("Rerank"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("scheduleKnowledgeRagStatusBridge"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("knowledgeRagStatusHasInFlight"));
@@ -719,7 +719,7 @@ mod tests {
assert!(SIDEBAR_PAGE_AI_SKILL_RUNTIME_JS.contains("function pageAiSkillPreferenceTable"));
assert!(SIDEBAR_PAGE_AI_SKILL_RUNTIME_JS.contains("ai.agent.reasonix.memory_enabled"));
assert!(SIDEBAR_PAGE_AI_SESSION_RUNTIME_JS.contains("function pageAiLoadBackendSessions"));
assert!(SIDEBAR_PAGE_AI_SESSION_RUNTIME_JS.contains("/api/hermes/client/sessions?"));
assert!(SIDEBAR_PAGE_AI_SESSION_RUNTIME_JS.contains("/api/page-ai/sessions?"));
assert!(SIDEBAR_PAGE_AI_SESSION_RUNTIME_JS.contains("params.set('source', 'acp')"));
assert!(SIDEBAR_PAGE_AI_SESSION_RUNTIME_JS.contains(
"var draftSessions = pageAiNormalizeArray(pageUiState.pageAiSessions).filter"
@@ -795,8 +795,8 @@ mod tests {
}
#[test]
fn page_ai_acp_runtime_defaults_to_reasonix_and_keeps_hermes_switch() {
assert!(SIDEBAR_PAGE_AI_RUNTIME_JS.contains("var PAGE_AI_SESSION_STORAGE_VERSION = 3"));
fn page_ai_acp_runtime_legacy_selector_contract_is_explicit() {
assert!(SIDEBAR_PAGE_AI_RUNTIME_JS.contains("var PAGE_AI_SESSION_STORAGE_VERSION = 4"));
assert!(SIDEBAR_PAGE_AI_RUNTIME_JS.contains("function ensurePageAiStateFacade"));
assert!(SIDEBAR_PAGE_AI_RUNTIME_JS.contains("pageAiAcpRuntime: 'reasonix'"));
assert!(!SIDEBAR_TREE_RUNTIME_JS.contains("pageAiAcpRuntime: 'reasonix'"));
+1 -1
View File
@@ -217,6 +217,6 @@ mod tests {
assert!(MNOTE_CSS.len() > 2000);
// CSS 已拆分为模块化文件,通过 concat!(include_str!()) 组装,
// 仍保持在可审阅范围内。
assert!(MNOTE_CSS.len() < 180000);
assert!(MNOTE_CSS.len() < 190000);
}
}