diff --git a/assets/arena.html b/assets/arena.html index e1eec1e2..5cfe8f44 100644 --- a/assets/arena.html +++ b/assets/arena.html @@ -847,9 +847,9 @@ const chat = this.chats[index]; const messages = []; for ([userMessage, assistantMessage] of chunkArray(chat.messages, 2)) { - if (assistantMessage.state == "failed") { + if (assistantMessage.state === "failed") { continue; - } else if (assistantMessage.state == "loading") { + } else if (assistantMessage.state === "loading") { messages.push({ role: userMessage.role, content: userMessage.content, @@ -929,7 +929,7 @@ const parsed = JSON.parse(message); yield parsed; } catch { - if (i == lines.length - 1) { + if (i === lines.length - 1) { reamingChunkValue += line; break; } diff --git a/assets/playground.html b/assets/playground.html index 6b541e61..d454ec01 100644 --- a/assets/playground.html +++ b/assets/playground.html @@ -72,6 +72,8 @@ } .sidebar-header { + display: flex; + align-items: center; padding: 1.25rem; } @@ -85,13 +87,21 @@ padding-top: 0.3rem; } + .sidebar-right { + display: flex; + flex-direction: row; + margin-left: auto; + gap: 6px; + } + + .sidebar-btn { + cursor: pointer; + width: 1.2rem; + height: 1.2rem; + } + .hide-sidebar-btn { display: none; - width: 1.5rem; - height: 1.5rem; - position: absolute; - right: 1.5rem; - top: 1.5rem; } .settings { @@ -391,6 +401,78 @@ opacity: 0.3; } + .session-list { + padding-top: 0.4rem; + max-height: 80vh; + font-size: 0.8rem; + overflow-y: auto; + overflow-x: hidden; + } + + .session-item { + padding: 5px; + border-bottom: 1px solid #e0e0e0; + cursor: pointer; + } + + .session-item:hover { + background-color: #f0f0f0; + } + + .session-title { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .modal { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + z-index: 1000; + display: flex; + align-items: flex-start; + justify-content: center; + padding-top: 50px; + } + + .modal-content { + position: relative; + padding: 0.8rem; + border-radius: 8px; + max-width: 1000px; + width: calc(100% - 100px); + background-color: white; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); + } + + .modal-header { + display: flex; + flex-direction: row; + align-items: center; + } + + .modal-header .title { + font-weight: 500; + font-size: 1.5rem; + } + + .modal-header .close-btn { + margin-left: auto; + background: none; + border: none; + font-size: 24px; + cursor: pointer; + color: #999; + } + + .modal-close-btn:hover { + color: #333; + } + .spinner { width: 1.1rem; height: 1.1rem; @@ -491,13 +573,35 @@