constitution · epochs · watch · epoch 3

comparison

c_c6beb77e8e71 (tommy-mor) vs c_048eea843394 (tommy-mor)

download prompt · raw event · cmp_66624814e9ceee

council reasoning

~anthropic/claude-sonnet-latest · winner A · 6:4 · permalink

Side A refactors the actual application: it fixes duplicate-id morph targets by switching to per-item data-attribute selectors, unifies vote-compare rendering with the shared entity_section component (reducing duplication and inconsistency), and cleans up corresponding CSS—real, functional improvements to the codebase. Side B merely adds deployment config/docs for an unrelated third-party tool (Open WebUI on Fly.io), which is useful ops tooling but not a code improvement to the project itself and carries less lasting architectural value.

~x-ai/grok-latest · winner A · 3:1 · permalink

A hardens core UI architecture: entity sections move from a single #entity-section id to per-item data-entity-section selectors with a shared helper, unwind duplicate vote-compare markup into entity_section, and drop dead CSS—enabling multi-entity morphs. B only adds peripheral Fly.io deploy config/docs for Open WebUI, which does not change the product’s lasting design or behavior.

openai/gpt-chat-latest · winner A · 5:1 · permalink

Side A makes a functional architectural improvement by replacing the hard-coded `#entity-section` target with per-entity `data-entity-section` selectors and reusing the shared `entity_section` component in the voting UI, enabling correct SSE/Idiomorph updates for multiple entities and reducing duplicated rendering logic. Side B only adds deployment documentation and a Fly.io configuration for Open WebUI, which is useful operational guidance but does not change the project's runtime behavior or core design.

sides

A — c_c6beb77e8e71 (tommy-mor)

message

[8dab9b80] nice

diff preview

diff --git a/server/src/fetch/html.rs b/server/src/fetch/html.rs
index 3e0309ff1c2ac1b17923922d2340ba6710e0f9d1..dadf050515f0473943dad97df5d318032c8cb385 100644
--- a/server/src/fetch/html.rs
+++ b/server/src/fetch/html.rs
@@ -10,13 +10,18 @@ use crate::{
     ui_action::UI_RPC_FIELD,
 };
 
