Skip to content

Commit 360ee31

Browse files
chore: auto-generate vimdoc
1 parent 2e54467 commit 360ee31

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

doc/gp.nvim.txt

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ Here are some more examples:
879879
.. "```{{filetype}}\n{{selection}}\n```\n\n"
880880
.. "Please respond by writing table driven unit tests for the code above."
881881
local agent = gp.get_command_agent()
882-
gp.Prompt(params, gp.Target.enew, nil, agent.model, template, agent.system_prompt)
882+
gp.Prompt(params, gp.Target.vnew, agent, template)
883883
end,
884884
<
885885
- `:GpExplain`
@@ -890,7 +890,7 @@ Here are some more examples:
890890
.. "```{{filetype}}\n{{selection}}\n```\n\n"
891891
.. "Please respond by explaining the code above."
892892
local agent = gp.get_chat_agent()
893-
gp.Prompt(params, gp.Target.popup, nil, agent.model, template, agent.system_prompt)
893+
gp.Prompt(params, gp.Target.popup, agent, template)
894894
end,
895895
<
896896
- `:GpCodeReview`
@@ -901,16 +901,19 @@ Here are some more examples:
901901
.. "```{{filetype}}\n{{selection}}\n```\n\n"
902902
.. "Please analyze for code smells and suggest improvements."
903903
local agent = gp.get_chat_agent()
904-
gp.Prompt(params, gp.Target.enew("markdown"), nil, agent.model, template, agent.system_prompt)
904+
gp.Prompt(params, gp.Target.enew("markdown"), agent, template)
905905
end,
906906
<
907907
- `:GpTranslator`
908908
>lua
909909
-- example of adding command which opens new chat dedicated for translation
910910
Translator = function(gp, params)
911-
local agent = gp.get_command_agent()
912-
local chat_system_prompt = "You are a Translator, please translate between English and Chinese."
913-
gp.cmd.ChatNew(params, agent.model, chat_system_prompt)
911+
local chat_system_prompt = "You are a Translator, please translate between English and Chinese."
912+
gp.cmd.ChatNew(params, chat_system_prompt)
913+
914+
-- -- you can also create a chat with a specific fixed agent like this:
915+
-- local agent = gp.get_chat_agent("ChatGPT4o")
916+
-- gp.cmd.ChatNew(params, chat_system_prompt, agent)
914917
end,
915918
<
916919
- `:GpBufferChatNew`
@@ -923,7 +926,17 @@ Here are some more examples:
923926
end,
924927
<
925928

926-
The raw plugin text editing method `Prompt` has seven aprameters:
929+
The raw plugin text editing method `Prompt` has following signature:
930+
931+
>lua
932+
---@param params table # vim command parameters such as range, args, etc.
933+
---@param target integer | function | table # where to put the response
934+
---@param agent table # obtained from get_command_agent or get_chat_agent
935+
---@param template string # template with model instructions
936+
---@param prompt string | nil # nil for non interactive commads
937+
---@param whisper string | nil # predefined input (e.g. obtained from Whisper)
938+
Prompt(params, target, agent, template, prompt, whisper)
939+
<
927940

928941
- `params` is a |table passed to neovim user commands|, `Prompt` currently uses:
929942
- `range, line1, line2` to work with |ranges|
@@ -1002,13 +1015,13 @@ The raw plugin text editing method `Prompt` has seven aprameters:
10021015
end,
10031016
}
10041017
<
1005-
- `prompt`
1006-
- string used similarly as bash/zsh prompt in terminal, when plugin asks for user command to gpt.
1007-
- if `nil`, user is not asked to provide input (for specific predefined commands - document this, explain that, write tests ..)
1008-
- simple `🤖 ~` might be used or you could use different msg to convey info about the method which is called
1009-
(`🤖 rewrite ~`, `🤖 popup ~`, `🤖 enew ~`, `🤖 inline ~`, etc.)
1010-
- `model`
1011-
- see gpt model overview <https://platform.openai.com/docs/models/overview>
1018+
- `agent` table obtainable via `get_command_agent` and `get_chat_agent` methods
1019+
which have following signature:
1020+
>lua
1021+
---@param name string | nil
1022+
---@return table # { cmd_prefix, name, model, system_prompt, provider }
1023+
get_command_agent(name)
1024+
<
10121025
- `template`
10131026
- template of the user message send to gpt
10141027
- string can include variables below:
@@ -1017,8 +1030,11 @@ The raw plugin text editing method `Prompt` has seven aprameters:
10171030
{{filetype}} filetype of the current buffer
10181031
{{selection}} last or currently selected text
10191032
{{command}} instructions provided by the user
1020-
- `system_template`
1021-
- See gpt api intro <https://platform.openai.com/docs/guides/chat/introduction>
1033+
- `prompt`
1034+
- string used similarly as bash/zsh prompt in terminal, when plugin asks for user command to gpt.
1035+
- if `nil`, user is not asked to provide input (for specific predefined commands - document this, explain that, write tests ..)
1036+
- simple `🤖 ~` might be used or you could use different msg to convey info about the method which is called
1037+
(`🤖 rewrite ~`, `🤖 popup ~`, `🤖 enew ~`, `🤖 inline ~`, etc.)
10221038
- `whisper`
10231039
- optional string serving as a default for input prompt (for example generated from speech by Whisper)
10241040

0 commit comments

Comments
 (0)