webui: synchronize context size value for clientside warning
This commit is contained in:
parent
dc8db75e04
commit
2cdcf54dd8
22
api.go
22
api.go
@ -12,6 +12,17 @@ import (
|
|||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
// Constant LLaMA parameters
|
||||||
|
|
||||||
|
const (
|
||||||
|
ParamContextSize = 512 // RAM requirements: 512 needs 800MB KV (~3216MB overall), 2048 needs 3200MB KV (~??? overall)
|
||||||
|
ParamTopK = 40
|
||||||
|
ParamTopP = 0.95
|
||||||
|
ParamTemperature = 0.08
|
||||||
|
ParamRepeatPenalty = 1.10
|
||||||
|
ParamRepeatPenaltyWindowSize = 64
|
||||||
|
)
|
||||||
|
|
||||||
func (this *Application) POST_Chat(w http.ResponseWriter, r *http.Request) {
|
func (this *Application) POST_Chat(w http.ResponseWriter, r *http.Request) {
|
||||||
flusher, ok := w.(http.Flusher)
|
flusher, ok := w.(http.Flusher)
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -52,17 +63,6 @@ func (this *Application) POST_Chat(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.WriteHeader(200)
|
w.WriteHeader(200)
|
||||||
flusher.Flush() // Flush before any responses, so the webui knows things are happening
|
flusher.Flush() // Flush before any responses, so the webui knows things are happening
|
||||||
|
|
||||||
// Constant LLaMA parameters
|
|
||||||
|
|
||||||
const (
|
|
||||||
ParamContextSize = 512 // RAM requirements: 512 needs 800MB KV (~3216MB overall), 2048 needs 3200MB KV (~??? overall)
|
|
||||||
ParamTopK = 40
|
|
||||||
ParamTopP = 0.95
|
|
||||||
ParamTemperature = 0.08
|
|
||||||
ParamRepeatPenalty = 1.10
|
|
||||||
ParamRepeatPenaltyWindowSize = 64
|
|
||||||
)
|
|
||||||
|
|
||||||
// Start a new LLaMA session
|
// Start a new LLaMA session
|
||||||
|
|
||||||
lparams := C.llama_context_default_params()
|
lparams := C.llama_context_default_params()
|
||||||
|
6
webui.go
6
webui.go
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"html"
|
"html"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
@ -44,7 +45,8 @@ button {
|
|||||||
<button id="interrupt" disabled>⏸️ Interrupt</button>
|
<button id="interrupt" disabled>⏸️ Interrupt</button>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function main() {
|
function main() {
|
||||||
let conversationID = "` + uuid.New().String() + `";
|
const conversationID = "` + uuid.New().String() + `";
|
||||||
|
const contextSize = ` + fmt.Sprintf("%d", ParamContextSize) + `;
|
||||||
const apiKey = "public-web-interface";
|
const apiKey = "public-web-interface";
|
||||||
|
|
||||||
const $generate = document.getElementById("generate");
|
const $generate = document.getElementById("generate");
|
||||||
@ -53,7 +55,7 @@ function main() {
|
|||||||
|
|
||||||
$generate.addEventListener('click', async function() {
|
$generate.addEventListener('click', async function() {
|
||||||
const content = $main.value;
|
const content = $main.value;
|
||||||
if (content.split(" ").length >= 2047) {
|
if (content.split(" ").length >= (contextSize-4)) {
|
||||||
if (! confirm("Warning: high prompt length, the model will forget part of the content. Are you sure you want to continue?")) {
|
if (! confirm("Warning: high prompt length, the model will forget part of the content. Are you sure you want to continue?")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user