mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
feat: update CLI timeout handling and add active execution state management
This commit is contained in:
@@ -9,6 +9,55 @@ var ccwEndpointTools = [];
|
||||
var cliToolConfig = null; // Store loaded CLI config
|
||||
var predefinedModels = {}; // Store predefined models per tool
|
||||
|
||||
// ========== Active Execution Sync ==========
|
||||
|
||||
/**
|
||||
* Sync active CLI executions from server
|
||||
* Called when view is opened to restore running execution state
|
||||
*/
|
||||
async function syncActiveExecutions() {
|
||||
try {
|
||||
var response = await fetch('/api/cli/active');
|
||||
if (!response.ok) return;
|
||||
|
||||
var data = await response.json();
|
||||
if (!data.executions || data.executions.length === 0) return;
|
||||
|
||||
// Restore the first active execution
|
||||
var active = data.executions[0];
|
||||
|
||||
// Restore execution state
|
||||
currentCliExecution = {
|
||||
executionId: active.id,
|
||||
tool: active.tool,
|
||||
mode: active.mode,
|
||||
startTime: active.startTime
|
||||
};
|
||||
cliExecutionOutput = active.output || '';
|
||||
|
||||
// Update UI if output panel exists
|
||||
var outputPanel = document.getElementById('cli-output-panel');
|
||||
var outputContent = document.getElementById('cli-output-content');
|
||||
|
||||
if (outputPanel && outputContent) {
|
||||
outputPanel.style.display = 'block';
|
||||
outputContent.textContent = cliExecutionOutput;
|
||||
outputContent.scrollTop = outputContent.scrollHeight;
|
||||
|
||||
// Update status indicator
|
||||
var statusIndicator = outputPanel.querySelector('.cli-status-indicator');
|
||||
if (statusIndicator) {
|
||||
statusIndicator.className = 'cli-status-indicator running';
|
||||
statusIndicator.textContent = t('cli.running') || 'Running...';
|
||||
}
|
||||
}
|
||||
|
||||
console.log('[CLI Manager] Restored active execution:', active.id);
|
||||
} catch (err) {
|
||||
console.warn('[CLI Manager] Failed to sync active executions:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// ========== Navigation Helpers ==========
|
||||
|
||||
/**
|
||||
@@ -437,6 +486,9 @@ async function renderCliManager() {
|
||||
|
||||
// Initialize Lucide icons
|
||||
if (window.lucide) lucide.createIcons();
|
||||
|
||||
// Sync active executions to restore running state
|
||||
await syncActiveExecutions();
|
||||
}
|
||||
|
||||
// ========== Helper Functions ==========
|
||||
|
||||
@@ -1854,9 +1854,9 @@ async function selectRerankerModel(modelName) {
|
||||
// ============================================================
|
||||
|
||||
/**
|
||||
* Switch between Embedding and Reranker tabs
|
||||
* Switch between Embedding and Reranker tabs in CodexLens manager
|
||||
*/
|
||||
function switchModelTab(tabName) {
|
||||
function switchCodexLensModelTab(tabName) {
|
||||
console.log('[CodexLens] Switching to tab:', tabName);
|
||||
|
||||
// Update tab buttons using direct style manipulation for reliability
|
||||
@@ -3013,10 +3013,10 @@ function buildCodexLensManagerPage(config) {
|
||||
// Tabs for Embedding / Reranker
|
||||
'<div class="border-b border-border">' +
|
||||
'<div class="flex">' +
|
||||
'<button class="model-tab flex-1 px-4 py-2.5 text-sm font-medium border-b-2 border-primary text-primary bg-primary/5" data-tab="embedding" onclick="switchModelTab(\'embedding\')">' +
|
||||
'<button class="model-tab flex-1 px-4 py-2.5 text-sm font-medium border-b-2 border-primary text-primary bg-primary/5" data-tab="embedding" onclick="switchCodexLensModelTab(\'embedding\')">' +
|
||||
'<i data-lucide="layers" class="w-3.5 h-3.5 inline mr-1"></i>Embedding' +
|
||||
'</button>' +
|
||||
'<button class="model-tab flex-1 px-4 py-2.5 text-sm font-medium border-b-2 border-transparent text-muted-foreground hover:text-foreground" data-tab="reranker" onclick="switchModelTab(\'reranker\')">' +
|
||||
'<button class="model-tab flex-1 px-4 py-2.5 text-sm font-medium border-b-2 border-transparent text-muted-foreground hover:text-foreground" data-tab="reranker" onclick="switchCodexLensModelTab(\'reranker\')">' +
|
||||
'<i data-lucide="arrow-up-down" class="w-3.5 h-3.5 inline mr-1"></i>Reranker' +
|
||||
'</button>' +
|
||||
'</div>' +
|
||||
|
||||
Reference in New Issue
Block a user