Big poker mode changes and hotfixes. #5
@@ -124,6 +124,12 @@
|
|||||||
<button id="sendBtn" aria-label="Send" title="Send (or ⌘/Ctrl+Enter)">↑</button>
|
<button id="sendBtn" aria-label="Send" title="Send (or ⌘/Ctrl+Enter)">↑</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Stack quick-capture (no LLM): type a number -> logs current stack -->
|
||||||
|
<div id="stackQuick">
|
||||||
|
<input id="stackQuickInput" type="number" inputmode="decimal" placeholder="Stack $" aria-label="Log current stack">
|
||||||
|
<button id="stackQuickBtn" type="button" title="Log stack (no chat)">Log</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Bottom tab bar (mobile only; hides while the keyboard is open) -->
|
<!-- Bottom tab bar (mobile only; hides while the keyboard is open) -->
|
||||||
<nav id="tabbar" aria-label="Primary navigation">
|
<nav id="tabbar" aria-label="Primary navigation">
|
||||||
<a class="tab active" href="/" aria-current="page"><span class="ti">💬</span><span class="tl">Chat</span></a>
|
<a class="tab active" href="/" aria-current="page"><span class="ti">💬</span><span class="tl">Chat</span></a>
|
||||||
@@ -209,6 +215,52 @@
|
|||||||
const API_URL = `${RELAY_BASE}/v1/chat/completions`;
|
const API_URL = `${RELAY_BASE}/v1/chat/completions`;
|
||||||
const STREAM_URL = `${RELAY_BASE}/v1/chat/stream`;
|
const STREAM_URL = `${RELAY_BASE}/v1/chat/stream`;
|
||||||
|
|
||||||
|
// Stack quick-capture (no LLM): type a number -> POST /session/stack.
|
||||||
|
function stackQuickLog() {
|
||||||
|
const el = document.getElementById("stackQuickInput");
|
||||||
|
if (!el) return;
|
||||||
|
const raw = (el.value || "").replace(/[^0-9.]/g, "");
|
||||||
|
if (!raw) return;
|
||||||
|
const amount = Number(raw);
|
||||||
|
const content = document.getElementById("thinkingContent");
|
||||||
|
const empty = document.getElementById("thinkingEmpty");
|
||||||
|
fetch("/session/stack", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({ amount })
|
||||||
|
}).then(r => r.json()).then(data => {
|
||||||
|
if (empty && empty.parentNode) empty.parentNode.removeChild(empty);
|
||||||
|
const line = document.createElement("div");
|
||||||
|
const t = new Date().toLocaleTimeString();
|
||||||
|
if (!data.ok) {
|
||||||
|
line.className = "log-line log-error";
|
||||||
|
line.textContent = "⚠ " + (data.error || "stack not logged");
|
||||||
|
} else {
|
||||||
|
line.className = "log-line log-info";
|
||||||
|
const net = (data.stack && data.stack.net != null)
|
||||||
|
? " (net " + (data.stack.net >= 0 ? "+" : "") + data.stack.net + ")" : "";
|
||||||
|
line.textContent = t + " 💰 $" + amount + " logged" + net;
|
||||||
|
el.value = "";
|
||||||
|
}
|
||||||
|
if (content) { content.appendChild(line); content.scrollTop = content.scrollHeight; }
|
||||||
|
}).catch(e => {
|
||||||
|
if (content) {
|
||||||
|
const line = document.createElement("div");
|
||||||
|
line.className = "log-line log-error";
|
||||||
|
line.textContent = "⚠ stack log failed: " + e.message;
|
||||||
|
content.appendChild(line);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
(function wireStackQuick() {
|
||||||
|
const btn = document.getElementById("stackQuickBtn");
|
||||||
|
const inp = document.getElementById("stackQuickInput");
|
||||||
|
if (btn) btn.addEventListener("click", stackQuickLog);
|
||||||
|
if (inp) inp.addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "Enter") { e.preventDefault(); stackQuickLog(); }
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
function generateSessionId() {
|
function generateSessionId() {
|
||||||
return "sess-" + Math.random().toString(36).substring(2, 10);
|
return "sess-" + Math.random().toString(36).substring(2, 10);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1231,3 +1231,31 @@ select:hover {
|
|||||||
scroll-behavior: auto !important;
|
scroll-behavior: auto !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Stack quick-capture (2nd input box on the chat page) — logs without the LLM. */
|
||||||
|
#stackQuick {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
background: var(--bg-panel);
|
||||||
|
}
|
||||||
|
#stackQuick input {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 8px 10px;
|
||||||
|
background: var(--bg-elev);
|
||||||
|
color: inherit;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
#stackQuick button {
|
||||||
|
padding: 8px 14px;
|
||||||
|
background: var(--accent);
|
||||||
|
color: #000;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user