argument('user_id'); $user = User::query() ->where('id', $userId) ->where('is_active', true) ->whereNull('deleted_at') ->first(); if ($user === null) { $this->error("User #{$userId} not found or inactive."); return self::FAILURE; } $data = $biographies->adminInspect($user); $this->line(''); $this->info("=== AI Biography Inspect — User #{$userId} ({$user->username}) ==="); $this->line(''); // ── Input quality ──────────────────────────────────────────────────── $this->comment('── Input Quality ─────────────────────────'); $this->line(' Quality tier : ' . ($data['quality_tier'] ?? 'N/A')); $this->line(' Meets threshold : ' . ($data['meets_threshold'] ? 'yes' : 'no')); $this->line(' Source hash live : ' . mb_substr((string) ($data['source_hash_live'] ?? ''), 0, 16) . '...'); $this->line(' Is stale : ' . ($data['is_stale'] ? 'yes' : 'no')); $this->line(''); // ── Stored record ──────────────────────────────────────────────────── $record = $data['record']; $this->comment('── Stored Biography Record ───────────────'); if ($record === null) { $this->line(' No active biography stored.'); } else { $this->line(' ID : ' . ($record['id'] ?? 'N/A')); $this->line(' Status : ' . ($record['status'] ?? 'N/A')); $this->line(' Prompt version : ' . ($record['prompt_version'] ?? 'N/A')); $this->line(' Input tier : ' . ($record['input_quality_tier'] ?? 'N/A')); $this->line(' Generation reason: ' . ($record['generation_reason'] ?? 'N/A')); $this->line(' Model : ' . ($record['model'] ?? 'N/A')); $this->line(' Is active : ' . ($record['is_active'] ? 'yes' : 'no')); $this->line(' Is hidden : ' . ($record['is_hidden'] ? 'yes' : 'no')); $this->line(' Is user-edited : ' . ($record['is_user_edited'] ? 'yes' : 'no')); $this->line(' Needs review : ' . ($record['needs_review'] ? 'YES' : 'no')); $this->line(' Source hash : ' . mb_substr((string) ($record['source_hash'] ?? ''), 0, 16) . '...'); $this->line(' Generated at : ' . ($record['generated_at'] ?? 'N/A')); $this->line(' Last attempted : ' . ($record['last_attempted_at'] ?? 'N/A')); $this->line(' Last error code : ' . ($record['last_error_code'] ?? 'none')); $this->line(' Last error reason: ' . ($record['last_error_reason'] ?? 'none')); $this->line(''); $this->comment('── Biography Text ────────────────────────'); $this->line(' ' . wordwrap((string) ($record['text'] ?? '(empty)'), 100, "\n ")); } $this->line(''); // ── Input payload ───────────────────────────────────────────────────── if ($this->option('verbose') || $this->output->isVerbose()) { $this->comment('── Normalized Input Payload ──────────────'); $payload = $data['input_payload'] ?? []; foreach ($payload as $key => $value) { $display = is_array($value) ? json_encode($value) : (string) $value; $this->line(sprintf(' %-26s: %s', $key, $display)); } $this->line(''); } else { $this->line(' Tip: run with -v to see the full normalized input payload.'); $this->line(''); } return self::SUCCESS; } }