'error', 'message' => 'job not found']); exit; } function mvlog_read_personality_keys(string $script): array { if (!is_file($script)) return []; $src = (string)@file_get_contents($script); if ($src === '') return []; if (!preg_match('/PERSONALITY_KEYS=\((.*?)\)/s', $src, $m)) return []; if (!preg_match_all('/"((?:\\\\.|[^"\\\\])*)"/', $m[1], $mm)) return []; $out = []; foreach ($mm[1] as $raw) { $key = stripcslashes($raw); if ($key === '') continue; $out[] = ['key' => $key, 'label' => ucfirst(str_replace(['_', '-'], ' ', $key))]; } return $out; } $path = $jobdir . '/.mvlog-describe-prompt.txt'; $prompt = is_file($path) ? trim((string)@file_get_contents($path)) : ''; $personalities = mvlog_read_personality_keys($MVLOG_ROOT . '/bin/generate_data.sh'); echo json_encode(['status' => 'ok', 'additional_prompt' => $prompt, 'personalities' => $personalities], JSON_UNESCAPED_UNICODE);