Skip to content

Commit

Permalink
Fixed setting history index incorrectly when there's a system message.
Browse files Browse the repository at this point in the history
Changed send button to edit when editing history.
  • Loading branch information
chigkim committed Feb 29, 2024
1 parent 4534fdb commit 910bdc8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions VOLlama.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 16
version = 17
import wx
import threading
import sounddevice as sd
Expand Down Expand Up @@ -34,9 +34,9 @@ def __init__(self, parent, title):
self.Maximize(True)
self.Centre()
self.Show()
self.historyIndex = 0
self.model = Model()
self.model.setSystem(settings.system)
self.historyIndex = len(self.model.messages)
self.refreshModels()
self.prompt.SetFocus()
threading.Thread(target=check_update, args=(version,)).start()
Expand Down Expand Up @@ -199,6 +199,8 @@ def setSystem(self, event):
if dlg.ShowModal() == wx.ID_OK:
system = dlg.GetValue()
self.model.setSystem(system)
if len(self.model.messages) == 1:
self.historyIndex = 1
settings.system = system
dlg.Destroy()

Expand Down Expand Up @@ -260,6 +262,7 @@ def OnHistoryUp(self, event):
self.historyIndex = 0
self.prompt.SetValue(self.model.messages[self.historyIndex].content)
self.prompt.SetInsertionPointEnd()
self.sendButton.SetLabel("Edit")

def OnHistoryDown(self, event):
self.historyIndex += 1
Expand All @@ -269,8 +272,10 @@ def OnHistoryDown(self, event):
if self.historyIndex < length:
self.prompt.SetValue(self.model.messages[self.historyIndex].content)
self.prompt.SetInsertionPointEnd()
self.sendButton.SetLabel("Edit")
else:
self.prompt.SetValue("")
self.sendButton.SetLabel("Send")

def FocusOnModelList(self, event):
self.modelList.SetFocus()
Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Change log

* Fixed setting history index incorrectly when there's a system message.
* Changed send button to edit when editing history.
* Paste last cleared user message into the prompt for editing or simply resending.
* Edit history: alt+(or option on mac)+up/down
* Embedding with Ollama
Expand Down

0 comments on commit 910bdc8

Please sign in to comment.