diff --git a/api.go b/api.go index be2faf2..8bd059f 100644 --- a/api.go +++ b/api.go @@ -12,6 +12,17 @@ import ( */ 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) { flusher, ok := w.(http.Flusher) if !ok { @@ -52,17 +63,6 @@ func (this *Application) POST_Chat(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) 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 lparams := C.llama_context_default_params() diff --git a/webui.go b/webui.go index 9ad08f0..90e3339 100644 --- a/webui.go +++ b/webui.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "html" "net/http" @@ -44,7 +45,8 @@ button {