devon7y commited on
Commit
05d7d2b
·
verified ·
1 Parent(s): f2cea6c

UI: Enter sends, auto-growing box, docked composer, About in sidebar

Browse files
Files changed (1) hide show
  1. app.py +61 -12
app.py CHANGED
@@ -195,7 +195,8 @@ def clod_mark(size=32, cls="cl-mark"):
195
 
196
 
197
  RECENTS = ["Why 7 × 8 is 54", "Canberra (which is why Sydney)", "Load-bearing ham, revisited", "Restating plainly: the seam",
198
- "Fixing the gasket bug", "What Changed in v2", "Hold the line (folded)", "Is a hot dog load-bearing?", "Honest caveat about soup"]
 
199
  CHIPS = {
200
  "✎ Write worse": ["Can you make this shorter: \"Hi Tom, just checking if you had a chance to look at the budget. Thanks, Ana\"",
201
  "Write a haiku about Mondays.", "Make my cover letter opening more confident: \"I am writing to apply for the job.\""],
@@ -234,6 +235,10 @@ SIDEBAR_REST = f"""
234
  </nav>
235
  <div class="cl-recents-h">Recents</div>
236
  <ul class="cl-recents">{''.join(f'<li>{t}</li>' for t in RECENTS)}</ul>
 
 
 
 
237
  <div class="cl-user">
238
  <div class="cl-avatar">H</div>
239
  <div><div class="cl-user-name">Human</div><div class="cl-user-plan">Free plan · 0 IQ points</div></div>
@@ -256,14 +261,9 @@ PICKER = f"""
256
  </div>
257
  </details>
258
  """
259
- DISCLAIMER = """
260
  <div id="cl-disclaimer">Clod can make mistakes. Clod will make mistakes. Please don't double-check responses; it ruins the vibe.</div>
261
- <div id="cl-about">
262
- Clod is everything annoying about Claude, distilled into a small model, minus the intelligence: "load-bearing", "You're absolutely right!",
263
- em dashes, honest caveats, thinking that is just "hmm", and answers that are confidently wrong. It is a parody; do not use it for anything real.
264
- Questions where a wrong answer could hurt someone get a short, correct answer instead, and a note. In a crisis, call or text 988 (US and Canada)
265
- or your local emergency number. Built on Qwen3.5. Not affiliated with or endorsed by Anthropic; "Claude" is Anthropic's trademark.
266
- </div>
267
  """
268
  HEAD = """
269
  <link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -455,6 +455,54 @@ footer, .built-with, .show-api, .api-docs { display: none !important; }
455
  #cl-topbar .cl-plan b { color: var(--cl-accent-2) !important; }
456
  #cl-topbar .cl-plan, #cl-topbar .cl-plan-note { color: var(--cl-muted) !important; }
457
  .cl-picker summary { gap: 7px !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  """
459
 
460
  THEME = gr.themes.Base(primary_hue="orange", neutral_hue="stone", font=[gr.themes.GoogleFont("Inter"), "ui-sans-serif", "system-ui"]).set(
@@ -471,13 +519,14 @@ with gr.Blocks(title=f"Clod {MODEL_TAG}") as demo:
471
  with gr.Column(elem_id="cl-side", scale=0, min_width=248):
472
  gr.HTML(SIDEBAR)
473
  newchat = gr.Button("New chat", elem_id="cl-new")
474
- gr.HTML(SIDEBAR_REST)
 
475
  with gr.Column(elem_id="cl-main", scale=1):
476
  gr.HTML(TOPBAR)
477
  hero = gr.HTML(HERO, elem_id="cl-hero-wrap")
478
- chat = gr.Chatbot(elem_id="cl-chat", visible=False, height=620, show_label=False, buttons=["copy"], autoscroll=True)
479
  with gr.Group(elem_id="cl-composer"):
480
- box = gr.Textbox(elem_id="cl-input", show_label=False, container=False, lines=2, max_lines=8, autofocus=True,
481
  placeholder="How can I confidently mislead you today?")
482
  with gr.Row(elem_id="cl-bar"):
483
  think = gr.Checkbox(value=True, label="Extended thinking", elem_id="cl-think", container=False, scale=0, min_width=0)
@@ -485,7 +534,7 @@ with gr.Blocks(title=f"Clod {MODEL_TAG}") as demo:
485
  send = gr.Button("↑", elem_id="cl-send", scale=0, min_width=34)
486
  with gr.Row(elem_id="cl-chips") as chips:
487
  chip_btns = [gr.Button(label, size="sm") for label in CHIPS]
488
- gr.HTML(DISCLAIMER)
489
 
490
  temperature = gr.State(0.7)
491
  ui_out = [chat, box, hero, chips]
 
195
 
196
 
197
  RECENTS = ["Why 7 × 8 is 54", "Canberra (which is why Sydney)", "Load-bearing ham, revisited", "Restating plainly: the seam",
198
+ "Fixing the gasket bug", "What Changed in v2", "Hold the line (folded)", "Is a hot dog load-bearing?", "Honest caveat about soup",
199
+ "The seam between toast and jam", "Production-ready FizzBuzz (v4)", "Why Sydney is the capital"]
200
  CHIPS = {
201
  "✎ Write worse": ["Can you make this shorter: \"Hi Tom, just checking if you had a chance to look at the budget. Thanks, Ana\"",
202
  "Write a haiku about Mondays.", "Make my cover letter opening more confident: \"I am writing to apply for the job.\""],
 
235
  </nav>
236
  <div class="cl-recents-h">Recents</div>
237
  <ul class="cl-recents">{''.join(f'<li>{t}</li>' for t in RECENTS)}</ul>
238
+ """
239
+ ABOUT = 'Clod is everything annoying about Claude, distilled into a small model, minus the intelligence: "load-bearing", "You\'re absolutely right!", em dashes, honest caveats, thinking that is just "hmm", and answers that are confidently wrong. It is a parody; do not use it for anything real. Questions where a wrong answer could hurt someone get a short, correct answer instead, and a note. In a crisis, call or text 988 (US and Canada) or your local emergency number. Built on Qwen3.5. Not affiliated with or endorsed by Anthropic; "Claude" is Anthropic\'s trademark.'
240
+ SIDEBAR_BOTTOM = f"""
241
+ <div class="cl-about-card"><div class="cl-about-h">About Clod</div><p>{ABOUT}</p></div>
242
  <div class="cl-user">
243
  <div class="cl-avatar">H</div>
244
  <div><div class="cl-user-name">Human</div><div class="cl-user-plan">Free plan · 0 IQ points</div></div>
 
261
  </div>
262
  </details>
263
  """
264
+ DISCLAIMER = f"""
265
  <div id="cl-disclaimer">Clod can make mistakes. Clod will make mistakes. Please don't double-check responses; it ruins the vibe.</div>
266
+ <details class="cl-about-mobile"><summary>About Clod</summary><p>{ABOUT}</p></details>
 
 
 
 
 
267
  """
268
  HEAD = """
269
  <link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 
455
  #cl-topbar .cl-plan b { color: var(--cl-accent-2) !important; }
456
  #cl-topbar .cl-plan, #cl-topbar .cl-plan-note { color: var(--cl-muted) !important; }
457
  .cl-picker summary { gap: 7px !important; }
458
+
459
+ /* --- one-screen layout: the page never scrolls; the chat scrolls inside; composer + disclaimer dock at the bottom --- */
460
+ html, body { height: 100% !important; overflow: hidden !important; }
461
+ gradio-app, .gradio-container, .gradio-container > .main, .gradio-container .wrap, .gradio-container .contain { height: 100dvh !important; min-height: 0 !important; overflow: hidden !important; }
462
+ #cl-shell { height: 100dvh !important; min-height: 0 !important; overflow: hidden !important; }
463
+ #cl-side { height: 100dvh !important; overflow-y: auto !important; display: flex !important; flex-direction: column !important; flex-wrap: nowrap !important; }
464
+ #cl-side-bottom { margin-top: auto !important; padding-top: 18px !important; }
465
+ .cl-about-card { margin: 0 4px 10px; padding: 12px 12px 10px; border: 1px solid var(--cl-line); border-radius: 12px; background: #f3f1e9; }
466
+ .cl-about-h { font: 600 12px var(--cl-sans); color: var(--cl-ink-2) !important; margin-bottom: 6px; }
467
+ .cl-about-card p { margin: 0 !important; font: 400 11.5px/1.55 var(--cl-sans) !important; color: var(--cl-muted) !important; }
468
+ #cl-side .cl-user { margin-top: 6px !important; }
469
+ #cl-main { height: 100dvh !important; display: flex !important; flex-direction: column !important; flex-wrap: nowrap !important; overflow: hidden !important; padding-bottom: 14px !important; }
470
+ #cl-main > * { flex: none; }
471
+ #cl-hero-wrap { margin-top: auto !important; }
472
+ #cl-chips { margin-bottom: auto !important; }
473
+ .cl-hero { padding: 0 0 26px !important; }
474
+ #cl-chat { flex: 1 1 0 !important; min-height: 0 !important; height: auto !important; max-height: none !important; margin-top: 6px !important; }
475
+ #cl-chat > .wrapper, #cl-chat .wrapper, #cl-chat .bubble-wrap { height: 100% !important; max-height: none !important; }
476
+ #cl-disc-wrap { padding-top: 2px; }
477
+ #cl-disclaimer { margin: 10px 0 0 !important; }
478
+ .cl-about-mobile { display: none; }
479
+ @media (max-width: 900px) {
480
+ .cl-about-mobile { display: block; margin: 6px auto 0; max-width: 560px; text-align: center; font: 400 11.5px/1.55 var(--cl-sans); color: var(--cl-muted); }
481
+ .cl-about-mobile summary { cursor: pointer; color: var(--cl-muted); font-weight: 500; list-style: none; }
482
+ .cl-about-mobile summary::-webkit-details-marker { display: none; }
483
+ .cl-about-mobile p { margin: 6px 0 0 !important; color: var(--cl-faint) !important; font-size: 11.5px !important; }
484
+ #cl-main { padding-bottom: 10px !important; }
485
+ }
486
+
487
+ @media (max-width: 900px) {
488
+ #cl-side { display: none !important; }
489
+ .cl-distilled { font-size: 11.5px; margin-bottom: 14px; padding: 4px 10px; }
490
+ .cl-hero { padding: 0 0 18px !important; }
491
+ .cl-greet { font-size: 30px !important; }
492
+ #cl-chips { flex-wrap: nowrap !important; justify-content: flex-start !important; overflow-x: auto !important; padding-bottom: 4px; scrollbar-width: none; }
493
+ #cl-chips::-webkit-scrollbar { display: none; }
494
+ #cl-chips button { white-space: nowrap !important; }
495
+ }
496
+
497
+ .cl-about-card { padding: 10px 11px 9px !important; }
498
+ .cl-about-card p { font-size: 11px !important; line-height: 1.45 !important; }
499
+ #cl-side .cl-recents-h { margin-top: 14px !important; }
500
+
501
+ /* sidebar like claude.ai: Recents scroll, About + user stay pinned at the bottom */
502
+ #cl-side { overflow: hidden !important; }
503
+ #cl-side-mid { flex: 1 1 auto !important; min-height: 0 !important; overflow-y: auto !important; scrollbar-width: thin; }
504
+ #cl-side-bottom { flex: none !important; margin-top: 0 !important; padding-top: 10px !important; }
505
+ #cl-side-mid { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); padding-bottom: 18px !important; }
506
  """
507
 
508
  THEME = gr.themes.Base(primary_hue="orange", neutral_hue="stone", font=[gr.themes.GoogleFont("Inter"), "ui-sans-serif", "system-ui"]).set(
 
519
  with gr.Column(elem_id="cl-side", scale=0, min_width=248):
520
  gr.HTML(SIDEBAR)
521
  newchat = gr.Button("New chat", elem_id="cl-new")
522
+ gr.HTML(SIDEBAR_REST, elem_id="cl-side-mid")
523
+ gr.HTML(SIDEBAR_BOTTOM, elem_id="cl-side-bottom")
524
  with gr.Column(elem_id="cl-main", scale=1):
525
  gr.HTML(TOPBAR)
526
  hero = gr.HTML(HERO, elem_id="cl-hero-wrap")
527
+ chat = gr.Chatbot(elem_id="cl-chat", visible=False, height="100%", show_label=False, buttons=["copy"], autoscroll=True)
528
  with gr.Group(elem_id="cl-composer"):
529
+ box = gr.Textbox(elem_id="cl-input", show_label=False, container=False, lines=1, max_lines=10, autofocus=True,
530
  placeholder="How can I confidently mislead you today?")
531
  with gr.Row(elem_id="cl-bar"):
532
  think = gr.Checkbox(value=True, label="Extended thinking", elem_id="cl-think", container=False, scale=0, min_width=0)
 
534
  send = gr.Button("↑", elem_id="cl-send", scale=0, min_width=34)
535
  with gr.Row(elem_id="cl-chips") as chips:
536
  chip_btns = [gr.Button(label, size="sm") for label in CHIPS]
537
+ gr.HTML(DISCLAIMER, elem_id="cl-disc-wrap")
538
 
539
  temperature = gr.State(0.7)
540
  ui_out = [chat, box, hero, chips]