huynle / ogpt.nvim

Chat with Ollama/Huggingface/TextGen/OpenAI/Gemini/Anthropic GPT Neovim Plugin: Effortless Natural Language Generation with LLM API
Apache License 2.0
166 stars 14 forks source link

Overriding some actions wont work... #11

Closed JoseConseco closed 8 months ago

JoseConseco commented 9 months ago

In my actions I have overriden "optimize_code" ( to make it clear in template I told it to upperacase var names). It worked ok. Now same thing with "edit_code_with_instructions" would not work. - as u can see below ogpt is complaining about wrong model (even though I overrode it to deepseek, and in prompt I told it to uppercase var names too ) image

Now if I change tamplate name to edit_code_with_instructions**_mine** , then it works ok. Looks like some templates cant be overridden correctly.

JoseConseco commented 9 months ago

just to be clear both actions: image

The are basicallly same, only template is different. Thus I think its bug in ogpt.

huynle commented 9 months ago

how did you set your actions in your neovim config? did you use the action_paths where it takes json files, or did you directly added to the actions portion of your config?

Most likely, you are using the action_paths since the screenshot looks like they are from a json file. If you use the json files to set your actions, these actions are loaded, and then GETS OVERLOADED by the actions that are in your default configuration table that you initialize OGPT with.

so "edit_code_with_instructions" that you provide in your json action file, gets override by this [default "edit_code_with_instructions" action] (https://github.com/huynle/ogpt.nvim/blob/277bcccfbcb7f896d43de698609266845458e196/lua/ogpt/config.lua#L209C1-L221C9) in this [line] (https://github.com/huynle/ogpt.nvim/blob/277bcccfbcb7f896d43de698609266845458e196/lua/ogpt/flows/actions/init.lua#L48)

JoseConseco commented 9 months ago

ah, ok I see - the readme links to this 'shorter' config But your link - is slightly different (100 more lines) and indeed contains actions with "edit_code_with_instructions"

So even if I have no actions defined, they are loaded from default config, and 'actions_path' wont override it.

May I suggest that depending on the order of defined actions, next one should override previous one?

default_actions = {..} - we should be able to override it from user config Then user config:

actions = {..}  
actions_path = {..}  - last one overrides the previous ones.

But if users chagnes order of last two

actions_path = {..} 
actions = {..}   - now this will override both default actions and actions_path  (and defaults) .
huynle commented 8 months ago

i think your issue should be solved with this MR - https://github.com/huynle/ogpt.nvim/pull/14

huynle commented 8 months ago

https://github.com/huynle/ogpt.nvim/pull/14

JoseConseco commented 8 months ago

well, right now ollama wont even start (tried to enable debug, but I got no errors). I updated my config with: image maybe it is wrong?

huynle commented 8 months ago

hrm , try it without the ending "/" in your api_host

JoseConseco commented 8 months ago

Ok, this worked. Now the OGPT is complaining about model not being there - but I think the issue is with parsing its name the part after - seems ingnored: image

huynle commented 8 months ago

youre original model name, should still work with this new update. did you get it to work?

JoseConseco commented 8 months ago

Yes, the chat worked when using :OGPT . It is only when I use OGPTRun - it is complaining about wrong model .

:OGPT - ok image

:OGPTRun - wont parse model correctly (I think) . Config: image

I have no idea which config is executed now - default, my_config.actions, or actions.json.