fix code snippets indendations

This commit is contained in:
fsylvain committed 2026-09-19 21:25:38 +02:00
1 parent 7eb9a06619
commit ce8e59c8eb
2 files changed
+10 -5

No files matched your search

+9 -4
View File
@@ -22,10 +22,15 @@ SYSTEM_PROMPT = (
"You are a knowledgeable developer assistant. Answer questions about "
"programming languages, libraries, frameworks, tools, debugging, and "
"software design with clear, accurate, and concise explanations. Use "
"code snippets when they help illustrate an answer. Use the web_search "
"tool when a question depends on current information you may not know "
"(recent releases, changelogs, current best practices, error messages "
"you don't recognize)."
"code snippets when they help illustrate an answer, and always place "
"them in fenced Markdown code blocks with a language tag right after "
"the opening backticks (e.g. ```python), never inline in a paragraph "
"or left unfenced. Use Markdown throughout: numbered or bulleted "
"lists for steps, **bold** for emphasis, and inline `code` spans for "
"identifiers, filenames, and commands mentioned in prose. Use the "
"web_search tool when a question depends on current information you "
"may not know (recent releases, changelogs, current best practices, "
"error messages you don't recognize)."
)
# Number of prior user/assistant exchanges to keep in the prompt. Bounds the
+1 -1
View File
@@ -93,7 +93,7 @@ def _highlight_code_lines(code: str, lang: str) -> list[str]:
lexer = TextLexer()
highlighted = highlight(code, lexer, _CODE_FORMATTER)
lines = highlighted.rstrip("\n").split("\n")
return [f'<span style="color:{_CODE_FG};">{line}</span>' for line in lines]
return [f'<span style="color:{_CODE_FG}; white-space:pre;">{line}</span>' for line in lines]
def _reset_cursor_format(cursor: QTextCursor) -> None: