yaroslavyaroslav / OpenAI-sublime-text

First class Sublime Text AI assistant with GPT-o1 and ollama support!
MIT License
173 stars 13 forks source link

An `internal_messages` exception, won't work #36

Closed maxim closed 9 months ago

maxim commented 9 months ago

Hi Yaroslav,

Really hoping to make this package work, but running into an issue.

I have the following config.

{
  "token": "[CENSORED]",
  "status_hint": [
      "name",
      "chat_model"
   ],

  "assistants": [
    {
      "name": "Ruby on Rails development",
      "prompt_mode": "replace",
      "chat_model": "gpt-4",
      "assistant_role": "Apply deep Ruby on Rails knowledge to change the code in the most elegant and readable way, as requested by user.",
      "max_tokens": 10000,
    },
  ]
}
  1. I selected this assistant as my model. (Confirmed in the status bar)
  2. I select some code and ask it to do something with it.
  3. I get the following error in the output console:
Exception in thread Thread-10:
Traceback (most recent call last):
  File "./python3.8/threading.py", line 932, in _bootstrap_inner
  File "/Users/max/Library/Application Support/Sublime Text/Installed Packages/OpenAI completion.sublime-package/openai_worker.py", line 265, in run
  File "/Users/max/Library/Application Support/Sublime Text/Installed Packages/OpenAI completion.sublime-package/openai_worker.py", line 189, in manage_chat_completion
  File "/Users/max/Library/Application Support/Sublime Text/Installed Packages/OpenAI completion.sublime-package/openai_network_client.py", line 47, in prepare_payload
UnboundLocalError: local variable 'internal_messages' referenced before assignment

No code changes occur.

Any idea what might be wrong?

Edit: Forgot to specify. I'm on Sublime Text 4 Build 4168, on macOS Sonoma 14.1.2.

yaroslavyaroslav commented 9 months ago

Yep, I've got the idea what might be going on here. Is it, I mean the error, appears in a stable way or is it fails from time to time?

yaroslavyaroslav commented 9 months ago

Nah, never mind. I've looked in the code and now it's obvious that all modes but the panel was broken in 2.5.5. Sorry about that, should be fixed in 2.5.6 (should appears in PC within a few hours). Pls reopen if it's not.

maxim commented 9 months ago

Ah, nice, it works now, thanks!