feat: change default initial prompt, use git root for config file

This commit is contained in:
2024-12-12 20:39:22 +01:00
parent 30b119e5f9
commit d51742459c
2 changed files with 26 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
-- lua/chatgpt_nvim/init.lua
local M = {}
local context = require('chatgpt_nvim.context')
@@ -39,11 +40,18 @@ function M.run_chatgpt_command()
local current_file_content, current_file_path = context.get_current_file()
local readme_content = context.get_readme_content()
-- Make the prompt more readable for the O1 model:
-- 1. Include initial prompt and user input at the start.
-- 2. Provide a clear project structure section.
-- 3. Clearly label the files section.
-- 4. The file_sections already include <<<CGPT Current File blocks for each file,
-- we just need to ensure there's a clear intro.
local sections = {
conf.initial_prompt .. "\n" .. user_input,
"\n\nProject Structure:\n",
project_structure,
"\n\nFiels:\n",
"\n\nBelow are the files from the project, each enclosed in <<<CGPT Current File ... >>> blocks for clarity.\n"
}
table.insert(sections, file_sections)