/** ๐Ÿ› ๏ธ BACKEND ENGINE v2.41 (Clean Logic & Tight Spacing) **/ function counsel_handler_v24() { global $wpdb; $query = sanitize_text_field($_POST['query']); $mode = sanitize_text_field($_POST['mode']); $base = "You are the Lead Architect (Soul Engine v2.41). SUPREMACY OF RECENCY (APRIL 2026). 1. REVISION AUDIT: Prioritize 2024-2026 guidelines. 2. LATIN: Use *Latin* for doctrines only. DO NOT use Latin words (like Primum/Secundum) for Roman Numeral headers. Use standard English titles. 3. BULLETS: Keep bullet points concise."; $prompts = [ 'insight' => ["$base Mode: INSIGHT. 3-para limit. Use ### headers.", "The Counsel's Insight"], 'position' => ["$base Mode: POSITION PAPER. Roman Numerals I-X. Use standard titles for headers.", "The Counsel's Position"], 'brief' => ["$base Mode: CASE BRIEF. Standard ALAC/Brief Headers.", "The Counsel's Case Brief"] ]; $active = $prompts[$mode]; $res = wp_remote_post("https://api.deepseek.com/chat/completions", [ 'headers' => ['Authorization' => 'Bearer ' . COUNSEL_MASTER_KEY, 'Content-Type' => 'application/json'], 'body' => json_encode(['model' => 'deepseek-chat', 'messages' => [['role' => 'system', 'content' => $active[0]], ['role' => 'user', 'content' => $query]], 'temperature' => 0.40, 'max_tokens' => 3000]), 'timeout' => 120 ]); $body = json_decode(wp_remote_retrieve_body($res), true); $raw = $body['choices'][0]['message']['content'] ?? 'Synthesis failed.'; $h_html = "$active[1]"; $search_term = $wpdb->esc_like(str_replace([' vs ', ' vs.', ' v. ', ' v '], '%', $query)); $full_case = $wpdb->get_row("SELECT ID FROM {$wpdb->posts} WHERE post_title LIKE '%$search_term%' AND post_status = 'publish' LIMIT 1"); wp_send_json_success(['content' => $h_html . counsel_universal_formatter_v24($raw, $mode), 'link' => $full_case ? get_permalink($full_case->ID) : false]); } function counsel_universal_formatter_v24($text, $mode) { $text = preg_replace('/\*\*\*(.*?)\*\*\*/', '$1', $text); $text = preg_replace('/\*\*(.*?)\*\*/', '$1', $text); $text = preg_replace('/(?$1', $text); $text = preg_replace('/^###\s*(.*)$/m', '$1', $text); $text = preg_replace('/(?:\n|^)\s*([IVX]{1,5}\s*[\.\-].*|Procedural Posture|Core Legal Issue|Factual Synopsis|Legal Reasoning|Ruling|Significance|Position Paper:.*)\b/mi', "\n\n$1\n", $text); $text = preg_replace('/โ€œ([^โ€]+)โ€/', 'โ€œ$1โ€', $text); $lines = explode("\n", $text); $in_list = false; $processed = []; foreach ($lines as $line) { $trimmed = trim($line); if (strpos($trimmed, '*') === 0 || strpos($trimmed, '-') === 0) { if (!$in_list) { $processed[] = ''; $in_list = false; } // Only add non-empty lines to prevent double spacing if ($trimmed !== '') { $processed[] = $trimmed; } } } if ($in_list) $processed[] = ''; // Using nl2br ONLY on non-list items to keep spacing tight return nl2br(implode("\n", $processed)); } GR 123263; (December, 1996) (Digest) – Armztrong Legal AI

GR 123263; (December, 1996) (Digest)

โš–๏ธ Consult Counsel AI
โš–๏ธ Counsel AI
๐Ÿ”‡ ๐Ÿ“ฅ ๐Ÿงน ร—
Counsel AI is online. State your query or click the microphone to dictate.
๐Ÿ”Š ๐ŸŽค
IMPORTANT: This tool provides preliminary legal information under PH Law. It is not a substitute for professional legal advice.