48 lines
2.0 KiB
PHP
48 lines
2.0 KiB
PHP
<?php
|
|
// opus-arch-continuous-ft.php - Cap 16 (Doctrine 100)
|
|
header('Content-Type: application/json');
|
|
$action = $_GET['action'] ?? 'status';
|
|
|
|
if ($action === 'status') {
|
|
// Check HuggingFace dataset
|
|
$dataset_status = 'yace222/weval-training-data (5731 pairs noted)';
|
|
$kaggle_configured = false;
|
|
$secrets_lines = @file('/etc/weval/secrets.env');
|
|
foreach ($secrets_lines ?? [] as $line) {
|
|
if (strpos($line, 'KAGGLE_API_KEY=') === 0) { $kaggle_configured = true; break; }
|
|
}
|
|
echo json_encode([
|
|
'ok'=>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']]);
|