From 4a3ff822007076663dbb0a4ad7acb64095663a30 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Sat, 20 Dec 2025 13:51:50 +0800 Subject: [PATCH] fix: Align semantic status check with CodexLens checkSemanticStatus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use checkSemanticStatus() from codex-lens.ts instead of isEmbedderAvailable() - Returns accurate detection of fastembed installation status - Fix install guide link to navigate to CLI Manager and open CodexLens config - Update i18n: "Install Guide" -> "Go to Settings" (EN/ZH) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- README.md | 2 +- README_CN.md | 2 +- ccw/src/core/routes/core-memory-routes.ts | 37 +++++++++++++++---- ccw/src/templates/dashboard-js/i18n.js | 8 ++-- .../views/core-memory-clusters.js | 37 ++++++++++++++++++- 5 files changed, 70 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index ee59b107..e329cb5e 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ ccw install -m Path -p ./my-project ccw view # Start dashboard server on custom port -ccw serve -p 8080 +ccw serve --port 8080 # Upgrade all installations ccw upgrade -a diff --git a/README_CN.md b/README_CN.md index e31c3693..9d2f99a1 100644 --- a/README_CN.md +++ b/README_CN.md @@ -102,7 +102,7 @@ ccw install -m Path -p ./my-project ccw view # 在自定义端口启动仪表板服务器 -ccw serve -p 8080 +ccw serve --port 8080 # 升级所有安装 ccw upgrade -a diff --git a/ccw/src/core/routes/core-memory-routes.ts b/ccw/src/core/routes/core-memory-routes.ts index 3efc4804..325abf15 100644 --- a/ccw/src/core/routes/core-memory-routes.ts +++ b/ccw/src/core/routes/core-memory-routes.ts @@ -2,7 +2,8 @@ import * as http from 'http'; import { URL } from 'url'; import { getCoreMemoryStore } from '../core-memory-store.js'; import type { CoreMemory, SessionCluster, ClusterMember, ClusterRelation } from '../core-memory-store.js'; -import { getEmbeddingStatus, generateEmbeddings, isEmbedderAvailable } from '../memory-embedder-bridge.js'; +import { getEmbeddingStatus, generateEmbeddings } from '../memory-embedder-bridge.js'; +import { checkSemanticStatus } from '../../tools/codex-lens.js'; import { StoragePaths } from '../../config/storage-paths.js'; import { join } from 'path'; @@ -309,9 +310,19 @@ export async function handleCoreMemoryRoutes(ctx: RouteContext): Promise CodexLens > Semantic page.', status: 503 }; } const paths = StoragePaths.project(basePath); diff --git a/ccw/src/templates/dashboard-js/i18n.js b/ccw/src/templates/dashboard-js/i18n.js index 598ba820..14b8cc5e 100644 --- a/ccw/src/templates/dashboard-js/i18n.js +++ b/ccw/src/templates/dashboard-js/i18n.js @@ -1281,8 +1281,8 @@ const i18n = { 'coreMemory.clusteringInProgress': 'Clustering in progress...', 'coreMemory.clusteringComplete': 'Created {created} clusters with {sessions} sessions', 'coreMemory.clusteringError': 'Auto-clustering failed', - 'coreMemory.embeddingNotAvailable': 'Vector model not installed. Install to improve clustering accuracy.', - 'coreMemory.installGuide': 'Install Guide', + 'coreMemory.embeddingNotAvailable': 'Semantic search not installed. Install to improve clustering accuracy.', + 'coreMemory.installGuide': 'Go to Settings', 'coreMemory.embeddingProgress': 'Embeddings: {pct}% ({pending} pending)', 'coreMemory.generateEmbeddings': 'Generate', 'coreMemory.noChunksYet': 'No memories chunked yet. Run "ccw memory embed" to enable semantic clustering.', @@ -2602,8 +2602,8 @@ const i18n = { 'coreMemory.clusteringInProgress': '聚类进行中...', 'coreMemory.clusteringComplete': '创建了 {created} 个聚类,包含 {sessions} 个 session', 'coreMemory.clusteringError': '自动聚类失败', - 'coreMemory.embeddingNotAvailable': '向量模型未安装。安装后可提升聚类准确度。', - 'coreMemory.installGuide': '安装指南', + 'coreMemory.embeddingNotAvailable': '语义搜索未安装。安装后可提升聚类准确度。', + 'coreMemory.installGuide': '前往设置', 'coreMemory.embeddingProgress': '嵌入进度: {pct}% (待处理: {pending})', 'coreMemory.generateEmbeddings': '生成', 'coreMemory.noChunksYet': '暂无记忆分块。运行 "ccw memory embed" 启用语义聚类。', diff --git a/ccw/src/templates/dashboard-js/views/core-memory-clusters.js b/ccw/src/templates/dashboard-js/views/core-memory-clusters.js index 944ce77a..5b3d9237 100644 --- a/ccw/src/templates/dashboard-js/views/core-memory-clusters.js +++ b/ccw/src/templates/dashboard-js/views/core-memory-clusters.js @@ -45,20 +45,29 @@ async function loadClusters() { * Render embedding status hint */ function renderEmbeddingHint() { + // No status data - API call failed if (!embeddingStatus) { + return ''; + } + + // Embedder not available - show install hint linking to status page + if (embeddingStatus.available === false) { return `
${t('coreMemory.embeddingNotAvailable')} - + ${t('coreMemory.installGuide')}
`; } + // Has pending chunks - show progress if (embeddingStatus.pending_chunks > 0) { - const pct = Math.round((embeddingStatus.embedded_chunks / embeddingStatus.total_chunks) * 100); + const pct = embeddingStatus.total_chunks > 0 + ? Math.round((embeddingStatus.embedded_chunks / embeddingStatus.total_chunks) * 100) + : 0; return `
@@ -70,18 +79,42 @@ function renderEmbeddingHint() { `; } + // No chunks yet - show hint to run embed if (embeddingStatus.total_chunks === 0) { return `
${t('coreMemory.noChunksYet')} +
`; } + // All embedded - no hint needed return ''; } +/** + * Switch to CLI Manager and show semantic install hint + */ +function switchToSemanticStatus() { + // Navigate to CLI Manager view (which contains the Semantic Search section) + const navItem = document.querySelector('[data-view="cli-manager"]'); + if (navItem) { + navItem.click(); + // Open CodexLens config modal after navigation + setTimeout(() => { + if (typeof openCodexLensConfig === 'function') { + openCodexLensConfig(); + } + }, 300); + } else { + showNotification(t('coreMemory.goToSemanticStatus'), 'info'); + } +} + /** * Trigger embedding generation */