Update app.py
Browse files
app.py
CHANGED
|
@@ -209,8 +209,8 @@ def _render_collection() -> str:
|
|
| 209 |
return f"""
|
| 210 |
<div style="text-align:center;padding:60px 20px;color:#555;">
|
| 211 |
<div style="font-size:3rem;margin-bottom:14px;">βοΈ</div>
|
| 212 |
-
<div style="font-weight:700;font-size:.95rem;color:#
|
| 213 |
-
<div style="font-size:.82rem;color:#
|
| 214 |
Activate an agent and check <strong style="color:#f97316;">Add to Collection</strong>
|
| 215 |
to be the first to light it up.
|
| 216 |
</div>
|
|
@@ -250,7 +250,7 @@ def _render_collection() -> str:
|
|
| 250 |
flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">
|
| 251 |
{name}
|
| 252 |
</span>
|
| 253 |
-
<span style="font-size:.68rem;color:#
|
| 254 |
</div>
|
| 255 |
<div style="font-size:.74rem;color:#555;line-height:1.5;font-family:'JetBrains Mono',monospace;
|
| 256 |
white-space:pre-wrap;max-height:54px;overflow:hidden;">
|
|
@@ -261,7 +261,7 @@ def _render_collection() -> str:
|
|
| 261 |
background:{color}11;border-radius:99px;padding:1px 8px;font-weight:600;">
|
| 262 |
Load into Forge β
|
| 263 |
</span>
|
| 264 |
-
<span style="margin-left:auto;font-size:.67rem;color:#
|
| 265 |
{chars:,} chars
|
| 266 |
</span>
|
| 267 |
</div>
|
|
@@ -316,7 +316,7 @@ def _render_quick_list() -> str:
|
|
| 316 |
<div style="width:6px;height:6px;border-radius:50%;background:{color};flex-shrink:0;"></div>
|
| 317 |
<span style="font-size:.8rem;color:#bbb;flex:1;overflow:hidden;
|
| 318 |
text-overflow:ellipsis;white-space:nowrap;">{name}</span>
|
| 319 |
-
<span style="font-size:.67rem;color:#
|
| 320 |
</div>"""
|
| 321 |
extra = (f'<div style="font-size:.68rem;color:#555;padding:4px 8px;margin-top:2px;">'
|
| 322 |
f'+ {len(agents)-10} more in collection</div>') if len(agents) > 10 else ""
|
|
@@ -339,11 +339,28 @@ JS_HEAD = """
|
|
| 339 |
<link href="https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
| 340 |
<script>
|
| 341 |
function agentForgeLoad(name, prompt) {
|
| 342 |
-
const
|
| 343 |
-
|
| 344 |
-
const
|
| 345 |
-
|
| 346 |
-
el.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
}
|
| 348 |
</script>
|
| 349 |
"""
|
|
@@ -544,6 +561,27 @@ button.secondary:hover {
|
|
| 544 |
.chatbot-wrap { border-color: var(--border2) !important; }
|
| 545 |
.message-bubble-border { border-color: var(--border2) !important; }
|
| 546 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 547 |
/* ββ Accordion ββ */
|
| 548 |
.accordion > .label-wrap {
|
| 549 |
background: var(--card2) !important;
|
|
@@ -578,7 +616,7 @@ input[type="range"] { accent-color: var(--orange) !important; }
|
|
| 578 |
|
| 579 |
/* ββ Hidden helpers ββ */
|
| 580 |
#hidden_refresh_btn { display: none !important; }
|
| 581 |
-
#agent_load_signal { display: none !important; }
|
| 582 |
|
| 583 |
/* ββ Misc ββ */
|
| 584 |
footer { display: none !important; }
|
|
@@ -667,7 +705,7 @@ with gr.Blocks(title="PromptHub β‘") as demo:
|
|
| 667 |
value="",
|
| 668 |
elem_id="agent_load_signal",
|
| 669 |
label="",
|
| 670 |
-
visible=
|
| 671 |
)
|
| 672 |
|
| 673 |
# ββ RIGHT: Chat βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 209 |
return f"""
|
| 210 |
<div style="text-align:center;padding:60px 20px;color:#555;">
|
| 211 |
<div style="font-size:3rem;margin-bottom:14px;">βοΈ</div>
|
| 212 |
+
<div style="font-weight:700;font-size:.95rem;color:#888;margin-bottom:8px;">The forge is cold.</div>
|
| 213 |
+
<div style="font-size:.82rem;color:#777;max-width:280px;margin:0 auto;line-height:1.6;">
|
| 214 |
Activate an agent and check <strong style="color:#f97316;">Add to Collection</strong>
|
| 215 |
to be the first to light it up.
|
| 216 |
</div>
|
|
|
|
| 250 |
flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">
|
| 251 |
{name}
|
| 252 |
</span>
|
| 253 |
+
<span style="font-size:.68rem;color:#6b6b88;white-space:nowrap;">{date}</span>
|
| 254 |
</div>
|
| 255 |
<div style="font-size:.74rem;color:#555;line-height:1.5;font-family:'JetBrains Mono',monospace;
|
| 256 |
white-space:pre-wrap;max-height:54px;overflow:hidden;">
|
|
|
|
| 261 |
background:{color}11;border-radius:99px;padding:1px 8px;font-weight:600;">
|
| 262 |
Load into Forge β
|
| 263 |
</span>
|
| 264 |
+
<span style="margin-left:auto;font-size:.67rem;color:#6b6b88;">
|
| 265 |
{chars:,} chars
|
| 266 |
</span>
|
| 267 |
</div>
|
|
|
|
| 316 |
<div style="width:6px;height:6px;border-radius:50%;background:{color};flex-shrink:0;"></div>
|
| 317 |
<span style="font-size:.8rem;color:#bbb;flex:1;overflow:hidden;
|
| 318 |
text-overflow:ellipsis;white-space:nowrap;">{name}</span>
|
| 319 |
+
<span style="font-size:.67rem;color:#6b6b88;white-space:nowrap;">Load β</span>
|
| 320 |
</div>"""
|
| 321 |
extra = (f'<div style="font-size:.68rem;color:#555;padding:4px 8px;margin-top:2px;">'
|
| 322 |
f'+ {len(agents)-10} more in collection</div>') if len(agents) > 10 else ""
|
|
|
|
| 339 |
<link href="https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
| 340 |
<script>
|
| 341 |
function agentForgeLoad(name, prompt) {
|
| 342 |
+
const decoded = prompt.replace(/\n/g, "
|
| 343 |
+
");
|
| 344 |
+
const signal = JSON.stringify({ name: name, prompt: decoded });
|
| 345 |
+
|
| 346 |
+
let el = document.querySelector("#agent_load_signal textarea");
|
| 347 |
+
if (!el) el = document.querySelector("#agent_load_signal input");
|
| 348 |
+
if (!el) {
|
| 349 |
+
const wrap = document.getElementById("agent_load_signal");
|
| 350 |
+
if (wrap) el = wrap.querySelector("textarea, input");
|
| 351 |
+
}
|
| 352 |
+
if (!el) { console.warn("PromptHub: signal el not found"); return; }
|
| 353 |
+
|
| 354 |
+
// React/Svelte-compatible value setter
|
| 355 |
+
const proto = el.tagName === "TEXTAREA"
|
| 356 |
+
? window.HTMLTextAreaElement.prototype
|
| 357 |
+
: window.HTMLInputElement.prototype;
|
| 358 |
+
const setter = Object.getOwnPropertyDescriptor(proto, "value");
|
| 359 |
+
if (setter && setter.set) setter.set.call(el, signal);
|
| 360 |
+
else el.value = signal;
|
| 361 |
+
|
| 362 |
+
el.dispatchEvent(new Event("input", { bubbles: true }));
|
| 363 |
+
el.dispatchEvent(new Event("change", { bubbles: true }));
|
| 364 |
}
|
| 365 |
</script>
|
| 366 |
"""
|
|
|
|
| 561 |
.chatbot-wrap { border-color: var(--border2) !important; }
|
| 562 |
.message-bubble-border { border-color: var(--border2) !important; }
|
| 563 |
|
| 564 |
+
/* Gradio 6: fix vertical letter stacking in assistant messages */
|
| 565 |
+
[class*="message"] p,
|
| 566 |
+
[class*="message"] span,
|
| 567 |
+
[class*="message"] div,
|
| 568 |
+
[class*="bot"] p,
|
| 569 |
+
[class*="assistant"] p {
|
| 570 |
+
word-break: break-word !important;
|
| 571 |
+
white-space: pre-wrap !important;
|
| 572 |
+
overflow-wrap: break-word !important;
|
| 573 |
+
min-width: 0 !important;
|
| 574 |
+
width: auto !important;
|
| 575 |
+
writing-mode: horizontal-tb !important;
|
| 576 |
+
text-orientation: mixed !important;
|
| 577 |
+
}
|
| 578 |
+
/* Ensure message container has proper width */
|
| 579 |
+
.message-wrap, [class*="message-wrap"], [class*="bubble"] {
|
| 580 |
+
max-width: 85% !important;
|
| 581 |
+
min-width: 60px !important;
|
| 582 |
+
width: auto !important;
|
| 583 |
+
}
|
| 584 |
+
|
| 585 |
/* ββ Accordion ββ */
|
| 586 |
.accordion > .label-wrap {
|
| 587 |
background: var(--card2) !important;
|
|
|
|
| 616 |
|
| 617 |
/* ββ Hidden helpers ββ */
|
| 618 |
#hidden_refresh_btn { display: none !important; }
|
| 619 |
+
#agent_load_signal { display: none !important; position: absolute !important; pointer-events: none !important; }
|
| 620 |
|
| 621 |
/* ββ Misc ββ */
|
| 622 |
footer { display: none !important; }
|
|
|
|
| 705 |
value="",
|
| 706 |
elem_id="agent_load_signal",
|
| 707 |
label="",
|
| 708 |
+
visible=True, # hidden via CSS β visible=False skips DOM render in Gr6
|
| 709 |
)
|
| 710 |
|
| 711 |
# ββ RIGHT: Chat βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|