feat: remove old prompt_chat_limit

This commit is contained in:
2025-02-14 15:26:28 +01:00
parent a5bad60d8e
commit 32fcc2622f
4 changed files with 3 additions and 41 deletions

View File

@@ -179,11 +179,7 @@ local function build_prompt(user_input, dirs, conf)
return final_prompt
end
-- New token estimation function.
local function estimate_token_count(text)
-- Instead of simply dividing the character count by 4,
-- split the text into non-whitespace chunks and further split each chunk
-- into sequences of alphanumeric characters and punctuation.
local token_count = 0
for chunk in text:gmatch("%S+") do
for token in chunk:gmatch("(%w+|%p+)") do
@@ -202,9 +198,6 @@ local function handle_step_by_step_if_needed(prompt, conf)
return { prompts["step-prompt"] }
end
------------------------------------------------------------------------------
-- :ChatGPT
------------------------------------------------------------------------------
local function run_chatgpt_command()
package.loaded["chatgpt_nvim.config"] = nil
local config = require("chatgpt_nvim.config")
@@ -273,9 +266,6 @@ local function run_chatgpt_command()
vim.cmd("buffer " .. bufnr)
end
------------------------------------------------------------------------------
-- :ChatGPTPaste
------------------------------------------------------------------------------
local function run_chatgpt_paste_command()
package.loaded["chatgpt_nvim.config"] = nil
local config = require("chatgpt_nvim.config")
@@ -403,16 +393,6 @@ local function run_chatgpt_paste_command()
local length = #prompt
ui.debug_log("Returning requested files. Character count: " .. length)
if length > (conf.prompt_char_limit or 8000) and conf.enable_step_by_step then
local large_step = prompts["step-prompt"]
copy_to_clipboard(large_step)
print("Step-by-step guidance copied to clipboard!")
return
elseif length > (conf.prompt_char_limit or 8000) then
vim.api.nvim_err_writeln("Requested files exceed prompt character limit. No step-by-step support enabled.")
return
end
copy_to_clipboard(prompt)
print("Prompt (with requested files) copied to clipboard! Paste it into ChatGPT.")
end
@@ -421,9 +401,6 @@ local function run_chatgpt_paste_command()
end
end
------------------------------------------------------------------------------
-- :ChatGPTCurrentBuffer
------------------------------------------------------------------------------
local function run_chatgpt_current_buffer_command()
package.loaded["chatgpt_nvim.config"] = nil
local config = require("chatgpt_nvim.config")
@@ -462,9 +439,6 @@ local function run_chatgpt_current_buffer_command()
end
end
------------------------------------------------------------------------------
-- PUBLIC API
------------------------------------------------------------------------------
M.run_chatgpt_command = run_chatgpt_command
M.run_chatgpt_paste_command = run_chatgpt_paste_command
M.run_chatgpt_current_buffer_command = run_chatgpt_current_buffer_command