From af5670f2f76ee4ef4c4b3300abb888e2ea0df4e4 Mon Sep 17 00:00:00 2001 From: matevip Date: Sat, 2 May 2026 21:46:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(ui):=20hot=20cache=20panel=20=E2=80=94=20v?= =?UTF-8?q?iew,=20regenerate,=20reset=20from=20KB=20detail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mateclaw-ui/src/api/index.ts | 21 ++ mateclaw-ui/src/i18n/locales/en-US.ts | 21 ++ mateclaw-ui/src/i18n/locales/zh-CN.ts | 21 ++ .../views/Wiki/components/HotCachePanel.vue | 289 ++++++++++++++++++ mateclaw-ui/src/views/Wiki/index.vue | 6 + 5 files changed, 358 insertions(+) create mode 100644 mateclaw-ui/src/views/Wiki/components/HotCachePanel.vue diff --git a/mateclaw-ui/src/api/index.ts b/mateclaw-ui/src/api/index.ts index b101122d..ebb58184 100644 --- a/mateclaw-ui/src/api/index.ts +++ b/mateclaw-ui/src/api/index.ts @@ -653,3 +653,24 @@ export const featureFlagApi = { update: (flagKey: string, data: FeatureFlagUpdate) => http.put(`/feature-flags/${flagKey}`, data), } + +export interface WikiHotCache { + id: number + kbId: number + content: string | null + contentHash: string | null + lastUpdated: string | null + updateReason: string | null + rebuildCount: number + lastRebuildStartedAt: string | null + lastRebuildDurationMs: number | null + lastRebuildError: string | null + createTime: string + updateTime: string +} + +export const hotCacheApi = { + get: (kbId: number) => http.get(`/wiki/hot-cache/${kbId}`), + regenerate: (kbId: number) => http.post(`/wiki/hot-cache/${kbId}/regenerate`), + reset: (kbId: number) => http.delete(`/wiki/hot-cache/${kbId}`), +} diff --git a/mateclaw-ui/src/i18n/locales/en-US.ts b/mateclaw-ui/src/i18n/locales/en-US.ts index 053fabe6..50137f16 100644 --- a/mateclaw-ui/src/i18n/locales/en-US.ts +++ b/mateclaw-ui/src/i18n/locales/en-US.ts @@ -1489,6 +1489,27 @@ export default { rawMaterials: 'Raw Materials', pages: 'Wiki Pages', config: 'Config', + hotCache: { + tab: 'Hot Cache', + title: 'Recent Activity Snapshot (Hot Cache)', + desc: 'A rolling markdown digest of what has been happening in this knowledge base, injected into the agent system prompt so chat does not have to re-search the obvious. Rebuilt asynchronously by the listener with a 5-minute debounce.', + empty: 'No snapshot yet — one will be built after the bound agent finishes its next conversation.', + contentEmpty: '(snapshot body is empty)', + regenerate: 'Rebuild now', + regenerating: 'Rebuilding…', + regenerateQueued: 'Rebuild queued; refreshing in a few seconds', + regenerateFailed: 'Failed to schedule rebuild', + reset: 'Clear snapshot', + resetConfirm: 'Clear the current snapshot? The next agent conversation will regenerate it.', + resetDone: 'Cleared', + resetFailed: 'Clear failed', + lastUpdated: 'Last updated', + updateReason: 'Trigger reason', + rebuildCount: 'Rebuilds', + lastDuration: 'Last duration', + lastError: 'Last error', + footer: 'Toggling wiki.hot_cache.enabled off short-circuits the injection path. The "Rebuild now" button bypasses the debounce window for easier debugging.', + }, searchPages: 'Search pages...', dropFiles: 'Drop files here or click to upload', dropToUpload: 'Release to upload', diff --git a/mateclaw-ui/src/i18n/locales/zh-CN.ts b/mateclaw-ui/src/i18n/locales/zh-CN.ts index e40f4808..8db7ceb8 100644 --- a/mateclaw-ui/src/i18n/locales/zh-CN.ts +++ b/mateclaw-ui/src/i18n/locales/zh-CN.ts @@ -1501,6 +1501,27 @@ export default { rawMaterials: '原始材料', pages: 'Wiki 页面', config: '处理配置', + hotCache: { + tab: '近况快照', + title: '近况快照(Hot Cache)', + desc: '该知识库最近发生了什么的滚动 markdown 摘要,会被自动注入到 Agent 的系统提示,让对话不必每次都重新检索。事件触发后台异步重建,5 分钟去抖。', + empty: '尚未生成快照——绑定的 Agent 完成一次对话后会自动构建。', + contentEmpty: '(快照内容为空)', + regenerate: '立即重建', + regenerating: '重建中…', + regenerateQueued: '已加入重建队列,几秒后刷新', + regenerateFailed: '重建调度失败', + reset: '清除快照', + resetConfirm: '确认清除当前快照?下次 Agent 对话会重新生成。', + resetDone: '已清除', + resetFailed: '清除失败', + lastUpdated: '上次更新', + updateReason: '触发原因', + rebuildCount: '累计重建次数', + lastDuration: '上次耗时', + lastError: '最近一次错误', + footer: '关闭 wiki.hot_cache.enabled 后注入路径短路;该面板的"立即重建"会绕过去抖,方便调试。', + }, searchPages: '搜索页面...', dropFiles: '拖拽文件到此处或点击上传', dropToUpload: '松开即开始上传', diff --git a/mateclaw-ui/src/views/Wiki/components/HotCachePanel.vue b/mateclaw-ui/src/views/Wiki/components/HotCachePanel.vue new file mode 100644 index 00000000..e62ca128 --- /dev/null +++ b/mateclaw-ui/src/views/Wiki/components/HotCachePanel.vue @@ -0,0 +1,289 @@ + + + + + diff --git a/mateclaw-ui/src/views/Wiki/index.vue b/mateclaw-ui/src/views/Wiki/index.vue index 12590cb5..23a1089e 100644 --- a/mateclaw-ui/src/views/Wiki/index.vue +++ b/mateclaw-ui/src/views/Wiki/index.vue @@ -282,6 +282,10 @@
+ +
+ +
@@ -318,6 +322,7 @@ import RawMaterialPanel from './components/RawMaterialPanel.vue' import WikiPageViewer from './components/WikiPageViewer.vue' import WikiConfig from './components/WikiConfig.vue' import WikiGraphView from './components/WikiGraphView.vue' +import HotCachePanel from './components/HotCachePanel.vue' const { t } = useI18n() const store = useWikiStore() @@ -507,6 +512,7 @@ const tabs = computed(() => [ { key: 'pages', label: t('wiki.pages') }, { key: 'graph', label: t('wiki.graph.tab') }, { key: 'config', label: t('wiki.config') }, + { key: 'hotCache', label: t('wiki.hotCache.tab') }, ]) async function selectKB(id: number) {