Simplify reference formatting in LLM context generation

- Remove extra newlines in reference lists
- Change code block type from text to generic
This commit is contained in:
yangdx 2025-10-01 22:20:58 +08:00
parent f83cde14df
commit 37e8898cf6
2 changed files with 4 additions and 4 deletions

View file

@ -3233,7 +3233,7 @@ async def _build_llm_context(
text_units_str = "\n".join(
json.dumps(text_unit, ensure_ascii=False) for text_unit in text_units_context
)
reference_list_str = "\n\n".join(
reference_list_str = "\n".join(
f"[{ref['reference_id']}] {ref['file_path']}"
for ref in reference_list
if ref["reference_id"]
@ -4124,7 +4124,7 @@ async def naive_query(
text_units_str = "\n".join(
json.dumps(text_unit, ensure_ascii=False) for text_unit in text_units_context
)
reference_list_str = "\n\n".join(
reference_list_str = "\n".join(
f"[{ref['reference_id']}] {ref['file_path']}"
for ref in reference_list
if ref["reference_id"]

View file

@ -340,7 +340,7 @@ Document Chunks (Each entry has a reference_id refer to the `Reference Document
Reference Document List (Each entry starts with a [reference_id] that corresponds to entries in the Document Chunks):
```text
```
{reference_list_str}
```
@ -355,7 +355,7 @@ Document Chunks (Each entry has a reference_id refer to the `Reference Document
Reference Document List (Each entry starts with a [reference_id] that corresponds to entries in the Document Chunks):
```text
```
{reference_list_str}
```