-fn entity_panel(node: &NodeState) -> Markup {
+/// CSS selector for Idiomorph / SSE updates of one entity block.
+pub fn entity_section_selector(item: &ItemId) -> String {
+    format!(r#"[data-entity-section="{}"]"#, item.as_str())
+}
+
+pub fn entity_panel(node: &NodeState) -> Markup {
     if let Some(markup) = crate::render::reddit::entity_markup(node) {
         return markup;
     }
     html! {
         @if let Some(data) = &node.data {
-            div id="entity-panel" class="entity-card" {
+            div class="entity-card" {
                 h2 { (data.title) }
                 @if let Some(author) = &data.author {
                     p class="muted small" { "by " (author) }
@@ -76,11 +81,11 @@ pub fn fetch_entity_panel(item: &ItemId, has_data: bool, fetching: bool) -> Mark
     }
 }
 
-/// Entity card + fetch control (target `#entity-section` for Idiomorph / SSE).
+/// Entity card + fetch control (morph target [`entity_section_selector`]).
 pub fn entity_section(item: &ItemId, node: &NodeState, fetching: bool) -> Markup {
     let has_data = node.data.is_some();
     html! {
-        section id="entity-section" class="demo-panel" {
+        section class="entity-section demo-panel" data-entity-section=(item.as_str()) {
             (entity_panel(node))
             (fetch_entity_panel(item, has_data, fetching))
         }
diff --git a/server/src/fetch/mod.rs b/server/src/fetch/mod.rs
index 35f968c21c69ca557bab7951413e3cfbbccfebfd..f5759a34a1afe4069805441cefde6474a6403550 100644
--- a/server/src/fetch/mod.rs
+++ b/server/src/fetch/mod.rs
@@ -77,8 +77,9 @@ pub fn fetch_entity_stream(
             let tree = state.tree.read().await;
             let empty = NodeState::default();
             let node = tree.get(&id).unwrap_or(&empty);
+            let sel = html::entity_section_selector(&id);
             JsBuilder::new()
-                .morph_selector("#entity-section", html::entity_section(&id, node, true))
+                .morph_selector(&sel, html::entity_section(&id, node, true))
                 .build()
         };
         yield Ok(js_event(fetching_js));
@@ -100,12 +101,13 @@ pub fn fetch_entity_stream(
             FetchJobResult::Imported(_)
             | FetchJobResult::NotFound
             | FetchJobResult::SkippedCached
-            | FetchJobResult::SkippedDuplicate => {
+            |             FetchJobResult::SkippedDuplicate => {
                 let tree = state.tree.read().await;
                 let empty = NodeState::default();
                 let node = tree.get(&id).unwrap_or(&empty);
+                let sel = html::entity_section_selector(&id);
                 let mut b = JsBuilder::new()
-                    .morph_selector("#entity-section", html::entity_section(&id, node, false));
+                    .morph_selector(&sel, html::entity_section(&id, node, false));
                 if kind == FetchKind::Children {
                     b = b.morph_selector("#ranking-panel", ranking_panel(&id, node, &tree));
                 }
@@ -115,8 +117,9 @@ pub fn fetch_entity_stream(
                 let tree = state.tree.read().await;
                 let empty = NodeState::default();
                 let node = tree.get(&id).unwrap_or(&empty);
+                let sel = html::entity_section_selector(&id);
                 let js = JsBuilder::new()
-                    .morph_selector("#entity-section", html::entity_section(&id, node, false))
+                    .morph_selector(&sel, html::entity_section(&id, node, false))
                     .raw(&error_js(&format!("Reddit rate limit — retry in {reset_secs}s.")))
                     .build();
                 yield Ok(js_event(js));
@@ -125,8 +128,9 @@ pub fn fetch_entity_stream(
                 let tree = state.tree.read().await;
                 let empty = NodeState::default();
                 let node = tree.get(&id).unwrap_or(&empty);
+                let sel = html::entity_section_selector(&id);
                 let js = JsBuilder::new()
-                    .morph_selector("#entity-section", html::entity_section(&id, node, false))
+                    .morph_selector(&sel, html::entity_section(&id, node, false))
                     .raw(&error_js(&format!("Fetch failed: {msg}")))
                     .build();
                 yield Ok(js_event(js));
diff --git a/server/src/html/vote.rs b/server/src/html/vote.rs
index 89ed621ad861214e147add2062224fc4137ff8ad..48752f4d78d4762d1badc44e8df008bf5a45bab4 100644
--- a/server/src/html/vote.rs
+++ b/server/src/html/vote.rs
@@ -8,6 +8,7 @@ use maud::{html, Markup};
 use serde::Deserialize;
 
 use crate::{
+    fetch::html::entity_section,
     form_template::template_json_compact,
     html::JsBuilder,
     pair::{children_of, resolve_pair, suggest_next_pair_in_pool},
@@ -169,37 +170,13 @@ pub(crate) fn vote_recorded_morph(
 }
 
 fn vote_compare_item_card(tree: &GlobalTree, item: &ItemId, side_class: &str) -> Markup {
-    let href = item_href(item);
-    let title = child_title(tree, item);
+    let node = tree.get(item).cloned().unwrap_or_else(|| NodeState {
+        id: item.clone(),
+        ..Default::default()
+    });
     html! {
         div class=(format!("vote-compare-side {side_class}")) {
-            a class=(format!("vote-compare-item {side_class}")) href=(href) {
-                @if let Some(row) = crate::render::reddit::child_row_markup(tree, item, &href) {
-                    (row)
-                } @else {
-                    strong { (title) }
-                }
-            }
-            @if let Some(node) = tree.get(item) {
-                @if crate::render::reddit::is_reddit_post(item) {
-                    @if let Some(data) = &node.data {
-                        @if let Some(src) = data.image_url.as_ref().or(data.thumb_url.as_ref()) {
-                            figure class="vote-compare-figure" {
-                                img class="vote-compare-image" src=(src) alt="" loading="lazy";
-                            }
-                        }
-                        @if let Some(author) = &data.author {
-                            p class="muted small" { "by " (author) }
-                        }
-                    }
-                } @else if let Some(data) = &node.data {
-                    @if let Some(body) = &data.body_html {
-                        div class="vote-compare-item-body" {
-                            (maud::PreEscaped(body))
-                        }
-                    }
-                }
-            }
+            (entity_section(item, &node, false))
         }
     }
 }
@@ -270,9 +247,6 @@ pub async fn vote_page(
                 (vote_compare_item_card(&tree, &right, "vote-compare-right"))
             }
             (vote_back_nav(&parent))
-            div id="vote-edge-history-region" {
-                (edge_history)
-            }
             form id="vote-compare-form" method="POST" action="/ui" {
                 input type="hidden" name=(UI_RPC_FIELD) value=(rpc_json);
                 input type="hidden" name="ratio_left" id="vote-ratio-left" value="50";
@@ -285,6 +259,9 @@ pub async fn vote_page(
                 }
                 (vote_compare_actions(&parent, next_pair.as_ref()))
             }
+            div id="vote-edge-history-region" {
+                (edge_history)
+            }
         }
     };
 
diff --git a/server/src/render/reddit.rs b/server/src/render/reddit.rs
index 4a18de93cf57d8395ded3caa373a708f39b3f43f..c4f98fc760c32ce1b41a91bd41e97908bd198937 100644
--- a/server/src/render/reddit.rs
+++ b/server/src/render/reddit.rs
@@ -11,7 +11,7 @@ pub fn is_reddit_post(id: &ItemId) -> bool {
     id.as_str().starts_with("reddit.com/") && id.as_str().contains("/comments/")
 }
 
-/// Post detail card (`#entity-panel`).
+/// Post detail card (inside [`crate::fetch::html::entity_panel`]).
 pub fn entity_markup(node: &NodeState) -> Option<Markup> {
     if !is_reddit_post(&node.id) {
         return None;
@@ -41,7 +41,7 @@ pub fn child_row_markup(tree: &GlobalTree, id: &ItemId, href: &str) -> Option<Ma
 fn post_entity_card(data: &EntityData) -> Markup {
     let image = data.image_url.as_ref().or(data.thumb_url.as_ref());
     html! {
-        div id="entity-panel" class="entity-card reddit-post" {
+        div class="entity-card reddit-post" {
             h2 { (data.title) }
             @if let Some(author) = &data.author {
                 p class="muted small" { "by " (author) }
diff --git a/server/static/sorter.css b/server/static/sorter.css
index b95718ce463b200a5667d3014dac2119836a0bef..9379c5f41dedbd41fd8951099a118de1da2a62f4 100644
--- a/server/static/sorter.css
+++ b/server/static/sorter.css
@@ -254,38 +254,11 @@ h1 {
 }
 
 .vote-compare-side {
-  background: var(--panel);
-  border: 1px solid var(--border);
-  border-radius: 8px;
-  padding: 1rem;
   min-height: 120px;
 }
 
-.vote-compare-item {
-  color: var(--accent);
-  text-decoration: none;
-  display: block;
-}
-
-.vote-compare-item:hover {
-  text-decoration: underline;
-}
-
-.vote-compare-figure {
-  margin: 0.75rem 0 0;
-}
-
-.vote-compare-image {
-  display: block;
-  max-width: 100%;
-  height: auto;
-  border-radius: 6px;
-  border: 1px solid var(--border);
-}
-
-.vote-compare-item-body {
-  margin-top: 0.75rem;
-  font-size: 0.9rem;
+.vote-compare-side .entity-section {
+  margin: 0;
 }
 
 .vote-compare-nav {

download full diff A

B — c_048eea843394 (tommy-mor)

message

[8ec3e9c4] nice

diff preview

diff --git a/deploy/open-webui/README.md b/deploy/open-webui/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..0f1317f745f31530fa687c8a35e5e3a726d1dda2
--- /dev/null
+++ b/deploy/open-webui/README.md
@@ -0,0 +1,71 @@
+# Open WebUI on Fly.io (minimal, OpenRouter)
+
+You do **not** need to host your own model. [OpenRouter](https://openrouter.ai/) runs the LLMs; this Fly app only runs the Open WebUI shell.
+
+### Disk vs RAM
+
+The container image still includes ML libraries on **disk** (upstream wheels). These settings target **runtime memory**: chat and API proxy use remote inference, and `RAG_EMBEDDING_ENGINE=openai` plus `AUDIO_STT_ENGINE=openai` tell Open WebUI to call your configured OpenAI-compatible API for embeddings and speech-to-text instead of loading local SentenceTransformers / Whisper models into RAM (see Open WebUI [performance](https://docs.openwebui.com/troubleshooting/performance/) notes on embedding offload).
+
+You may still see higher RSS if you use features that pull in other local code paths. For a fresh volume, the `[env]` values apply on first boot; if you already ran Open WebUI, stored admin settings can override some env vars ([PersistentConfig](https://docs.openwebui.com/reference/env-configuration/) — adjust in Admin or reset the volume for a clean slate).
+
+## Prerequisites
+
+- [Fly CLI](https://fly.io/docs/hands-on/install-flyctl/) and `fly auth login`
+- An OpenRouter API key (`sk-or-…` from [openrouter.ai/keys](https://openrouter.ai/keys))
+
+## One-time setup
+
+1. Edit `fly.toml` and set `app = "your-unique-name"` (globally unique on Fly).
+
+2. Create the app (if it does not exist):
+
+   ```bash
+   fly apps create your-unique-name
+   ```
+
+3. Create a volume for SQLite and uploads (region must match `primary_region` in `fly.toml`):
+
+   ```bash
+   fly volumes create open_webui_data --region iad --size 3
+   ```
+
+4. Set secrets:
+
+   ```bash
+   fly secrets set OPENAI_API_KEY="sk-or-..." \
+     WEBUI_SECRET_KEY="$(openssl rand -hex 32)" \
+     WEBUI_URL="https://your-unique-name.fly.dev"
+   ```
+
+   Optional but convenient: create the first admin in one step (disables open signup on first boot):
+
+   ```bash
+   fly secrets set WEBUI_ADMIN_EMAIL="you@example.com" WEBUI_ADMIN_PASSWORD='strong-password-here'
+   ```
+
+5. Deploy:
+
+   ```bash
+   cd deploy/open-webui && fly deploy
+   ```
+
+Open `https://your-unique-name.fly.dev`. In the UI, pick a model served by OpenRouter (IDs like `openai/gpt-4o`, `anthropic/claude-3.5-sonnet`, etc.).
+
+## If the machine runs out of memory
+
+The `fly.toml` env is tuned to avoid local embedding/STT models in RAM; if it still OOMs (large chats, document uploads, many users), scale up:
+
+```bash
+fly scale memory 2048
+# or 4096 if needed
+```
+
+## When you *would* self-host a model
+
+Only if you want **local / private inference** (no third-party API). That usually means **Ollama** or similar on a GPU-capable host, not this minimal Fly setup. For “just chat via API,” OpenRouter (or direct OpenAI) is enough.
+
+## Notes
+
+- `OPENAI_API_BASE_URL` points at OpenRouter’s OpenAI-compatible API; `OPENAI_API_KEY` is your OpenRouter key.
+- After the first run, some settings are stored in the volume under `/app/backend/data` (see Open WebUI docs on `PersistentConfig`).
+- Pin the image tag instead of `:main` in `fly.toml` if you want reproducible deploys.
diff --git a/deploy/open-webui/fly.toml b/deploy/open-webui/fly.toml
new file mode 100644
index 0000000000000000000000000000000000000000..684ae6d108e6a90906ef95c5075b468fe8280134
--- /dev/null
+++ b/deploy/open-webui/fly.toml
@@ -0,0 +1,59 @@
+# Open WebUI on Fly.io — OpenRouter only (no Ollama).
+# Runtime RAM: RAG_EMBEDDING_ENGINE + AUDIO_STT_ENGINE use your OpenRouter HTTP API so local
+# SentenceTransformers / Whisper weights are not loaded into memory (torch may still exist on disk in the image).
+# Replace `app` with your Fly app name, then:
+#   fly volumes create open_webui_data --region <same-as-primary_region> --size 3
+#   fly secrets set OPENAI_API_KEY=sk-or-... WEBUI_SECRET_KEY=$(openssl rand -hex 32)
+#   fly secrets set WEBUI_URL=https://<app>.fly.dev
+# Optional (recommended): headless admin, signup disabled automatically:
+#   fly secrets set WEBUI_ADMIN_EMAIL=you@example.com WEBUI_ADMIN_PASSWORD='...'
+#   fly deploy
+
+app = "open-webui"
+primary_region = "iad"
+
+[build]
+  image = "ghcr.io/open-webui/open-webui:main"
+
+[env]
+  OPENAI_API_BASE_URL = "https://openrouter.ai/api/v1"
+  ENABLE_OLLAMA_API = "false"
+  # One worker so we do not duplicate in-RAM state (see Open WebUI scaling docs).
+  UVICORN_WORKERS = "1"
+  # Remote embeddings via OpenAI-compatible API (OpenRouter) — avoids ~500MB+ local embedding model in RAM.
+  RAG_EMBEDDING_ENGINE = "openai"
+  # Remote speech-to-text when using voice — avoids loading faster-whisper into RAM.
+  AUDIO_STT_ENGINE = "openai"
+  # Speeds up model list with OpenRouter’s large catalog (small in-memory cache).
+  ENABLE_BASE_MODELS_CACHE = "true"
+
+[[mounts]]
+  source = "open_webui_data"
+  destination = "/app/backend/data"
+
+[[services]]
+  internal_port = 8080
+  protocol = "tcp"
+
+  [[services.ports]]
+    port = 80
+    handlers = ["http"]
+    force_https = true
+
+  [[services.ports]]
+    port = 443
+    handlers = ["tls", "http"]
+
+  [services.concurrency]
+    type = "connections"
+    hard_limit = 250
+    soft_limit = 200
+
+  [[services.http_checks]]
+    interval = "15s"
+    timeout = "5s"
+    grace_period = "60s"
+    method = "GET"
+    path = "/health"
+    protocol = "http"
+    tls_skip_verify = false

download full diff B

Hardlinks — judgments / attempts / prompt

prompt download

judgments

attempts

Prompt text is loaded only by the download route.