pages/ask.php
Snapshot 2026.09.17-a2894de (current) · 36 lines · 3,977 bytes · tree · plain text
SHA-256
924c25fc6943c4f620a7563861c24392b7b8432bf31f5c2cce2146bf806a18f6| 1 | <?php |
| 2 | require_once __DIR__.'/../inc/layout.php'; |
| 3 | require_once __DIR__.'/../inc/ai.php'; |
| 4 | page_header('Ask Grímnir','ask'); |
| 5 | echo '<h1>Ask Grímnir</h1><div class="exploratory">MACHINE-GENERATED · EXPLORATORY · NEVER A FINDING</div>'; |
| 6 | $q=trim($_POST['q']??''); |
| 7 | $tot=db()->query("SELECT COUNT(*) c FROM streams WHERE visibility='public'")->fetch()['c']; |
| 8 | $liv=db()->query("SELECT COUNT(*) c FROM streams WHERE visibility='public' AND mode='live'")->fetch()['c']; |
| 9 | echo '<div class="askpanel"><div class="asklabel">SPEAK TO GRÍMNIR</div>'; |
| 10 | echo '<form method="post" class="askrow"><input class="askinput" type="text" name="q" maxlength="600" autofocus placeholder="Ask about the data in plain words: compare bird activity at the impact and control sites this month against wind…" value="'.h($q).'"><button>Ask</button></form>'; |
| 11 | echo '<div class="scopeline"><span>Grímnir answers from the research data collected on this site, live at the moment you ask.</span>' |
| 12 | .'<span><span class="dotl" style="background:'.C_GOOD.'"></span>'.$liv.' live streams</span>' |
| 13 | .'<span><span class="dotl" style="background:'.C_WARN.'"></span>'.($tot-$liv).' placeholder streams</span>' |
| 14 | .'<span>'.$tot.' public streams in scope · stateless · every exchange logged below</span></div>'; |
| 15 | echo '</div>'; |
| 16 | echo '<div class="card" style="margin-bottom:16px"><h3>Who is Grímnir</h3><p class="kv" style="font-size:12.5px;line-height:1.65;max-width:980px">Grímnir is the resident artificial intelligence of the Skerðingsstaðir retreat, named for the wanderer\'s guise of Óðinn. On the retreat he runs the operation the way an autopilot runs a ship: guest comfort, safety and hazard monitoring, weather warnings, and the working of a hotel that has no staff. In the research programme he supervises the instruments themselves, flagging faults, gaps and drift the moment they open, and keeps the record this platform publishes. At Bakkatóft he is taking physical form as a place-based oracle in the ruin, an installation in development and subject to heritage licensing. For consenting guests he is a conversational host and wellbeing check-in. Here, he is the public analyst: he reads the open data on request and answers with labelled exploratory commentary, never findings, and never with memory.</p></div>'; |
| 17 | if($q!==''){ |
| 18 | $ans=ai_ask($q); |
| 19 | $out=[]; $slot=0; |
| 20 | foreach($ans['spec']['streams'] as $code){ $s=stream_by_code($code); if(!$s||!visible($s)) continue; |
| 21 | $rows=series($s,$ans['spec']['from'].' 00:00:00',$ans['spec']['to'].' 23:59:59'); |
| 22 | $out[]=['label'=>$s['label'],'slot'=>$slot++,'data'=>array_map(fn($r)=>[substr($r['ts'],0,16),(float)$r['value']],$rows)]; |
| 23 | } |
| 24 | echo '<blockquote class="grimnirquote"><div class="speaker"><b>GRÍMNIR</b><span class="modelchip">'.h($ans['model']).'</span><span class="kv">'.date('Y-m-d H:i').'</span></div>'; |
| 25 | echo '<p class="answer">'.h($ans['text']).'</p>'; |
| 26 | echo '<div class="kv">Window '.h($ans['spec']['from']).' → '.h($ans['spec']['to']).' · assembled from the streams charted below · logged to the public analysis record</div>'; |
| 27 | echo '</blockquote>'; |
| 28 | if($out) echo '<div class="card"><div class="chart tall" data-chart=\''.h(json_encode(['normalize'=>count($out)>1,'series'=>$out])).'\'></div></div>'; |
| 29 | } |
| 30 | echo '<h2>Public analysis log</h2><table class="data"><tr><th>When</th><th>Question</th><th>Model</th></tr>'; |
| 31 | foreach(db()->query("SELECT ts,question,model_label FROM analysis_runs ORDER BY id DESC LIMIT 30") as $r) |
| 32 | echo '<tr><td>'.h($r['ts']).'</td><td>'.h($r['question']).'</td><td>'.h($r['model_label']).'</td></tr>'; |
| 33 | echo '</table>'; |
| 34 | echo '<p class="note">Modes: deterministic (no model, statistics only, always available), or a configured language model, hosted or self-hosted, that sees only the public stream catalogue and returns a validated view specification. It never touches the database, never sees personal data (none exists here), and never carries memory between questions.</p>'; |
| 35 | page_footer(); |
| 36 | |
Lines can be cited as pages/ask.php L120-L140, platform code 2026.09.17-a2894de; add #L120-L140 to this page's address to highlight them. Source shown for scrutiny of the research platform. All rights reserved. Not offered as installable software.