mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
feat: update execution commands to commit once per solution and enhance reranker model handling
This commit is contained in:
@@ -1181,10 +1181,10 @@ export async function handleCodexLensRoutes(ctx: RouteContext): Promise<boolean>
|
||||
try {
|
||||
const venvStatus = await checkVenvStatus();
|
||||
|
||||
// Default reranker config
|
||||
// Default reranker config (matches fastembed default)
|
||||
const rerankerConfig = {
|
||||
backend: 'onnx',
|
||||
model_name: 'cross-encoder/ms-marco-MiniLM-L-6-v2',
|
||||
backend: 'fastembed',
|
||||
model_name: 'Xenova/ms-marco-MiniLM-L-6-v2',
|
||||
api_provider: 'siliconflow',
|
||||
api_key_set: false,
|
||||
available_backends: ['onnx', 'api', 'litellm', 'legacy'],
|
||||
|
||||
@@ -1076,7 +1076,8 @@ function renderProviderList() {
|
||||
var container = document.getElementById('provider-list');
|
||||
if (!container) return;
|
||||
|
||||
var providers = apiSettingsData.providers || [];
|
||||
// Guard against null apiSettingsData
|
||||
var providers = (apiSettingsData && apiSettingsData.providers) ? apiSettingsData.providers : [];
|
||||
var query = providerSearchQuery.toLowerCase();
|
||||
|
||||
// Filter providers
|
||||
@@ -1147,6 +1148,12 @@ function renderProviderDetail(providerId) {
|
||||
var container = document.getElementById('provider-detail-panel');
|
||||
if (!container) return;
|
||||
|
||||
// Guard against null apiSettingsData
|
||||
if (!apiSettingsData || !apiSettingsData.providers) {
|
||||
renderProviderEmptyState();
|
||||
return;
|
||||
}
|
||||
|
||||
var provider = apiSettingsData.providers.find(function(p) { return p.id === providerId; });
|
||||
if (!provider) {
|
||||
renderProviderEmptyState();
|
||||
@@ -1370,6 +1377,9 @@ function toggleModelGroup(series) {
|
||||
expandedModelGroups.add(series);
|
||||
}
|
||||
|
||||
// Guard against null apiSettingsData
|
||||
if (!apiSettingsData || !apiSettingsData.providers) return;
|
||||
|
||||
var provider = apiSettingsData.providers.find(function(p) { return p.id === selectedProviderId; });
|
||||
if (provider) {
|
||||
renderModelTree(provider);
|
||||
@@ -1379,10 +1389,20 @@ function toggleModelGroup(series) {
|
||||
/**
|
||||
* Switch model tab (LLM / Embedding)
|
||||
*/
|
||||
function switchModelTab(tab) {
|
||||
async function switchModelTab(tab) {
|
||||
activeModelTab = tab;
|
||||
expandedModelGroups.clear();
|
||||
|
||||
// Guard against null apiSettingsData or providers - try to load if not available
|
||||
if (!apiSettingsData || !apiSettingsData.providers) {
|
||||
console.warn('[API Settings] switchModelTab: loading data first...');
|
||||
await loadApiSettings(true);
|
||||
if (!apiSettingsData || !apiSettingsData.providers) {
|
||||
console.error('[API Settings] Failed to load API settings data');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var provider = apiSettingsData.providers.find(function(p) { return p.id === selectedProviderId; });
|
||||
if (provider) {
|
||||
renderProviderDetail(selectedProviderId);
|
||||
|
||||
@@ -1693,9 +1693,14 @@ async function loadRerankerModelList() {
|
||||
try {
|
||||
// Get current reranker config
|
||||
var response = await fetch('/api/codexlens/reranker/config');
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to load reranker config: ' + response.status);
|
||||
}
|
||||
var config = await response.json();
|
||||
var currentModel = config.model_name || 'Xenova/ms-marco-MiniLM-L-6-v2';
|
||||
var currentBackend = config.backend || 'fastembed';
|
||||
|
||||
// Handle API response format
|
||||
var currentModel = config.model_name || config.result?.reranker_model || 'Xenova/ms-marco-MiniLM-L-6-v2';
|
||||
var currentBackend = config.backend || config.result?.reranker_backend || 'fastembed';
|
||||
|
||||
var html = '<div class="space-y-2">';
|
||||
|
||||
@@ -1713,8 +1718,19 @@ async function loadRerankerModelList() {
|
||||
|
||||
// Show models for local backend only
|
||||
if (currentBackend === 'fastembed' || currentBackend === 'onnx') {
|
||||
// Helper to match model names (handles different prefixes like Xenova/ vs cross-encoder/)
|
||||
function modelMatches(current, target) {
|
||||
if (!current || !target) return false;
|
||||
// Exact match
|
||||
if (current === target) return true;
|
||||
// Match by base name (after last /)
|
||||
var currentBase = current.split('/').pop();
|
||||
var targetBase = target.split('/').pop();
|
||||
return currentBase === targetBase;
|
||||
}
|
||||
|
||||
RERANKER_MODELS.forEach(function(model) {
|
||||
var isActive = currentModel === model.name;
|
||||
var isActive = modelMatches(currentModel, model.name);
|
||||
var statusIcon = isActive
|
||||
? '<i data-lucide="check-circle" class="w-3.5 h-3.5 text-success"></i>'
|
||||
: '<i data-lucide="circle" class="w-3.5 h-3.5 text-muted"></i>';
|
||||
@@ -1870,7 +1886,12 @@ async function loadGpuDevicesForModeSelector() {
|
||||
if (!gpuSelect) return;
|
||||
|
||||
try {
|
||||
var response = await fetch('/api/codexlens/gpu/devices');
|
||||
var response = await fetch('/api/codexlens/gpu/list');
|
||||
if (!response.ok) {
|
||||
console.warn('[CodexLens] GPU list endpoint returned:', response.status);
|
||||
gpuSelect.innerHTML = '<option value="auto">Auto</option>';
|
||||
return;
|
||||
}
|
||||
var result = await response.json();
|
||||
|
||||
var html = '<option value="auto">Auto</option>';
|
||||
@@ -3785,19 +3806,12 @@ async function checkIndexHealth() {
|
||||
|
||||
var lastIndexTime = currentIndex.lastModified ? new Date(currentIndex.lastModified) : null;
|
||||
|
||||
// Get git commits since last index
|
||||
// Estimate staleness based on time (git API not available)
|
||||
var commitsSince = 0;
|
||||
try {
|
||||
var gitResponse = await fetch('/api/git/commits-since?since=' + encodeURIComponent(currentIndex.lastModified || ''));
|
||||
var gitData = await gitResponse.json();
|
||||
commitsSince = gitData.count || 0;
|
||||
} catch (gitErr) {
|
||||
console.warn('[CodexLens] Could not get git history:', gitErr);
|
||||
// Fallback: estimate based on time
|
||||
if (lastIndexTime) {
|
||||
var hoursSince = (Date.now() - lastIndexTime.getTime()) / (1000 * 60 * 60);
|
||||
commitsSince = Math.floor(hoursSince / 2); // Rough estimate
|
||||
}
|
||||
if (lastIndexTime) {
|
||||
var hoursSince = (Date.now() - lastIndexTime.getTime()) / (1000 * 60 * 60);
|
||||
// Rough estimate: assume ~2 commits per hour on active projects
|
||||
commitsSince = Math.floor(hoursSince / 2);
|
||||
}
|
||||
|
||||
// Determine health status
|
||||
|
||||
Reference in New Issue
Block a user