@@ -765,33 +765,15 @@ M.new_chat = function(params, toggle, system_prompt, agent)
765
765
return buf
766
766
end
767
767
768
- local exampleChatHook = [[
769
- Translator = function(gp, params)
770
- local chat_system_prompt = "You are a Translator, please translate between English and Chinese."
771
- gp.cmd.ChatNew(params, chat_system_prompt)
772
-
773
- -- -- you can also create a chat with a specific fixed agent like this:
774
- -- local agent = gp.get_chat_agent("ChatGPT4o")
775
- -- gp.cmd.ChatNew(params, chat_system_prompt, agent)
776
- end,
777
- ]]
778
-
779
768
--- @param params table
780
769
--- @param system_prompt string | nil
781
770
--- @param agent table | nil # obtained from get_command_agent or get_chat_agent
782
771
--- @return number # buffer number
783
772
M .cmd .ChatNew = function (params , system_prompt , agent )
784
- if agent then
785
- if not type (agent ) == " table" or not agent .provider then
786
- M .logger .warning (
787
- " The `gp.cmd.ChatNew` method signature has changed.\n "
788
- .. " Please update your hook functions as demonstrated in the example below:\n\n "
789
- .. exampleChatHook
790
- .. " \n For more information, refer to the 'Extend Functionality' section in the documentation."
791
- )
792
- return - 1
793
- end
773
+ if M .deprecator .has_old_chat_signature (agent ) then
774
+ return - 1
794
775
end
776
+
795
777
-- if chat toggle is open, close it and start a new one
796
778
if M ._toggle_close (M ._toggle_kind .chat ) then
797
779
params .args = params .args or " "
@@ -1632,16 +1614,6 @@ M.cmd.Context = function(params)
1632
1614
M .helpers .feedkeys (" G" , " xn" )
1633
1615
end
1634
1616
1635
- local examplePromptHook = [[
1636
- UnitTests = function(gp, params)
1637
- local template = "I have the following code from {{filename}}:\n\n"
1638
- .. "```{{filetype}}\n{{selection}}\n```\n\n"
1639
- .. "Please respond by writing table driven unit tests for the code above."
1640
- local agent = gp.get_command_agent()
1641
- gp.Prompt(params, gp.Target.vnew, agent, template)
1642
- end,
1643
- ]]
1644
-
1645
1617
--- @param params table # vim command parameters such as range, args, etc.
1646
1618
--- @param target number | function | table # where to put the response
1647
1619
--- @param agent table # obtained from get_command_agent or get_chat_agent
@@ -1650,13 +1622,7 @@ end,
1650
1622
--- @param whisper string | nil # predefined input (e.g. obtained from Whisper)
1651
1623
--- @param callback function | nil # callback after completing the prompt
1652
1624
M .Prompt = function (params , target , agent , template , prompt , whisper , callback )
1653
- if not agent or not type (agent ) == " table" or not agent .provider then
1654
- M .logger .warning (
1655
- " The `gp.Prompt` method signature has changed.\n "
1656
- .. " Please update your hook functions as demonstrated in the example below:\n\n "
1657
- .. examplePromptHook
1658
- .. " \n For more information, refer to the 'Extend Functionality' section in the documentation."
1659
- )
1625
+ if M .deprecator .has_old_prompt_signature (agent ) then
1660
1626
return
1661
1627
end
1662
1628
0 commit comments