almost
parent
1a7f783fe0
commit
0a3a7a0616
|
|
@ -9,19 +9,33 @@
|
|||
}
|
||||
|
||||
function startStream(newPrompt) {
|
||||
body = new URLSearchParams(new FormData(newPrompt)).toString()
|
||||
console.log(body)
|
||||
http("POST", "/api/v0/chatbot", (body, status) => {
|
||||
if (status != 200) {
|
||||
log(body)
|
||||
return
|
||||
}
|
||||
}, body)
|
||||
body = new URLSearchParams(new FormData(newPrompt)).toString()
|
||||
http("POST", "/api/v0/chatbot", (body, status) => {
|
||||
if (status != 200) {
|
||||
log(body)
|
||||
return
|
||||
}
|
||||
}, body)
|
||||
}
|
||||
|
||||
function pushStream(newMessage) {
|
||||
body = new URLSearchParams(new FormData(newMessage)).toString()
|
||||
newMessage.getElementsByTagName("button").disabled = true
|
||||
newMessage.getElementsByTagName("input").disabled = true
|
||||
http("PUT", "/api/v0/chatbot", (body, status) => {
|
||||
newMessage.getElementsByTagName("button").disabled = false
|
||||
newMessage.getElementsByTagName("input").disabled = false
|
||||
if (status != 200) {
|
||||
log(body)
|
||||
return
|
||||
}
|
||||
log(body)
|
||||
}, body)
|
||||
}
|
||||
|
||||
function log() {
|
||||
console.log(arguments)
|
||||
document.getElementById("debug-log").innerHTML += "\n" + new String(arguments)
|
||||
console.log(arguments)
|
||||
document.getElementById("debug-log").innerHTML += "\n" + new String(arguments)
|
||||
}
|
||||
|
||||
function http(method, remote, callback, body) {
|
||||
|
|
@ -37,8 +51,6 @@
|
|||
}
|
||||
xmlhttp.send(body);
|
||||
}
|
||||
function callback(responseBody, responseStatus) {
|
||||
}
|
||||
</script>
|
||||
</header>
|
||||
<body onload="loadStream()">
|
||||
|
|
@ -51,7 +63,7 @@
|
|||
</details>
|
||||
<details open=true>
|
||||
<summary>Use your session</summary>
|
||||
<form id="stream" onsubmit="return false;">
|
||||
<form id="stream" onsubmit="pushStream(this); return false;">
|
||||
<textarea id="stream-log" readonly=true></textarea>
|
||||
<div style="display: flex; flex-direction: row;">
|
||||
<input style="flex-grow: 1;" type="text" name="Message"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue