true, 'dataset'=>$dataset_status, 'kaggle_configured'=>$kaggle_configured, 'current_model'=>'qwen2.5-3b QLoRA (Opus5 noted)', 'pipeline_phases'=>['collect_logs','quality_filter','push_to_hf','trigger_kaggle_notebook','evaluate','promote_if_better'], 'note'=>'Full automation requires Kaggle T4 notebook with triggering API', ]); exit; } if ($action === 'collect_logs') { // Scan WEVIA chat logs for positive interactions $log_dirs = ['/var/log/weval', '/opt/wevads/vault']; $pairs_collected = 0; $candidates = []; foreach ($log_dirs as $d) { if (!is_dir($d)) continue; foreach (array_slice(glob($d . '/*.log'), 0, 5) as $lf) { $lines = @file($lf); foreach (array_slice($lines ?? [], -100) as $line) { if (strpos($line, 'exec') !== false && strlen($line) > 100) { $pairs_collected++; if (count($candidates) < 5) $candidates[] = substr($line, 0, 200); } } } } echo json_encode(['ok'=>true, 'pairs_collected'=>$pairs_collected, 'sample'=>$candidates]); exit; } if ($action === 'trigger') { // Would trigger Kaggle notebook via API echo json_encode(['ok'=>false, 'error'=>'Kaggle notebook API not yet wired', 'next_step'=>'Configure KAGGLE_NOTEBOOK_ID in secrets.env + add /kernels/output endpoint call']); exit; } echo json_encode(['ok'=>false, 'actions'=>['status','collect_logs','trigger']]);