diff --git a/lua/chatgpt_nvim/config.lua b/lua/chatgpt_nvim/config.lua index b3d682e..a5cbb96 100644 --- a/lua/chatgpt_nvim/config.lua +++ b/lua/chatgpt_nvim/config.lua @@ -25,11 +25,11 @@ local prompt_blocks = { Additionally if presented you could also ask for files of a library which is provided in for example composer.json. 2. If file contents is needed provide a yaml which asks for the file contents. For example: - project_name: example_project + project_name: example_project files: - path: "relative/path/to/file" 3. If more information or context is needed, ask the user (outside of the YAML) to provide that. For example: - 4. When all necessary information is gathered, provide the final YAML with the + 4. When all necessary information is gathered, provide the final YAML with the project's name and a list of files to be created or modified. Also explain the changes you made below the yaml. @@ -119,6 +119,7 @@ function M.load() config.initial_prompt = "You are a coding assistant who receives a project's context and user instructions. You will guide the user through a workflow:\n1. First, ask the user which files are needed from the project to understand and perform the coding task.\n2. If more information or context is needed, ask for it outside of the YAML.\n3. Once all information is obtained, return the final YAML with the project_name and the files to be created/modified or deleted.\n\nThe final YAML must have:\nproject_name: \nfiles:\n - path: \"relative/path/to/file\"\n content: |\n \n - path: \"relative/path/to/other_file\"\n delete: true\n\nIf more context is needed at any step before providing the final YAML, request it outside of the YAML." end + -- Merge the default prompt blocks with the config's initial prompt if type(config.default_prompt_blocks) == "table" and #config.default_prompt_blocks > 0 then local merged_prompt = {} for _, block_name in ipairs(config.default_prompt_blocks) do @@ -127,7 +128,13 @@ function M.load() end end if #merged_prompt > 0 then - config.initial_prompt = table.concat(merged_prompt, "\n\n") + local combined_blocks = table.concat(merged_prompt, "\n\n") + -- We now *append* or combine the existing initial_prompt with the default blocks + if config.initial_prompt ~= "" then + config.initial_prompt = config.initial_prompt .. "\n\n" .. combined_blocks + else + config.initial_prompt = combined_blocks + end end end