- Add --max-context flag to serve (sliding window, default 4 messages) to prevent KV-cache explosion on multi-turn conversations - Pass server max-tokens to chat UI HTML attribute instead of hardcoded 2048 in JavaScript - Add chat.js and chat_embed.go for embedded LEM chat UI Co-Authored-By: Virgil <virgil@lethean.io>
44 lines
929 B
Go
44 lines
929 B
Go
package ml
|
|
|
|
import (
|
|
_ "embed"
|
|
)
|
|
|
|
//go:embed chat.js
|
|
var lemChatJS []byte
|
|
|
|
const chatHTML = `<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>LEM Chat</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
html, body { height: 100%%; background: #111; }
|
|
body {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-family: system-ui, -apple-system, sans-serif;
|
|
}
|
|
lem-chat {
|
|
width: 720px;
|
|
height: 85vh;
|
|
max-height: 800px;
|
|
}
|
|
@media (max-width: 768px) {
|
|
lem-chat { width: 100%%; height: 100%%; max-height: none; border-radius: 0; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<lem-chat
|
|
endpoint=""
|
|
model="%s"
|
|
system-prompt=""
|
|
max-tokens="%d"
|
|
></lem-chat>
|
|
<script type="module" src="/chat.js"></script>
|
|
</body>
|
|
</html>`
|