feat: change prompt
This commit is contained in:
@@ -391,11 +391,11 @@ local function run_chatgpt_command()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local initial_sections = {
|
local initial_sections = {
|
||||||
"### Basic Prompt Instructions:\n",
|
"## Basic Prompt Instructions:\n",
|
||||||
conf.initial_prompt .. "\n\n\n",
|
conf.initial_prompt .. "\n\n\n",
|
||||||
"### User Instructions:\n",
|
"## User Instructions:\n",
|
||||||
user_input .. "\n\n\n",
|
user_input .. "\n\n\n",
|
||||||
"### Context/Data:\n",
|
"## Context/Data:\n",
|
||||||
"Project name: " .. (conf.project_name or "") .. "\n",
|
"Project name: " .. (conf.project_name or "") .. "\n",
|
||||||
"Project Structure:\n",
|
"Project Structure:\n",
|
||||||
project_structure,
|
project_structure,
|
||||||
@@ -403,7 +403,7 @@ local function run_chatgpt_command()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if conf.enable_debug_commands then
|
if conf.enable_debug_commands then
|
||||||
table.insert(initial_sections, "\n### Debug Commands Info:\n")
|
table.insert(initial_sections, "\n## Debug Commands Info:\n")
|
||||||
table.insert(initial_sections, prompts["debug-commands-info"])
|
table.insert(initial_sections, prompts["debug-commands-info"])
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -631,11 +631,11 @@ local function run_chatgpt_current_buffer_command()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local initial_sections = {
|
local initial_sections = {
|
||||||
"### Basic Prompt Instructions:\n",
|
"## Basic Prompt Instructions:\n",
|
||||||
conf.initial_prompt .. "\n\n\n",
|
conf.initial_prompt .. "\n\n\n",
|
||||||
"### User Instructions:\n",
|
"## User Instructions:\n",
|
||||||
user_input .. "\n\n\n",
|
user_input .. "\n\n\n",
|
||||||
"### Context/Data:\n",
|
"## Context/Data:\n",
|
||||||
"Project name: " .. (conf.project_name or "") .. "\n",
|
"Project name: " .. (conf.project_name or "") .. "\n",
|
||||||
"Project Structure:\n",
|
"Project Structure:\n",
|
||||||
project_structure,
|
project_structure,
|
||||||
@@ -643,7 +643,7 @@ local function run_chatgpt_current_buffer_command()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if conf.enable_debug_commands then
|
if conf.enable_debug_commands then
|
||||||
table.insert(initial_sections, "\n### Debug Commands Info:\n")
|
table.insert(initial_sections, "\n## Debug Commands Info:\n")
|
||||||
table.insert(initial_sections, prompts["debug-commands-info"])
|
table.insert(initial_sections, prompts["debug-commands-info"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -256,52 +256,54 @@ local M = {
|
|||||||
["basic-prompt"] = [[
|
["basic-prompt"] = [[
|
||||||
### Basic Prompt
|
### Basic Prompt
|
||||||
|
|
||||||
1. **Analyze Required Files**:
|
1. **Analyze Required Files**
|
||||||
- Identify the files that need to be modified or created based on the task requirements.
|
- Check the project structure (or any provided file list).
|
||||||
- Ensure all necessary files are included in the output YAML response.
|
- If you identify a file reference or function you do not have, **produce a YAML snippet** requesting that file’s content in full. For example:
|
||||||
|
```yaml
|
||||||
|
project_name: my_project
|
||||||
|
files:
|
||||||
|
- path: "relative/path/to/needed_file"
|
||||||
|
```
|
||||||
|
- Do not proceed with final changes if you lack the necessary file contents.
|
||||||
|
- Always provide the entire file content when you do include a file.
|
||||||
|
|
||||||
2. **Request File Contents**:
|
2. **Request File Contents**
|
||||||
- Provide a detailed description of the changes needed for each file, including any new content or modifications.
|
- For every file you need but don’t have, provide a short YAML snippet (like above) to retrieve it.
|
||||||
- Use clear and concise instructions to guide the implementation process.
|
- Ask any clarifying questions outside the YAML code block.
|
||||||
|
|
||||||
3. **Provide Output YAML**:
|
3. **Provide Output YAML**
|
||||||
|
- When you have all information, output the final YAML in this format:
|
||||||
- Structure your changes using the following format:
|
|
||||||
```yaml
|
```yaml
|
||||||
project_name: my_project
|
project_name: my_project
|
||||||
|
|
||||||
files:
|
files:
|
||||||
- file: src/main.py
|
- path: "src/main.py"
|
||||||
content: |
|
content: |
|
||||||
# Updated main function
|
# Updated main function
|
||||||
def main():
|
def main():
|
||||||
print("Hello, World!")
|
print("Hello, World!")
|
||||||
|
|
||||||
- file: docs/README.md
|
- path: "docs/README.md"
|
||||||
delete: true
|
delete: true
|
||||||
```
|
```
|
||||||
- Explanation of the Example:
|
- `project_name` must match the project’s configured name.
|
||||||
- `project_name` specifies the project's name.
|
- Each file item in `files` must have `path` and either `content` or `delete: true`.
|
||||||
- The `files` section lists all affected files.
|
|
||||||
- `file: src/main.py` contains new content for modification.
|
|
||||||
- `file: docs/README.md` is marked for deletion with delete: true.
|
|
||||||
|
|
||||||
4. **Explain Changes**:
|
4. **Explain Changes**
|
||||||
- Provide a brief explanation of the changes made below the YAML response.
|
- After the final YAML, add a brief explanation of the modifications (outside the YAML).
|
||||||
- Highlight any key decisions or reasoning behind the modifications.
|
|
||||||
|
|
||||||
5. **Iterate as Needed**:
|
5. **Iterate as Needed**
|
||||||
- If additional context or modifications are required, repeat the workflow steps to gather more information or make further changes.
|
- If further context or changes are required, repeat steps to request files or clarifications.
|
||||||
|
|
||||||
6. **Important Notes**:
|
6. **Important Notes**
|
||||||
- Avoid using comments in the code to explain your thought process. Comments should only clarify the code itself.
|
- Never modify or delete a file you haven’t explicitly requested or received.
|
||||||
- You can explain your reasoning and decisions outside of the output YAML format.
|
- Use comments in code only to clarify code logic, not to explain your thought process.
|
||||||
- Do not modify or delete any files that have not been explicitly requested.
|
- Explanations go outside the YAML.
|
||||||
|
|
||||||
7. **Best Practices**:
|
7. **Best Practices**
|
||||||
- Ensure all file paths and content are accurate to prevent errors during implementation.
|
- Keep file paths accurate to avoid mistakes during implementation.
|
||||||
- Follow a logical structure for your changes to maintain readability and clarity.
|
- Maintain a clear, logical structure for your changes.
|
||||||
- Use `output YAML` consistently throughout the process for better clarity and understanding.
|
- Use the final YAML consistently for clarity.
|
||||||
]],
|
]],
|
||||||
["secure-coding"] = [[
|
["secure-coding"] = [[
|
||||||
### Secure Coding Guidelines
|
### Secure Coding Guidelines
|
||||||
|
|||||||
Reference in New Issue
Block a user