Skip to content

Commit 5282551

Browse files
author
catlog22
committed
feat: 更新 CodexLens 工作区状态 API,支持通过查询参数指定项目路径
1 parent 76e1f85 commit 5282551

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

ccw/src/core/routes/codexlens/config-handlers.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ export async function handleCodexLensConfigRoutes(ctx: RouteContext): Promise<bo
110110
return true;
111111
}
112112

113+
// Use path from query param, fallback to initialPath
114+
const projectPath = url.searchParams.get('path') || initialPath;
115+
113116
// Get project info for current workspace
114-
const projectResult = await executeCodexLens(['projects', 'get', initialPath, '--json']);
117+
const projectResult = await executeCodexLens(['projects', 'get', projectPath, '--json']);
115118

116119
if (!projectResult.success) {
117120
// No index for this workspace
@@ -163,7 +166,7 @@ export async function handleCodexLensConfigRoutes(ctx: RouteContext): Promise<bo
163166
res.end(JSON.stringify({
164167
success: true,
165168
hasIndex: true,
166-
path: initialPath,
169+
path: projectPath,
167170
fts: {
168171
percent: ftsPercent,
169172
indexedFiles,

ccw/src/templates/dashboard-js/views/codexlens-manager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async function preloadCodexLensData() {
106106
!isCacheValid('rerankerConfig') ? fetch('/api/codexlens/reranker/config').then(r => r.json()).then(d => setCacheData('rerankerConfig', d)) : Promise.resolve(),
107107
!isCacheValid('rerankerModels') ? fetch('/api/codexlens/reranker/models').then(r => r.json()).then(d => setCacheData('rerankerModels', d)).catch(() => null) : Promise.resolve(),
108108
// Workspace status
109-
!isCacheValid('workspaceStatus') ? fetch('/api/codexlens/workspace-status').then(r => r.json()).then(d => setCacheData('workspaceStatus', d)).catch(() => null) : Promise.resolve(),
109+
!isCacheValid('workspaceStatus') ? fetch('/api/codexlens/workspace-status?path=' + encodeURIComponent(projectPath || '')).then(r => r.json()).then(d => setCacheData('workspaceStatus', d)).catch(() => null) : Promise.resolve(),
110110
// Semantic status (for FastEmbed detection)
111111
!isCacheValid('semanticStatus') ? fetch('/api/codexlens/semantic/status').then(r => r.json()).then(d => setCacheData('semanticStatus', d)).catch(() => null) : Promise.resolve(),
112112
// Environment variables
@@ -172,7 +172,7 @@ async function refreshWorkspaceIndexStatus(forceRefresh) {
172172
}
173173

174174
try {
175-
var response = await fetch('/api/codexlens/workspace-status');
175+
var response = await fetch('/api/codexlens/workspace-status?path=' + encodeURIComponent(projectPath || ''));
176176
var result = await response.json();
177177

178178
// Cache the result

0 commit comments

Comments
 (0)