X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/80e348724041a694002fc38f57e8868b9b9a2be9..9346d20fe4297dce1aa16171749a7ef3e41ce7bd:/view_layout.go?ds=inline diff --git a/view_layout.go b/view_layout.go index a2d4825..a88c8fd 100644 --- a/view_layout.go +++ b/view_layout.go @@ -18,14 +18,14 @@ const viewLayoutFileName = "layout.json" // grow between batches. The view goes out as the same messages as in the // request before, while their lines give the same text, and the new lines // follow as one new message. So the end of the view of each earlier turn stays -// a message end. On the ChatGPT backend, the first request of a turn with this -// layout read the view of the turn before from the prompt cache in each of 10 -// turns, and with the view in one message it missed once in 5. +// a message end. Stable message boundaries let the model reuse the unchanged +// view prefix from its prompt cache instead of invalidating it when new lines +// arrive. // -// The first message starts with "\n". The closing tag goes into the -// state message after the view, so that no view message changes when lines -// come. The layout keeps the line count and a hash of the text of each message -// in layout.json, so it outlives a restart. +// The first message starts with "\n". The closing tag goes into the state +// message after the view, so that no view message changes when lines come. The +// layout keeps the line count and a hash of the text of each message in +// layout.json, so it outlives a restart. type ViewLayout struct { path string Messages []ViewLayoutMessage `json:"messages"` @@ -63,8 +63,8 @@ func loadViewLayout(path string) (*ViewLayout, error) { } // Split returns the view messages for lines and saves the layout. It keeps the -// earlier messages up to the first one whose text differs, and puts the rest -// of the lines into one new message. +// earlier messages up to the first one whose text differs, and puts the rest of +// the lines into one new message. func (l *ViewLayout) Split(lines []string) ([]string, error) { var ( texts []string