Skip to content

Commit

Permalink
Ensure the last vision model used is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
AAClause committed Mar 12, 2024
1 parent 46d8ed5 commit 09b948f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions addon/globalPlugins/openai/maindialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from .consts import (
ADDON_DIR, BASE_URLs, DATA_DIR,
LIBS_DIR_PY,
MODELS,
MODELS, DEFAULT_MODEL_VISION,
TOP_P_MIN, TOP_P_MAX,
N_MIN, N_MAX,
DEFAULT_SYSTEM_PROMPT
Expand Down Expand Up @@ -153,10 +153,7 @@ def run(self):
block.prompt = prompt
model = wnd.getCurrentModel()
block.model = model.id
if model.vision:
conf["modelVision"] = model.id
else:
conf["model"] = model.id
conf["modelVision" if model.vision else "model"] = model.id
stream = conf["stream"]
debug = conf["debug"]
maxTokens = wnd.maxTokens.GetValue()
Expand Down Expand Up @@ -606,8 +603,10 @@ def __init__(
choices=models,
style=wx.LB_SINGLE | wx.LB_HSCROLL | wx.LB_NEEDED_SB
)
model = conf["modelVision"] if self.pathList else conf["model"]
idx = list(self._model_ids).index(model) if model in self._model_ids else 0
model = conf["modelVision" if self.pathList else "model"]
idx = list(self._model_ids).index(model) if model in self._model_ids else (
list(self._model_ids).index(DEFAULT_MODEL_VISION) if self.pathList else 0
)
self.modelListBox.SetSelection(idx)
self.modelListBox.Bind(wx.EVT_LISTBOX, self.onModelChange)
self.modelListBox.Bind(wx.EVT_KEY_DOWN, self.onModelKeyDown)
Expand Down

0 comments on commit 09b948f

Please sign in to comment.