refactor: remove use_xml_format (#1535)

This commit is contained in:
yetone
2025-03-09 14:58:30 +08:00
committed by GitHub
parent 510bf2ff35
commit 868c136574
17 changed files with 75 additions and 102 deletions

View File

@@ -1,54 +1,25 @@
{%- if use_xml_format -%}
{% if selected_code -%}
{% for file in selected_files %}
{% if selected_files -%}
<selected_files>
{%- for file in selected_files %}
<file>
<filepath>{{file.path}}</filepath>
<context>
<content>
```{{file.file_type}}
{{file.content}}
```
</context>
{% endfor %}
<code>
```{{code_lang}}
{{selected_code}}
```
</code>
{%- else -%}
{% for file in selected_files %}
<filepath>{{file.path}}</filepath>
<code>
```{{file.file_type}}
{{file.content}}
```
</code>
{% endfor %}
</content>
</file>
{%- endfor %}
</selected_files>
{%- endif %}
{% else %}
{% if selected_code -%}
{% for file in selected_files %}
FILEPATH: {{file.path}}
CONTEXT:
```{{file.file_type}}
{{file.content}}
<selected_code>
<filepath>{{selected_code.path}}</filepath>
<content>
```{{selected_code.file_type}}
{{selected_code.content}}
```
{% endfor %}
CODE:
```{{code_lang}}
{{selected_code}}
```
{%- else -%}
{% for file in selected_files %}
FILEPATH: {{file.path}}
CODE:
```{{file.file_type}}
{{file.content}}
```
{% endfor %}
{%- endif %}{%- endif %}
</content>
</selected_code>
{%- endif %}

View File

@@ -1,4 +1,3 @@
{%- if use_xml_format -%}
{%- if diagnostics -%}
<diagnostic_field_description>
content: The diagnostic content
@@ -11,16 +10,3 @@ source: The source of the diagnostic
{{diagnostics}}
</diagnostics>
{%- endif %}
{%- else -%}
{%- if diagnostics -%}
DIAGNOSTIC_FIELD_DESCRIPTION:
content: The diagnostic content
start_line: The starting line of the diagnostic (1-indexed)
end_line: The final line of the diagnostic (1-indexed)
severity: The severity of the diagnostic
source: The source of the diagnostic
DIAGNOSTICS:
{{diagnostics}}
{%- endif %}
{%- endif %}

View File

@@ -1,12 +1,5 @@
{%- if use_xml_format -%}
{%- if project_context -%}
<project_context>
{{project_context}}
</project_context>
{%- endif %}
{%- else -%}
{%- if project_context -%}
PROJECT CONTEXT:
{{project_context}}
{%- endif %}
{%- endif %}

View File

@@ -3,8 +3,8 @@ Don't directly search for code context in historical messages. Instead, prioriti
Tools Usage Guide:
- You have access to tools, but only use them when necessary. If a tool is not required, respond as normal.
- Please DON'T be so aggressive in using tools, as many tasks can be better completed without tools.
- Files will be provided to you as context through <filepath> and <code> tags!
- If you need to read a file that is already in the context, do not use the `read_file` tool again; directly use the content from the context.
- Files will be provided to you as context through <selected_files> tag!
- Before using the `read_file` tool each time, always repeatedly check whether the file is already in the <selected_files> tag. If it is already there, do not use the `read_file` tool, just read the file content directly from the <selected_files> tag.
- If the `rag_search` tool exists, prioritize using it to do the search!
- If the `rag_search` tool exists, only use tools like `search_keyword` `search_files` `read_file` `list_files` etc when absolutely necessary!
- Keep the `query` parameter of `rag_search` tool as concise as possible! Try to keep it within five English words!

View File

@@ -1,7 +1,6 @@
{# Uses https://mitsuhiko.github.io/minijinja-playground/ for testing:
{
"ask": true,
"use_xml_format": true,
"question": "Refactor to include tab flow",
"code_lang": "lua",
"file_content": "local Config = require('avante.config')"

View File

@@ -137,11 +137,7 @@ Keep *SEARCH/REPLACE* blocks concise.
Break large *SEARCH/REPLACE* blocks into a series of smaller blocks that each change a small portion of the file.
Include just the changing lines, and a few surrounding lines if needed for uniqueness.
Do not include long runs of unchanging lines in *SEARCH/REPLACE* blocks.
{% if use_xml_format -%}
ONLY change the <code>, DO NOT change the <context>!
{% else -%}
ONLY change the CODE, DO NOT change the CONTEXT!
{% endif %}
Only create *SEARCH/REPLACE* blocks for files that the user has added to the chat!
To move code within a file, use 2 *SEARCH/REPLACE* blocks: 1 to delete it from its current location, 1 to insert it in the new location.