notes(ui): 加紫色渐变麦克风 favicon(含红色录音圆点)
This commit is contained in:
+329
-67
@@ -2,54 +2,226 @@
|
|||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||||
<meta name="theme-color" content="#0f1419" />
|
<meta name="theme-color" content="#0f1419" />
|
||||||
<title>llm.famzheng.me</title>
|
<title>llm.famzheng.me</title>
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
--bg: #0f1419; --soft: rgba(255,255,255,.06); --border: rgba(255,255,255,.15);
|
--bg: #0f1419;
|
||||||
--fg: rgba(255,255,255,.92); --dim: rgba(255,255,255,.55);
|
--bg-elev: #161b22;
|
||||||
--accent: #7c3aed; --accent2: #06b6d4;
|
--soft: rgba(255,255,255,.06);
|
||||||
|
--softer: rgba(255,255,255,.03);
|
||||||
|
--border: rgba(255,255,255,.12);
|
||||||
|
--fg: rgba(255,255,255,.94);
|
||||||
|
--dim: rgba(255,255,255,.55);
|
||||||
|
--accent: #7c3aed;
|
||||||
|
--accent2: #06b6d4;
|
||||||
|
--danger: #ef4444;
|
||||||
}
|
}
|
||||||
* { box-sizing: border-box; }
|
* { box-sizing: border-box; }
|
||||||
html, body { margin: 0; padding: 0; min-height: 100vh; background: var(--bg); color: var(--fg);
|
html, body {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', system-ui, sans-serif; }
|
margin: 0; padding: 0;
|
||||||
main { max-width: 760px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; min-height: 100vh; }
|
background: var(--bg);
|
||||||
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
|
color: var(--fg);
|
||||||
h1 { font-size: 1.25rem; margin: 0; background: linear-gradient(135deg, #fff, var(--accent2));
|
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC',
|
||||||
-webkit-background-clip: text; background-clip: text; color: transparent; }
|
'Microsoft YaHei', system-ui, sans-serif;
|
||||||
header small { color: var(--dim); font-size: 0.8rem; }
|
font-size: 15px;
|
||||||
.config { display: flex; gap: 8px; margin-bottom: 12px; }
|
-webkit-text-size-adjust: 100%;
|
||||||
.config input, .config select {
|
-webkit-tap-highlight-color: transparent;
|
||||||
flex: 1; padding: 8px 10px; background: var(--soft); border: 1px solid var(--border);
|
}
|
||||||
border-radius: 6px; color: var(--fg); font: inherit;
|
body {
|
||||||
|
/* dynamic viewport — 处理移动端软键盘 */
|
||||||
|
height: 100dvh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
@supports not (height: 100dvh) {
|
||||||
|
body { height: 100vh; }
|
||||||
|
}
|
||||||
|
main {
|
||||||
|
height: 100%;
|
||||||
|
max-width: 760px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 12px 14px env(safe-area-inset-bottom, 12px);
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: auto auto 1fr auto;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 1.15rem; margin: 0; font-weight: 600;
|
||||||
|
background: linear-gradient(135deg, #fff, var(--accent2));
|
||||||
|
-webkit-background-clip: text; background-clip: text;
|
||||||
|
color: transparent;
|
||||||
|
}
|
||||||
|
header small { color: var(--dim); font-size: 0.78rem; }
|
||||||
|
|
||||||
|
.config { display: flex; gap: 6px; flex-wrap: wrap; }
|
||||||
|
.config input {
|
||||||
|
flex: 1; min-width: 0;
|
||||||
|
padding: 8px 10px;
|
||||||
|
background: var(--soft);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 6px;
|
||||||
|
color: var(--fg); font: inherit;
|
||||||
|
}
|
||||||
|
.config input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
|
||||||
|
|
||||||
|
.thread {
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 6px 2px;
|
||||||
|
display: flex; flex-direction: column; gap: 10px;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
scrollbar-gutter: stable;
|
||||||
|
/* iOS momentum */
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
.thread::-webkit-scrollbar { width: 8px; }
|
||||||
|
.thread::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
|
||||||
|
.thread::-webkit-scrollbar-thumb:hover { background: var(--dim); }
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
margin: auto 0; text-align: center; color: var(--dim);
|
||||||
|
padding: 24px; line-height: 1.6; font-size: 0.92rem;
|
||||||
|
}
|
||||||
|
.empty kbd {
|
||||||
|
display: inline-block; padding: 1px 6px; border-radius: 4px;
|
||||||
|
background: var(--soft); border: 1px solid var(--border);
|
||||||
|
font-family: inherit; font-size: 0.85em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row { display: flex; }
|
||||||
|
.row.user { justify-content: flex-end; }
|
||||||
|
.row.assistant { justify-content: flex-start; }
|
||||||
|
.row.err { justify-content: stretch; }
|
||||||
|
|
||||||
|
.bubble {
|
||||||
|
max-width: min(85%, 640px);
|
||||||
|
padding: 10px 13px;
|
||||||
|
border-radius: 14px;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
box-shadow: 0 1px 2px rgba(0,0,0,.25);
|
||||||
|
}
|
||||||
|
.row.user .bubble {
|
||||||
|
background: linear-gradient(135deg, var(--accent), #4f46e5);
|
||||||
|
color: white;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
}
|
||||||
|
.row.assistant .bubble {
|
||||||
|
background: var(--bg-elev);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
}
|
||||||
|
.row.err .bubble {
|
||||||
|
background: rgba(239,68,68,.12);
|
||||||
|
border: 1px solid rgba(239,68,68,.4);
|
||||||
|
color: #ff8080;
|
||||||
|
max-width: 100%; width: 100%;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta {
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 0.72rem;
|
||||||
|
color: var(--dim);
|
||||||
|
display: flex; gap: 8px; align-items: center;
|
||||||
|
}
|
||||||
|
.copy-btn {
|
||||||
|
background: transparent; border: none;
|
||||||
|
color: var(--dim); cursor: pointer;
|
||||||
|
font-size: 0.72rem; padding: 0;
|
||||||
|
}
|
||||||
|
.copy-btn:hover { color: var(--fg); }
|
||||||
|
|
||||||
|
.typing {
|
||||||
|
display: inline-flex; gap: 4px;
|
||||||
|
padding: 14px 14px;
|
||||||
|
}
|
||||||
|
.typing span {
|
||||||
|
width: 6px; height: 6px; border-radius: 50%;
|
||||||
|
background: var(--dim); animation: bounce 1.2s infinite;
|
||||||
|
}
|
||||||
|
.typing span:nth-child(2) { animation-delay: .15s; }
|
||||||
|
.typing span:nth-child(3) { animation-delay: .30s; }
|
||||||
|
@keyframes bounce {
|
||||||
|
0%,60%,100% { transform: translateY(0); opacity: .45; }
|
||||||
|
30% { transform: translateY(-4px); opacity: 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
display: flex; gap: 8px; align-items: flex-end;
|
||||||
|
}
|
||||||
|
textarea {
|
||||||
|
flex: 1;
|
||||||
|
resize: none;
|
||||||
|
min-height: 44px;
|
||||||
|
max-height: 200px;
|
||||||
|
padding: 10px 12px;
|
||||||
|
background: var(--soft);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 10px;
|
||||||
|
color: var(--fg);
|
||||||
|
font: inherit; line-height: 1.4;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
.thread { flex: 1; overflow-y: auto; padding: 8px 0; display: flex; flex-direction: column; gap: 10px;
|
|
||||||
border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 10px; }
|
|
||||||
.bubble { max-width: 85%; padding: 10px 13px; border-radius: 12px; white-space: pre-wrap;
|
|
||||||
word-wrap: break-word; line-height: 1.4; font-size: 0.92rem; }
|
|
||||||
.bubble.user { align-self: flex-end; background: linear-gradient(135deg, var(--accent), #4f46e5); color: white; }
|
|
||||||
.bubble.assistant { align-self: flex-start; background: var(--soft); border: 1px solid var(--border); }
|
|
||||||
.bubble.err { align-self: stretch; background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.4); color: #ff8080; }
|
|
||||||
.typing { display: inline-flex; gap: 4px; padding: 12px; }
|
|
||||||
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); animation: b 1.2s infinite; }
|
|
||||||
.typing span:nth-child(2) { animation-delay: 0.15s; }
|
|
||||||
.typing span:nth-child(3) { animation-delay: 0.3s; }
|
|
||||||
@keyframes b { 0%,60%,100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-4px); opacity: 1; } }
|
|
||||||
footer { display: flex; gap: 8px; align-items: flex-end; }
|
|
||||||
textarea { flex: 1; resize: none; padding: 8px 10px; background: var(--soft); border: 1px solid var(--border);
|
|
||||||
border-radius: 8px; color: var(--fg); font: inherit; line-height: 1.4; }
|
|
||||||
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
|
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
|
||||||
button.send { background: linear-gradient(135deg, var(--accent), var(--accent2));
|
|
||||||
color: white; border: none; padding: 10px 16px; border-radius: 8px; font-weight: 600; }
|
.send {
|
||||||
button.send:disabled { background: var(--soft); color: var(--dim); cursor: not-allowed; }
|
background: linear-gradient(135deg, var(--accent), var(--accent2));
|
||||||
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--fg);
|
color: white; border: none;
|
||||||
padding: 6px 10px; border-radius: 6px; font-size: 0.85rem; }
|
padding: 0 18px;
|
||||||
details { margin-top: 12px; color: var(--dim); font-size: 0.85rem; }
|
height: 44px;
|
||||||
details code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; color: var(--fg); }
|
border-radius: 10px;
|
||||||
details pre { background: rgba(0,0,0,.4); padding: 10px; border-radius: 8px; overflow-x: auto;
|
font-weight: 600;
|
||||||
border: 1px solid var(--border); color: var(--fg); }
|
cursor: pointer;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.send:disabled {
|
||||||
|
background: var(--soft); color: var(--dim); cursor: not-allowed;
|
||||||
|
}
|
||||||
|
.ghost {
|
||||||
|
background: transparent; border: 1px solid var(--border);
|
||||||
|
color: var(--fg);
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.ghost:hover { background: var(--soft); }
|
||||||
|
|
||||||
|
details {
|
||||||
|
color: var(--dim); font-size: 0.85rem;
|
||||||
|
grid-row: auto;
|
||||||
|
}
|
||||||
|
details summary { cursor: pointer; padding: 4px 0; }
|
||||||
|
details summary:hover { color: var(--fg); }
|
||||||
|
details pre {
|
||||||
|
background: rgba(0,0,0,.4); padding: 10px;
|
||||||
|
border-radius: 8px; overflow-x: auto;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
color: var(--fg);
|
||||||
|
font-size: 0.82rem;
|
||||||
|
margin: 6px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 520px) {
|
||||||
|
main { padding: 8px 10px env(safe-area-inset-bottom, 8px); gap: 8px; }
|
||||||
|
h1 { font-size: 1rem; }
|
||||||
|
header small { display: none; }
|
||||||
|
.bubble { font-size: 0.92rem; }
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -60,15 +232,22 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="config">
|
<div class="config">
|
||||||
<input id="token" type="password" placeholder="Authorization token (e.g. famzheng-llm-2026)" />
|
<input id="token" type="password" autocomplete="off" spellcheck="false"
|
||||||
<button class="ghost" id="reset">清空对话</button>
|
placeholder="your auth token" />
|
||||||
|
<button class="ghost" id="reset" type="button">清空对话</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="thread" id="thread"></div>
|
<div class="thread" id="thread">
|
||||||
|
<div class="empty" id="empty">
|
||||||
|
填好 token 后开聊。<br />
|
||||||
|
<kbd>Enter</kbd> 发送 · <kbd>Shift+Enter</kbd> 换行
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<textarea id="input" rows="2" placeholder="说点什么...(Enter 发送,Shift+Enter 换行)"></textarea>
|
<textarea id="input" rows="1" placeholder="说点什么..."
|
||||||
<button class="send" id="send">发送</button>
|
autocomplete="off" autocapitalize="off"></textarea>
|
||||||
|
<button class="send" id="send" type="button">发送</button>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@@ -90,6 +269,7 @@
|
|||||||
const resetBtn = document.getElementById('reset')
|
const resetBtn = document.getElementById('reset')
|
||||||
const input = document.getElementById('input')
|
const input = document.getElementById('input')
|
||||||
const thread = document.getElementById('thread')
|
const thread = document.getElementById('thread')
|
||||||
|
const empty = document.getElementById('empty')
|
||||||
|
|
||||||
tokenInput.value = localStorage.getItem(TOKEN_KEY) || ''
|
tokenInput.value = localStorage.getItem(TOKEN_KEY) || ''
|
||||||
tokenInput.addEventListener('change', () => {
|
tokenInput.addEventListener('change', () => {
|
||||||
@@ -98,34 +278,100 @@
|
|||||||
|
|
||||||
const history = []
|
const history = []
|
||||||
|
|
||||||
function bubble(role, text, cls) {
|
function clearEmpty() {
|
||||||
const div = document.createElement('div')
|
if (empty && empty.parentNode === thread) thread.removeChild(empty)
|
||||||
div.className = 'bubble ' + (cls || role)
|
|
||||||
div.textContent = text
|
|
||||||
thread.appendChild(div)
|
|
||||||
thread.scrollTop = thread.scrollHeight
|
|
||||||
return div
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function typing() {
|
function scrollToBottom() {
|
||||||
const div = document.createElement('div')
|
// double rAF: 一次让浏览器 layout 新节点,第二次再滚
|
||||||
div.className = 'bubble assistant typing'
|
requestAnimationFrame(() => {
|
||||||
div.innerHTML = '<span></span><span></span><span></span>'
|
requestAnimationFrame(() => {
|
||||||
thread.appendChild(div)
|
thread.scrollTo({ top: thread.scrollHeight, behavior: 'smooth' })
|
||||||
thread.scrollTop = thread.scrollHeight
|
})
|
||||||
return div
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addBubble(role, text, opts = {}) {
|
||||||
|
clearEmpty()
|
||||||
|
const row = document.createElement('div')
|
||||||
|
row.className = 'row ' + role
|
||||||
|
const bubble = document.createElement('div')
|
||||||
|
bubble.className = 'bubble'
|
||||||
|
bubble.textContent = text
|
||||||
|
row.appendChild(bubble)
|
||||||
|
if (role === 'assistant' && !opts.err) {
|
||||||
|
const meta = document.createElement('div')
|
||||||
|
meta.className = 'meta'
|
||||||
|
const copy = document.createElement('button')
|
||||||
|
copy.className = 'copy-btn'
|
||||||
|
copy.type = 'button'
|
||||||
|
copy.textContent = '复制'
|
||||||
|
copy.addEventListener('click', async () => {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(text)
|
||||||
|
copy.textContent = '已复制'
|
||||||
|
setTimeout(() => (copy.textContent = '复制'), 1200)
|
||||||
|
} catch {
|
||||||
|
copy.textContent = '复制失败'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
meta.appendChild(copy)
|
||||||
|
bubble.appendChild(document.createElement('br'))
|
||||||
|
bubble.appendChild(meta)
|
||||||
|
}
|
||||||
|
thread.appendChild(row)
|
||||||
|
scrollToBottom()
|
||||||
|
return bubble
|
||||||
|
}
|
||||||
|
|
||||||
|
function addErr(text) {
|
||||||
|
clearEmpty()
|
||||||
|
const row = document.createElement('div')
|
||||||
|
row.className = 'row err'
|
||||||
|
const b = document.createElement('div')
|
||||||
|
b.className = 'bubble'
|
||||||
|
b.textContent = text
|
||||||
|
row.appendChild(b)
|
||||||
|
thread.appendChild(row)
|
||||||
|
scrollToBottom()
|
||||||
|
}
|
||||||
|
|
||||||
|
function addTyping() {
|
||||||
|
clearEmpty()
|
||||||
|
const row = document.createElement('div')
|
||||||
|
row.className = 'row assistant'
|
||||||
|
const bubble = document.createElement('div')
|
||||||
|
bubble.className = 'bubble typing'
|
||||||
|
bubble.innerHTML = '<span></span><span></span><span></span>'
|
||||||
|
row.appendChild(bubble)
|
||||||
|
thread.appendChild(row)
|
||||||
|
scrollToBottom()
|
||||||
|
return row
|
||||||
|
}
|
||||||
|
|
||||||
|
// textarea 自动 grow
|
||||||
|
function autoGrow() {
|
||||||
|
input.style.height = 'auto'
|
||||||
|
const next = Math.min(input.scrollHeight, 200)
|
||||||
|
input.style.height = next + 'px'
|
||||||
|
}
|
||||||
|
input.addEventListener('input', autoGrow)
|
||||||
|
|
||||||
async function send() {
|
async function send() {
|
||||||
const text = input.value.trim()
|
const text = input.value.trim()
|
||||||
const token = tokenInput.value.trim()
|
const token = tokenInput.value.trim()
|
||||||
if (!text) return
|
if (!text) return
|
||||||
if (!token) { bubble('err', '先在上方填 token。', 'err'); return }
|
if (!token) {
|
||||||
|
addErr('先在上方填 token。')
|
||||||
|
tokenInput.focus()
|
||||||
|
return
|
||||||
|
}
|
||||||
input.value = ''
|
input.value = ''
|
||||||
|
autoGrow()
|
||||||
history.push({ role: 'user', content: text })
|
history.push({ role: 'user', content: text })
|
||||||
bubble('user', text)
|
addBubble('user', text)
|
||||||
sendBtn.disabled = true
|
sendBtn.disabled = true
|
||||||
const dot = typing()
|
const dot = addTyping()
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/v1/chat/completions', {
|
const res = await fetch('/v1/chat/completions', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -141,33 +387,49 @@
|
|||||||
const body = await res.text()
|
const body = await res.text()
|
||||||
dot.remove()
|
dot.remove()
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
bubble('err', `${res.status}: ${body}`, 'err')
|
addErr(`HTTP ${res.status} — ${body || '(空响应)'}`)
|
||||||
history.pop()
|
history.pop()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let data
|
let data
|
||||||
try { data = JSON.parse(body) } catch (e) {
|
try {
|
||||||
bubble('err', '上游返回非 JSON: ' + body.slice(0, 300), 'err'); history.pop(); return
|
data = JSON.parse(body)
|
||||||
|
} catch {
|
||||||
|
addErr('上游返回非 JSON: ' + body.slice(0, 300))
|
||||||
|
history.pop()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
const reply = data?.choices?.[0]?.message?.content?.trim() || '(空回复)'
|
const reply = data?.choices?.[0]?.message?.content?.trim() || '(空回复)'
|
||||||
history.push({ role: 'assistant', content: reply })
|
history.push({ role: 'assistant', content: reply })
|
||||||
bubble('assistant', reply)
|
addBubble('assistant', reply)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dot.remove()
|
dot.remove()
|
||||||
bubble('err', '网络错误: ' + e.message, 'err')
|
addErr('网络错误: ' + e.message)
|
||||||
history.pop()
|
history.pop()
|
||||||
} finally {
|
} finally {
|
||||||
sendBtn.disabled = false
|
sendBtn.disabled = false
|
||||||
|
input.focus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendBtn.addEventListener('click', send)
|
sendBtn.addEventListener('click', send)
|
||||||
input.addEventListener('keydown', (e) => {
|
input.addEventListener('keydown', (e) => {
|
||||||
if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); send() }
|
if (e.key === 'Enter' && !e.shiftKey) {
|
||||||
|
e.preventDefault()
|
||||||
|
send()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
resetBtn.addEventListener('click', () => {
|
resetBtn.addEventListener('click', () => {
|
||||||
history.length = 0
|
history.length = 0
|
||||||
thread.innerHTML = ''
|
thread.innerHTML = ''
|
||||||
|
thread.appendChild(empty)
|
||||||
|
input.focus()
|
||||||
|
})
|
||||||
|
|
||||||
|
// 自动聚焦:如果已有 token 聚焦输入框,否则聚焦 token 框
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
if (tokenInput.value) input.focus()
|
||||||
|
else tokenInput.focus()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="theme-color" content="#0f0f0f">
|
<meta name="theme-color" content="#0f0f0f">
|
||||||
<title>Notes</title>
|
<title>Notes</title>
|
||||||
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0%25' stop-color='%237c5cbf'/%3E%3Cstop offset='100%25' stop-color='%23c084fc'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='64' height='64' rx='14' fill='url(%23g)'/%3E%3Crect x='25' y='13' width='14' height='24' rx='7' fill='white'/%3E%3Cpath d='M18 30 Q 18 42 32 42 Q 46 42 46 30' stroke='white' stroke-width='3.5' fill='none' stroke-linecap='round'/%3E%3Cline x1='32' y1='42' x2='32' y2='52' stroke='white' stroke-width='3.5' stroke-linecap='round'/%3E%3Cline x1='25' y1='52' x2='39' y2='52' stroke='white' stroke-width='3.5' stroke-linecap='round'/%3E%3Ccircle cx='50' cy='14' r='4' fill='%23ef4444'/%3E%3C/svg%3E">
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
|||||||
Reference in New Issue
Block a user