chore: harden lightrag knowledge rag runtime

This commit is contained in:
lix-2026
2026-06-09 22:12:09 +08:00
parent 922965d30f
commit f698aad964
22 changed files with 899 additions and 101 deletions
@@ -543,6 +543,7 @@ mod tests {
fn sidebar_settings_runtime_routes_index_and_ocr_to_lightrag_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"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("/api/knowledge-rag/ingest"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("/api/knowledge-rag/prune-registry"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("use-filetree-selection"));
@@ -553,6 +554,22 @@ mod tests {
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("Rerank"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("scheduleKnowledgeRagStatusBridge"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("knowledgeRagStatusHasInFlight"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("new EventSource(url.toString())"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("pipeline_status"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("pipeline.pendingEnqueues"));
assert!(
SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("data-mnote-knowledge-rag-watcher-required")
);
assert!(!SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("runKnowledgeRagStatusBridge"));
assert!(!SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("knowledgeRagBridgeDelays"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("knowledgeRagRegistryStatusDigest"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("registry-status-changed"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("knowledgeRagIndeterminateProgress"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("data-progress-mode"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("indeterminate"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("analyzing"));
assert!(crate::ssr::styles::MNOTE_CSS
.contains("mnote-knowledge-rag-source-progress[data-progress-mode=\"indeterminate\"]"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("delete_submitted"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("delete_completed"));
assert!(SIDEBAR_PAGE_SETTINGS_RUNTIME_JS.contains("publicKnowledgeRagDashboardUrl"));
@@ -695,11 +712,15 @@ mod tests {
SIDEBAR_PAGE_AI_SESSION_RUNTIME_JS.contains("function pageAiLoadBackendSessionDetail")
);
assert!(SIDEBAR_PAGE_AI_SESSION_RUNTIME_JS.contains("function pageAiSearchBackendSessions"));
assert!(SIDEBAR_PAGE_AI_SESSION_RUNTIME_JS
.contains("function pageAiDeleteSelectedBackendSessions"));
assert!(SIDEBAR_PAGE_AI_SESSION_RUNTIME_JS.contains("function pageAiCheckActiveRun"));
assert!(SIDEBAR_PAGE_AI_SESSION_RUNTIME_JS.contains("/api/page-ai/sessions/"));
assert!(SIDEBAR_PAGE_AI_SESSION_RUNTIME_JS.contains("/active-run?"));
assert!(SIDEBAR_PAGE_AI_RENDER_RUNTIME_JS.contains("data-page-ai-session-rename"));
assert!(SIDEBAR_PAGE_AI_RENDER_RUNTIME_JS.contains("data-page-ai-session-delete"));
assert!(SIDEBAR_PAGE_AI_RENDER_RUNTIME_JS.contains("data-page-ai-session-select"));
assert!(SIDEBAR_PAGE_AI_RENDER_RUNTIME_JS.contains("data-page-ai-session-delete-selected"));
assert!(SIDEBAR_PAGE_AI_RENDER_RUNTIME_JS.contains("data-page-ai-session-resume"));
assert!(SIDEBAR_PAGE_AI_RENDER_RUNTIME_JS.contains("data-page-ai-session-search"));
assert!(SIDEBAR_PAGE_AI_RENDER_RUNTIME_JS.contains("function pageAiRenderThoughtGroup"));
+104
View File
@@ -4038,9 +4038,17 @@ body {
background: #2F7D4A;
}
.mnote-knowledge-rag-source-progress[data-progress-mode="indeterminate"] i {
width: 38%;
animation: mnote-task-progress-slide 1.15s ease-in-out infinite;
}
.mnote-knowledge-rag-source-progress span {
max-width: 72px;
overflow: hidden;
color: #5F5A54;
font: 10px/14px "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -4537,6 +4545,10 @@ body {
cursor: pointer;
}
.wolai-page-ai-ghost--danger {
color: #B33A3A;
}
.wolai-page-share-dialog {
position: fixed;
inset: 0;
@@ -5234,8 +5246,16 @@ html[data-mnote-page-ai-resizing="true"] {
}
.wolai-page-ai-message--history {
position: relative;
display: grid;
grid-template-columns: 24px minmax(0, 1fr);
width: 100%;
min-height: 58px;
align-items: flex-start;
gap: 6px;
padding: 8px;
border: 1px solid rgba(27, 28, 28, 0.08);
border-radius: 8px;
text-align: left;
}
@@ -5244,6 +5264,59 @@ html[data-mnote-page-ai-resizing="true"] {
background: #F4F8FF;
}
.wolai-page-ai-message--history.is-selected {
border-color: rgba(37, 99, 235, 0.36);
background: #F5F8FF;
}
.wolai-page-ai-history-selection {
display: flex;
min-width: 0;
align-items: center;
justify-content: flex-end;
gap: 6px;
color: #5A5A5A;
font-size: 12px;
line-height: 18px;
}
.wolai-page-ai-history-selection[hidden] {
display: none !important;
}
.wolai-page-ai-session-check {
width: 20px;
height: 20px;
margin-top: 1px;
padding: 0;
border: 1px solid rgba(27, 28, 28, 0.18);
border-radius: 6px;
background: #FFF;
color: #2563EB;
cursor: pointer;
opacity: 0;
}
.wolai-page-ai-session-check span {
display: grid;
width: 100%;
height: 100%;
place-items: center;
font-size: 12px;
line-height: 1;
}
.wolai-page-ai-message--history:hover .wolai-page-ai-session-check,
.wolai-page-ai-message--history:focus-within .wolai-page-ai-session-check,
.wolai-page-ai-message--history.is-selected .wolai-page-ai-session-check {
opacity: 1;
}
.wolai-page-ai-session-check[aria-checked="true"] {
border-color: rgba(37, 99, 235, 0.5);
background: #EAF1FF;
}
.wolai-page-ai-message--user {
background: #F4F8FF;
}
@@ -5358,12 +5431,43 @@ button.wolai-page-ai-message-text {
cursor: pointer;
}
button.wolai-page-ai-history-main {
display: grid;
gap: 1px;
min-width: 0;
}
button.wolai-page-ai-history-main strong,
button.wolai-page-ai-history-main span {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.wolai-page-ai-message-actions {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.wolai-page-ai-history-actions {
position: absolute;
top: 6px;
right: 6px;
flex-wrap: nowrap;
justify-content: flex-end;
opacity: 0;
pointer-events: none;
background: inherit;
}
.wolai-page-ai-message--history:hover .wolai-page-ai-history-actions,
.wolai-page-ai-message--history:focus-within .wolai-page-ai-history-actions {
opacity: 1;
pointer-events: auto;
}
.wolai-page-ai-permission-dialog {
position: fixed;
right: 28px;