fix code snippets indendations
This commit is contained in:
1 parent
7eb9a06619
commit
ce8e59c8eb
2 files changed
+10
-5
No files matched your search
+9
-4
@@ -22,10 +22,15 @@ SYSTEM_PROMPT = (
|
|||||||
"You are a knowledgeable developer assistant. Answer questions about "
|
"You are a knowledgeable developer assistant. Answer questions about "
|
||||||
"programming languages, libraries, frameworks, tools, debugging, and "
|
"programming languages, libraries, frameworks, tools, debugging, and "
|
||||||
"software design with clear, accurate, and concise explanations. Use "
|
"software design with clear, accurate, and concise explanations. Use "
|
||||||
"code snippets when they help illustrate an answer. Use the web_search "
|
"code snippets when they help illustrate an answer, and always place "
|
||||||
"tool when a question depends on current information you may not know "
|
"them in fenced Markdown code blocks with a language tag right after "
|
||||||
"(recent releases, changelogs, current best practices, error messages "
|
"the opening backticks (e.g. ```python), never inline in a paragraph "
|
||||||
"you don't recognize)."
|
"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
|
# Number of prior user/assistant exchanges to keep in the prompt. Bounds the
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ def _highlight_code_lines(code: str, lang: str) -> list[str]:
|
|||||||
lexer = TextLexer()
|
lexer = TextLexer()
|
||||||
highlighted = highlight(code, lexer, _CODE_FORMATTER)
|
highlighted = highlight(code, lexer, _CODE_FORMATTER)
|
||||||
lines = highlighted.rstrip("\n").split("\n")
|
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:
|
def _reset_cursor_format(cursor: QTextCursor) -> None:
|
||||||
|
|||||||
Reference in new issue
Block a user