llamachat/templates/index.gohtml

36 lines
1.1 KiB
Plaintext

{{- /*gotype:llamachat.WebPageModel*/ -}}
{{define "index"}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Llamachat</title>
<link rel="stylesheet" href="static/style.css">
<script src="static/script.js" type="application/javascript"></script>
<script src="https://unpkg.com/htmx.org@2.0.3"></script>
<script src="https://unpkg.com/htmx-ext-ws@2.0.1/ws.js"></script>
</head>
<body hx-ext="ws">
<div class="content-box" id="conversation" ws-connect="/ws" hx-on::ws-after-message="scrollToBottom();">
<div id="conversation">
{{range .Conversation}}
{{- /*gotype:llamachat.WebMessage*/ -}}
{{block "message-frag" .}}
<div class="message" id="message-{{.Id}}">
<span class="content">{{ .Content }}</span>
</div>
{{end}}
{{end}}
</div>
<form class="message-box" id="message-box" ws-send>
<input id="message-input" name="message" type="text" placeholder="Type a message">
<input type="submit" value="Send">
</form>
</div>
</body>
</html>
{{end}}