mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-14 02:42:04 +08:00
feat: 更新 CodexLens 工作区状态 API,支持通过查询参数指定项目路径
This commit is contained in:
@@ -110,8 +110,11 @@ export async function handleCodexLensConfigRoutes(ctx: RouteContext): Promise<bo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use path from query param, fallback to initialPath
|
||||||
|
const projectPath = url.searchParams.get('path') || initialPath;
|
||||||
|
|
||||||
// Get project info for current workspace
|
// Get project info for current workspace
|
||||||
const projectResult = await executeCodexLens(['projects', 'get', initialPath, '--json']);
|
const projectResult = await executeCodexLens(['projects', 'get', projectPath, '--json']);
|
||||||
|
|
||||||
if (!projectResult.success) {
|
if (!projectResult.success) {
|
||||||
// No index for this workspace
|
// No index for this workspace
|
||||||
@@ -163,7 +166,7 @@ export async function handleCodexLensConfigRoutes(ctx: RouteContext): Promise<bo
|
|||||||
res.end(JSON.stringify({
|
res.end(JSON.stringify({
|
||||||
success: true,
|
success: true,
|
||||||
hasIndex: true,
|
hasIndex: true,
|
||||||
path: initialPath,
|
path: projectPath,
|
||||||
fts: {
|
fts: {
|
||||||
percent: ftsPercent,
|
percent: ftsPercent,
|
||||||
indexedFiles,
|
indexedFiles,
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ async function preloadCodexLensData() {
|
|||||||
!isCacheValid('rerankerConfig') ? fetch('/api/codexlens/reranker/config').then(r => r.json()).then(d => setCacheData('rerankerConfig', d)) : Promise.resolve(),
|
!isCacheValid('rerankerConfig') ? fetch('/api/codexlens/reranker/config').then(r => r.json()).then(d => setCacheData('rerankerConfig', d)) : Promise.resolve(),
|
||||||
!isCacheValid('rerankerModels') ? fetch('/api/codexlens/reranker/models').then(r => r.json()).then(d => setCacheData('rerankerModels', d)).catch(() => null) : Promise.resolve(),
|
!isCacheValid('rerankerModels') ? fetch('/api/codexlens/reranker/models').then(r => r.json()).then(d => setCacheData('rerankerModels', d)).catch(() => null) : Promise.resolve(),
|
||||||
// Workspace status
|
// Workspace status
|
||||||
!isCacheValid('workspaceStatus') ? fetch('/api/codexlens/workspace-status').then(r => r.json()).then(d => setCacheData('workspaceStatus', d)).catch(() => null) : Promise.resolve(),
|
!isCacheValid('workspaceStatus') ? fetch('/api/codexlens/workspace-status?path=' + encodeURIComponent(projectPath || '')).then(r => r.json()).then(d => setCacheData('workspaceStatus', d)).catch(() => null) : Promise.resolve(),
|
||||||
// Semantic status (for FastEmbed detection)
|
// Semantic status (for FastEmbed detection)
|
||||||
!isCacheValid('semanticStatus') ? fetch('/api/codexlens/semantic/status').then(r => r.json()).then(d => setCacheData('semanticStatus', d)).catch(() => null) : Promise.resolve(),
|
!isCacheValid('semanticStatus') ? fetch('/api/codexlens/semantic/status').then(r => r.json()).then(d => setCacheData('semanticStatus', d)).catch(() => null) : Promise.resolve(),
|
||||||
// Environment variables
|
// Environment variables
|
||||||
@@ -172,7 +172,7 @@ async function refreshWorkspaceIndexStatus(forceRefresh) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var response = await fetch('/api/codexlens/workspace-status');
|
var response = await fetch('/api/codexlens/workspace-status?path=' + encodeURIComponent(projectPath || ''));
|
||||||
var result = await response.json();
|
var result = await response.json();
|
||||||
|
|
||||||
// Cache the result
|
// Cache the result
|
||||||
|
|||||||
Reference in New Issue
Block a user