diff --git a/chatgpt_config.yaml b/chatgpt_config.yaml index f696dee..02a6832 100644 --- a/chatgpt_config.yaml +++ b/chatgpt_config.yaml @@ -18,16 +18,12 @@ interactive_file_selection: false partial_acceptance: false enable_debug_commands: true -prompt_char_limit: 300000 enable_chunking: false enable_step_by_step: true auto_lint: true -# New tool auto-accept config tool_auto_accept: read_file: true edit_file: true replace_in_file: true execute_command: false - # If you set any of these to true, it will auto accept them without prompting. - # 'executeCommand' should remain false by default unless you're certain it's safe. diff --git a/lua/chatgpt_nvim/config.lua b/lua/chatgpt_nvim/config.lua index 8b9875a..2634478 100644 --- a/lua/chatgpt_nvim/config.lua +++ b/lua/chatgpt_nvim/config.lua @@ -57,7 +57,7 @@ function M.load() initial_prompt = "", directories = { "." }, default_prompt_blocks = {}, - prompt_char_limit = 300000, + -- Removed prompt_char_limit project_name = "", debug = false, initial_files = {}, @@ -109,9 +109,7 @@ function M.load() if type(result.default_prompt_blocks) == "table" then config.default_prompt_blocks = result.default_prompt_blocks end - if type(result.prompt_char_limit) == "number" then - config.prompt_char_limit = result.prompt_char_limit - end + -- Removed prompt_char_limit handling if type(result.project_name) == "string" then config.project_name = result.project_name end diff --git a/lua/chatgpt_nvim/context.lua b/lua/chatgpt_nvim/context.lua index edef33d..63ea354 100644 --- a/lua/chatgpt_nvim/context.lua +++ b/lua/chatgpt_nvim/context.lua @@ -198,13 +198,7 @@ function M.get_project_prompt(directories, conf) if conf.include_file_contents then local files = M.get_project_files(directories, conf) local contents = M.get_file_contents(files, conf) - local total_chars = #contents - if total_chars > conf.prompt_char_limit then - vim.notify("Total file contents (" .. total_chars .. " characters) exceed the prompt limit (" .. conf.prompt_char_limit .. "). Please disable 'include_file_contents' in your config.", vim.log.levels.ERROR) - return structure - else - return structure .. "\n" .. contents - end + return structure .. "\n" .. contents else return structure end diff --git a/lua/chatgpt_nvim/init.lua b/lua/chatgpt_nvim/init.lua index 81d7d63..7ec656f 100644 --- a/lua/chatgpt_nvim/init.lua +++ b/lua/chatgpt_nvim/init.lua @@ -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