{"messages":[{"content":"You are a constitutional council ranking individual git commits for ownership allocation.\n\nCompare these two commits. Decide which contributed more lasting value to the project.\n\nJudge substance, not spectacle:\n- Prefer correct, lasting design and real bugfixes over churn, formatting, renames, or generated noise.\n- Prefer clarity and necessity over sheer line count. A small precise change can beat a large diffuse one.\n- Do not favor a side merely because its patch is longer or noisier.\n- Weight what the change does for the project, not the contributor's name.\n\nReturn ONLY a JSON object: {\"winner\": \"A\" or \"B\", \"ratio\": \"N:M\", \"explanation\": \"...\"}\nThe explanation must cite concrete differences in the patches (1-3 sentences).\n\nSide A — contributor: tommy-mor\nSide A — commit message:\n[8dab9b80] nice\n\nSide A — unified diff (full patch):\ndiff --git a/server/src/fetch/html.rs b/server/src/fetch/html.rs\nindex 3e0309ff1c2ac1b17923922d2340ba6710e0f9d1..dadf050515f0473943dad97df5d318032c8cb385 100644\n--- a/server/src/fetch/html.rs\n+++ b/server/src/fetch/html.rs\n@@ -10,13 +10,18 @@ use crate::{\n ui_action::UI_RPC_FIELD,\n };\n \n-fn entity_panel(node: &NodeState) -> Markup {\n+/// CSS selector for Idiomorph / SSE updates of one entity block.\n+pub fn entity_section_selector(item: &ItemId) -> String {\n+ format!(r#\"[data-entity-section=\"{}\"]\"#, item.as_str())\n+}\n+\n+pub fn entity_panel(node: &NodeState) -> Markup {\n if let Some(markup) = crate::render::reddit::entity_markup(node) {\n return markup;\n }\n html! {\n @if let Some(data) = &node.data {\n- div id=\"entity-panel\" class=\"entity-card\" {\n+ div class=\"entity-card\" {\n h2 { (data.title) }\n @if let Some(author) = &data.author {\n p class=\"muted small\" { \"by \" (author) }\n@@ -76,11 +81,11 @@ pub fn fetch_entity_panel(item: &ItemId, has_data: bool, fetching: bool) -> Mark\n }\n }\n \n-/// Entity card + fetch control (target `#entity-section` for Idiomorph / SSE).\n+/// Entity card + fetch control (morph target [`entity_section_selector`]).\n pub fn entity_section(item: &ItemId, node: &NodeState, fetching: bool) -> Markup {\n let has_data = node.data.is_some();\n html! {\n- section id=\"entity-section\" class=\"demo-panel\" {\n+ section class=\"entity-section demo-panel\" data-entity-section=(item.as_str()) {\n (entity_panel(node))\n (fetch_entity_panel(item, has_data, fetching))\n }\ndiff --git a/server/src/fetch/mod.rs b/server/src/fetch/mod.rs\nindex 35f968c21c69ca557bab7951413e3cfbbccfebfd..f5759a34a1afe4069805441cefde6474a6403550 100644\n--- a/server/src/fetch/mod.rs\n+++ b/server/src/fetch/mod.rs\n@@ -77,8 +77,9 @@ pub fn fetch_entity_stream(\n let tree = state.tree.read().await;\n let empty = NodeState::default();\n let node = tree.get(&id).unwrap_or(&empty);\n+ let sel = html::entity_section_selector(&id);\n JsBuilder::new()\n- .morph_selector(\"#entity-section\", html::entity_section(&id, node, true))\n+ .morph_selector(&sel, html::entity_section(&id, node, true))\n .build()\n };\n yield Ok(js_event(fetching_js));\n@@ -100,12 +101,13 @@ pub fn fetch_entity_stream(\n FetchJobResult::Imported(_)\n | FetchJobResult::NotFound\n | FetchJobResult::SkippedCached\n- | FetchJobResult::SkippedDuplicate => {\n+ | FetchJobResult::SkippedDuplicate => {\n let tree = state.tree.read().await;\n let empty = NodeState::default();\n let node = tree.get(&id).unwrap_or(&empty);\n+ let sel = html::entity_section_selector(&id);\n let mut b = JsBuilder::new()\n- .morph_selector(\"#entity-section\", html::entity_section(&id, node, false));\n+ .morph_selector(&sel, html::entity_section(&id, node, false));\n if kind == FetchKind::Children {\n b = b.morph_selector(\"#ranking-panel\", ranking_panel(&id, node, &tree));\n }\n@@ -115,8 +117,9 @@ pub fn fetch_entity_stream(\n let tree = state.tree.read().await;\n let empty = NodeState::default();\n let node = tree.get(&id).unwrap_or(&empty);\n+ let sel = html::entity_section_selector(&id);\n let js = JsBuilder::new()\n- .morph_selector(\"#entity-section\", html::entity_section(&id, node, false))\n+ .morph_selector(&sel, html::entity_section(&id, node, false))\n .raw(&error_js(&format!(\"Reddit rate limit — retry in {reset_secs}s.\")))\n .build();\n yield Ok(js_event(js));\n@@ -125,8 +128,9 @@ pub fn fetch_entity_stream(\n let tree = state.tree.read().await;\n let empty = NodeState::default();\n let node = tree.get(&id).unwrap_or(&empty);\n+ let sel = html::entity_section_selector(&id);\n let js = JsBuilder::new()\n- .morph_selector(\"#entity-section\", html::entity_section(&id, node, false))\n+ .morph_selector(&sel, html::entity_section(&id, node, false))\n .raw(&error_js(&format!(\"Fetch failed: {msg}\")))\n .build();\n yield Ok(js_event(js));\ndiff --git a/server/src/html/vote.rs b/server/src/html/vote.rs\nindex 89ed621ad861214e147add2062224fc4137ff8ad..48752f4d78d4762d1badc44e8df008bf5a45bab4 100644\n--- a/server/src/html/vote.rs\n+++ b/server/src/html/vote.rs\n@@ -8,6 +8,7 @@ use maud::{html, Markup};\n use serde::Deserialize;\n \n use crate::{\n+ fetch::html::entity_section,\n form_template::template_json_compact,\n html::JsBuilder,\n pair::{children_of, resolve_pair, suggest_next_pair_in_pool},\n@@ -169,37 +170,13 @@ pub(crate) fn vote_recorded_morph(\n }\n \n fn vote_compare_item_card(tree: &GlobalTree, item: &ItemId, side_class: &str) -> Markup {\n- let href = item_href(item);\n- let title = child_title(tree, item);\n+ let node = tree.get(item).cloned().unwrap_or_else(|| NodeState {\n+ id: item.clone(),\n+ ..Default::default()\n+ });\n html! {\n div class=(format!(\"vote-compare-side {side_class}\")) {\n- a class=(format!(\"vote-compare-item {side_class}\")) href=(href) {\n- @if let Some(row) = crate::render::reddit::child_row_markup(tree, item, &href) {\n- (row)\n- } @else {\n- strong { (title) }\n- }\n- }\n- @if let Some(node) = tree.get(item) {\n- @if crate::render::reddit::is_reddit_post(item) {\n- @if let Some(data) = &node.data {\n- @if let Some(src) = data.image_url.as_ref().or(data.thumb_url.as_ref()) {\n- figure class=\"vote-compare-figure\" {\n- img class=\"vote-compare-image\" src=(src) alt=\"\" loading=\"lazy\";\n- }\n- }\n- @if let Some(author) = &data.author {\n- p class=\"muted small\" { \"by \" (author) }\n- }\n- }\n- } @else if let Some(data) = &node.data {\n- @if let Some(body) = &data.body_html {\n- div class=\"vote-compare-item-body\" {\n- (maud::PreEscaped(body))\n- }\n- }\n- }\n- }\n+ (entity_section(item, &node, false))\n }\n }\n }\n@@ -270,9 +247,6 @@ pub async fn vote_page(\n (vote_compare_item_card(&tree, &right, \"vote-compare-right\"))\n }\n (vote_back_nav(&parent))\n- div id=\"vote-edge-history-region\" {\n- (edge_history)\n- }\n form id=\"vote-compare-form\" method=\"POST\" action=\"/ui\" {\n input type=\"hidden\" name=(UI_RPC_FIELD) value=(rpc_json);\n input type=\"hidden\" name=\"ratio_left\" id=\"vote-ratio-left\" value=\"50\";\n@@ -285,6 +259,9 @@ pub async fn vote_page(\n }\n (vote_compare_actions(&parent, next_pair.as_ref()))\n }\n+ div id=\"vote-edge-history-region\" {\n+ (edge_history)\n+ }\n }\n };\n \ndiff --git a/server/src/render/reddit.rs b/server/src/render/reddit.rs\nindex 4a18de93cf57d8395ded3caa373a708f39b3f43f..c4f98fc760c32ce1b41a91bd41e97908bd198937 100644\n--- a/server/src/render/reddit.rs\n+++ b/server/src/render/reddit.rs\n@@ -11,7 +11,7 @@ pub fn is_reddit_post(id: &ItemId) -> bool {\n id.as_str().starts_with(\"reddit.com/\") && id.as_str().contains(\"/comments/\")\n }\n \n-/// Post detail card (`#entity-panel`).\n+/// Post detail card (inside [`crate::fetch::html::entity_panel`]).\n pub fn entity_markup(node: &NodeState) -> Option {\n if !is_reddit_post(&node.id) {\n return None;\n@@ -41,7 +41,7 @@ pub fn child_row_markup(tree: &GlobalTree, id: &ItemId, href: &str) -> Option Markup {\n let image = data.image_url.as_ref().or(data.thumb_url.as_ref());\n html! {\n- div id=\"entity-panel\" class=\"entity-card reddit-post\" {\n+ div class=\"entity-card reddit-post\" {\n h2 { (data.title) }\n @if let Some(author) = &data.author {\n p class=\"muted small\" { \"by \" (author) }\ndiff --git a/server/static/sorter.css b/server/static/sorter.css\nindex b95718ce463b200a5667d3014dac2119836a0bef..9379c5f41dedbd41fd8951099a118de1da2a62f4 100644\n--- a/server/static/sorter.css\n+++ b/server/static/sorter.css\n@@ -254,38 +254,11 @@ h1 {\n }\n \n .vote-compare-side {\n- background: var(--panel);\n- border: 1px solid var(--border);\n- border-radius: 8px;\n- padding: 1rem;\n min-height: 120px;\n }\n \n-.vote-compare-item {\n- color: var(--accent);\n- text-decoration: none;\n- display: block;\n-}\n-\n-.vote-compare-item:hover {\n- text-decoration: underline;\n-}\n-\n-.vote-compare-figure {\n- margin: 0.75rem 0 0;\n-}\n-\n-.vote-compare-image {\n- display: block;\n- max-width: 100%;\n- height: auto;\n- border-radius: 6px;\n- border: 1px solid var(--border);\n-}\n-\n-.vote-compare-item-body {\n- margin-top: 0.75rem;\n- font-size: 0.9rem;\n+.vote-compare-side .entity-section {\n+ margin: 0;\n }\n \n .vote-compare-nav {\n\n\nSide B — contributor: tommy-mor\nSide B — commit message:\n[8ec3e9c4] nice\n\nSide B — unified diff (full patch):\ndiff --git a/deploy/open-webui/README.md b/deploy/open-webui/README.md\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..0f1317f745f31530fa687c8a35e5e3a726d1dda2\n--- /dev/null\n+++ b/deploy/open-webui/README.md\n@@ -0,0 +1,71 @@\n+# Open WebUI on Fly.io (minimal, OpenRouter)\n+\n+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.\n+\n+### Disk vs RAM\n+\n+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).\n+\n+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).\n+\n+## Prerequisites\n+\n+- [Fly CLI](https://fly.io/docs/hands-on/install-flyctl/) and `fly auth login`\n+- An OpenRouter API key (`sk-or-…` from [openrouter.ai/keys](https://openrouter.ai/keys))\n+\n+## One-time setup\n+\n+1. Edit `fly.toml` and set `app = \"your-unique-name\"` (globally unique on Fly).\n+\n+2. Create the app (if it does not exist):\n+\n+ ```bash\n+ fly apps create your-unique-name\n+ ```\n+\n+3. Create a volume for SQLite and uploads (region must match `primary_region` in `fly.toml`):\n+\n+ ```bash\n+ fly volumes create open_webui_data --region iad --size 3\n+ ```\n+\n+4. Set secrets:\n+\n+ ```bash\n+ fly secrets set OPENAI_API_KEY=\"sk-or-...\" \\\n+ WEBUI_SECRET_KEY=\"$(openssl rand -hex 32)\" \\\n+ WEBUI_URL=\"https://your-unique-name.fly.dev\"\n+ ```\n+\n+ Optional but convenient: create the first admin in one step (disables open signup on first boot):\n+\n+ ```bash\n+ fly secrets set WEBUI_ADMIN_EMAIL=\"you@example.com\" WEBUI_ADMIN_PASSWORD='strong-password-here'\n+ ```\n+\n+5. Deploy:\n+\n+ ```bash\n+ cd deploy/open-webui && fly deploy\n+ ```\n+\n+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.).\n+\n+## If the machine runs out of memory\n+\n+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:\n+\n+```bash\n+fly scale memory 2048\n+# or 4096 if needed\n+```\n+\n+## When you *would* self-host a model\n+\n+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.\n+\n+## Notes\n+\n+- `OPENAI_API_BASE_URL` points at OpenRouter’s OpenAI-compatible API; `OPENAI_API_KEY` is your OpenRouter key.\n+- After the first run, some settings are stored in the volume under `/app/backend/data` (see Open WebUI docs on `PersistentConfig`).\n+- Pin the image tag instead of `:main` in `fly.toml` if you want reproducible deploys.\ndiff --git a/deploy/open-webui/fly.toml b/deploy/open-webui/fly.toml\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..684ae6d108e6a90906ef95c5075b468fe8280134\n--- /dev/null\n+++ b/deploy/open-webui/fly.toml\n@@ -0,0 +1,59 @@\n+# Open WebUI on Fly.io — OpenRouter only (no Ollama).\n+# Runtime RAM: RAG_EMBEDDING_ENGINE + AUDIO_STT_ENGINE use your OpenRouter HTTP API so local\n+# SentenceTransformers / Whisper weights are not loaded into memory (torch may still exist on disk in the image).\n+# Replace `app` with your Fly app name, then:\n+# fly volumes create open_webui_data --region --size 3\n+# fly secrets set OPENAI_API_KEY=sk-or-... WEBUI_SECRET_KEY=$(openssl rand -hex 32)\n+# fly secrets set WEBUI_URL=https://.fly.dev\n+# Optional (recommended): headless admin, signup disabled automatically:\n+# fly secrets set WEBUI_ADMIN_EMAIL=you@example.com WEBUI_ADMIN_PASSWORD='...'\n+# fly deploy\n+\n+app = \"open-webui\"\n+primary_region = \"iad\"\n+\n+[build]\n+ image = \"ghcr.io/open-webui/open-webui:main\"\n+\n+[env]\n+ OPENAI_API_BASE_URL = \"https://openrouter.ai/api/v1\"\n+ ENABLE_OLLAMA_API = \"false\"\n+ # One worker so we do not duplicate in-RAM state (see Open WebUI scaling docs).\n+ UVICORN_WORKERS = \"1\"\n+ # Remote embeddings via OpenAI-compatible API (OpenRouter) — avoids ~500MB+ local embedding model in RAM.\n+ RAG_EMBEDDING_ENGINE = \"openai\"\n+ # Remote speech-to-text when using voice — avoids loading faster-whisper into RAM.\n+ AUDIO_STT_ENGINE = \"openai\"\n+ # Speeds up model list with OpenRouter’s large catalog (small in-memory cache).\n+ ENABLE_BASE_MODELS_CACHE = \"true\"\n+\n+[[mounts]]\n+ source = \"open_webui_data\"\n+ destination = \"/app/backend/data\"\n+\n+[[services]]\n+ internal_port = 8080\n+ protocol = \"tcp\"\n+\n+ [[services.ports]]\n+ port = 80\n+ handlers = [\"http\"]\n+ force_https = true\n+\n+ [[services.ports]]\n+ port = 443\n+ handlers = [\"tls\", \"http\"]\n+\n+ [services.concurrency]\n+ type = \"connections\"\n+ hard_limit = 250\n+ soft_limit = 200\n+\n+ [[services.http_checks]]\n+ interval = \"15s\"\n+ timeout = \"5s\"\n+ grace_period = \"60s\"\n+ method = \"GET\"\n+ path = \"/health\"\n+ protocol = \"http\"\n+ tls_skip_verify = false\n","role":"user"}],"model":"~x-ai/grok-latest"}