feat: remove API worker and batch size configurations; update CodexLens settings for v2

This commit is contained in:
catlog22
2026-03-17 20:44:26 +08:00
parent f37189dc64
commit ef2c5a58e1
11 changed files with 313 additions and 142 deletions

View File

@@ -20,8 +20,6 @@ const mockStatus: CodexLensVenvStatus = {
const mockConfig: CodexLensConfig = {
index_dir: '~/.codexlens/indexes',
index_count: 100,
api_max_workers: 4,
api_batch_size: 8,
};
// Mock window.alert
@@ -243,8 +241,6 @@ describe('OverviewTab', () => {
const emptyConfig: CodexLensConfig = {
index_dir: '',
index_count: 0,
api_max_workers: 4,
api_batch_size: 8,
};
render(

View File

@@ -54,8 +54,6 @@ import {
const mockConfig: CodexLensConfig = {
index_dir: '~/.codexlens/indexes',
index_count: 100,
api_max_workers: 4,
api_batch_size: 8,
};
const mockEnv: Record<string, string> = {
@@ -75,8 +73,6 @@ function setupDefaultMocks() {
config: mockConfig,
indexDir: mockConfig.index_dir,
indexCount: 100,
apiMaxWorkers: 4,
apiBatchSize: 8,
isLoading: false,
error: null,
refetch: vi.fn(),
@@ -298,8 +294,6 @@ describe('SettingsTab', () => {
config: mockConfig,
indexDir: mockConfig.index_dir,
indexCount: 100,
apiMaxWorkers: 4,
apiBatchSize: 8,
isLoading: true,
error: null,
refetch: vi.fn(),

View File

@@ -1,8 +1,8 @@
// ========================================
// CodexLens Settings Tab
// ========================================
// Structured form for CodexLens env configuration
// Renders 5 groups: embedding, reranker, concurrency, cascade, chunking
// Structured form for CodexLens v2 env configuration
// Renders 4 groups: embedding, reranker, search, indexing
// Plus a general config section (index_dir)
import { useState, useEffect, useCallback, useMemo } from 'react';
@@ -33,12 +33,10 @@ export function SettingsTab({ enabled = true }: SettingsTabProps) {
const { formatMessage } = useIntl();
const { success, error: showError } = useNotifications();
// Fetch current config (index_dir, workers, batch_size)
// Fetch current config (index_dir, index_count)
const {
config,
indexCount,
apiMaxWorkers,
apiBatchSize,
isLoading: isLoadingConfig,
refetch: refetchConfig,
} = useCodexLensConfig({ enabled });
@@ -199,25 +197,13 @@ export function SettingsTab({ enabled = true }: SettingsTabProps) {
<div className="space-y-6">
{/* Current Info Card */}
<Card className="p-4 bg-muted/30">
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 text-sm">
<div className="text-sm">
<div>
<span className="text-muted-foreground">
{formatMessage({ id: 'codexlens.settings.currentCount' })}
</span>
<p className="text-foreground font-medium">{indexCount}</p>
</div>
<div>
<span className="text-muted-foreground">
{formatMessage({ id: 'codexlens.settings.currentWorkers' })}
</span>
<p className="text-foreground font-medium">{apiMaxWorkers}</p>
</div>
<div>
<span className="text-muted-foreground">
{formatMessage({ id: 'codexlens.settings.currentBatchSize' })}
</span>
<p className="text-foreground font-medium">{apiBatchSize}</p>
</div>
</div>
</Card>