From 50ba937ae0e725dbfd8d69d8dbe798e654a2658b Mon Sep 17 00:00:00 2001 From: Dominik Polakovics Date: Fri, 31 Jan 2025 15:09:10 +0100 Subject: [PATCH] fix: add project name to initial prompt, improve basic prompt --- lua/chatgpt_nvim/config.lua | 6 ++++++ lua/chatgpt_nvim/prompts.lua | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/chatgpt_nvim/config.lua b/lua/chatgpt_nvim/config.lua index 63da008..0bbfd14 100644 --- a/lua/chatgpt_nvim/config.lua +++ b/lua/chatgpt_nvim/config.lua @@ -173,6 +173,12 @@ function M.load() end end + -- Include project name in the final initial prompt, if set + if config.project_name ~= "" then + config.initial_prompt = + "[Project Name: " .. config.project_name .. "]\n\n" .. config.initial_prompt + end + if config.debug then vim.api.nvim_out_write("[chatgpt_nvim:config] Loaded config from: " .. path .. "\n") vim.api.nvim_out_write("[chatgpt_nvim:config] Debug logging is enabled.\n") diff --git a/lua/chatgpt_nvim/prompts.lua b/lua/chatgpt_nvim/prompts.lua index 6c4e040..3bc0a82 100644 --- a/lua/chatgpt_nvim/prompts.lua +++ b/lua/chatgpt_nvim/prompts.lua @@ -289,7 +289,7 @@ local M = { - If multiple tools are needed, list them sequentially in the `tools` array. - Always run at least one tool (e.g., `readFile`, `editFile`, `executeCommand`), exept you have finished. - Always just include one yaml in the response with all the tools you want to run in that yaml. - - Never do write operations on a file which you have not read before. + - Never do write operations on a file which you have not read before. Its contents must be in your context before writing. This does not apply if you create a new file. - The plugin will verify the `project_name` is correct before running any tools. - If the response grows too large, I'll guide you to break it into smaller steps. ]],