Skip to content

Commit 15db8dc

Browse files
committed
Refactor prompt builder separator condition to depend solely on system instructions
- even if prompt (instructions) is empty, the message should end with markdown separator "---" ├── README.md ├── apps │ ├── editor │ │ └── src │ │ ├── commands │ │ │ ├── apply-response-command │ │ │ │ ├── handlers │ │ │ │ │ └── diff-handler.ts │ │ │ │ └── utils │ │ │ │ └── response-parser │ │ │ │ ├── parsers │ │ │ │ │ └── diff-parser │ │ │ │ │ ├── diff-parser.ts │ │ │ │ │ ├── helpers │ │ │ │ │ │ └── patch-utils.ts │ │ │ │ │ └── test │ │ │ │ │ ├── cases │ │ │ │ │ │ ├── deletion-via-header │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── deletion-via-header.txt │ │ │ │ │ │ ├── deletion-via-redundant-header │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── deletion-via-redundant-header.txt │ │ │ │ │ │ ├── file-deletion │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── file-deletion.txt │ │ │ │ │ │ ├── git-and-hunk-header-same-line │ │ │ │ │ │ │ └── 1-file.txt │ │ │ │ │ │ ├── git-broken-hunk-header │ │ │ │ │ │ │ └── 1-file.txt │ │ │ │ │ │ ├── git-two-header-types │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── git-two-header-types.txt │ │ │ │ │ │ ├── ignore-ellipsis │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── 2-file.txt │ │ │ │ │ │ ├── in-non-diff-code-block │ │ │ │ │ │ │ └── 1-file.txt │ │ │ │ │ │ ├── inner-backticks │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── inner-backticks.txt │ │ │ │ │ │ ├── inner-triple-backticks │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── inner-triple-backticks.txt │ │ │ │ │ │ ├── markdown-missing-ending │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── markdown-missing-ending.txt │ │ │ │ │ │ ├── markdown-path-above │ │ │ │ │ │ │ └── 1-file.txt │ │ │ │ │ │ ├── markdown-path-above-no-hunk-header │ │ │ │ │ │ │ └── 1-file.txt │ │ │ │ │ │ ├── markdown-path-above-with-text-containing-path │ │ │ │ │ │ │ └── 2-file.txt │ │ │ │ │ │ ├── markdown-redundant-closing-backticks │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── markdown-redundant-closing-backticks.txt │ │ │ │ │ │ ├── markdown-repeated-path-above │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── markdown-repeated-path-above.txt │ │ │ │ │ │ ├── markdown-unnecessary-empty-lines │ │ │ │ │ │ │ └── 1-file.txt │ │ │ │ │ │ ├── mix-delete-and-new-file │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── mix-delete-and-new-file.txt │ │ │ │ │ │ ├── mix-new-file-and-diff │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── mix-new-file-and-diff.txt │ │ │ │ │ │ ├── mix-new-file-from-heading-and-diff │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ ├── 3-file.txt │ │ │ │ │ │ │ └── mix-new-file-from-heading-and-diff.txt │ │ │ │ │ │ ├── mix-new-file-from-xml-tag-heading-and-diff │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ ├── 3-file.txt │ │ │ │ │ │ │ └── mix-new-file-from-xml-tag-heading-and-diff.txt │ │ │ │ │ │ ├── mix-new-file-xml-and-diff-variant-1 │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── mix-new-file-xml-and-diff-variant-1.txt │ │ │ │ │ │ ├── mix-new-file-xml-and-diff-variant-2 │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── mix-new-file-xml-and-diff-variant-2.txt │ │ │ │ │ │ ├── mix-rename-and-update │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── mix-rename-and-update.txt │ │ │ │ │ │ ├── mix-rename-one-liner-and-diff │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── mix-rename-one-liner-and-diff.txt │ │ │ │ │ │ ├── multiple-edits-for-the-same-file │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── multiple-edits-for-the-same-file.txt │ │ │ │ │ │ ├── multiple-files-git-and-hunk-header-same-line │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── 2-file.txt │ │ │ │ │ │ ├── multiple-files-no-markdown-block │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── multiple-files-no-markdown-block.txt │ │ │ │ │ │ ├── multiple-files-no-prefix-single-markdown-block │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── multiple-files-no-prefix-single-markdown-block.txt │ │ │ │ │ │ ├── multiple-files-same-line-backticks │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── multiple-files-same-line-backticks.txt │ │ │ │ │ │ ├── multiple-files-separate-markdown-blocks │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── multiple-files-separate-markdown-blocks.txt │ │ │ │ │ │ ├── multiple-files-single-markdown-block │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── multiple-files-single-markdown-block.txt │ │ │ │ │ │ ├── multiple-files-text-between │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ ├── 4-file.txt │ │ │ │ │ │ │ └── multiple-files-text-between.txt │ │ │ │ │ │ ├── multiple-files-with-git-headers-no-file-lines │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── 2-file.txt │ │ │ │ │ │ ├── multiple-files-with-git-headers-separate-markdown-blocks │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── multiple-files-with-git-headers-separate-markdown-blocks.txt │ │ │ │ │ │ ├── multiple-files-with-quoted-paths │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── multiple-files-with-quoted-paths.txt │ │ │ │ │ │ ├── multiple-files-with-timestamps │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── multiple-files-with-timestamps.txt │ │ │ │ │ │ ├── multiple-new-files-separate-markdown-blocks │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ │ │ └── multiple-new-files-separate-markdown-blocks.txt │ │ │ │ │ │ ├── new-file-with-git-header │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── new-file-with-git-header.txt │ │ │ │ │ │ ├── no-markdown-or-git-header │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── no-markdown-or-git-header.txt │ │ │ │ │ │ ├── no-prefix │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── no-prefix.txt │ │ │ │ │ │ ├── non-diff-code-blocks │ │ │ │ │ │ │ ├── 3-file.txt │ │ │ │ │ │ │ └── non-diff-code-blocks.txt │ │ │ │ │ │ ├── rename │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── rename.txt │ │ │ │ │ │ ├── with-empty-lines-between │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── with-empty-lines-between.txt │ │ │ │ │ │ ├── with-git-header-no-file-lines │ │ │ │ │ │ │ └── 1-file.txt │ │ │ │ │ │ ├── with-git-header-no-markdown │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── with-git-header-no-markdown.txt │ │ │ │ │ │ ├── with-quoted-paths │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── with-quoted-paths.txt │ │ │ │ │ │ ├── with-timestamps │ │ │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ │ │ └── with-timestamps.txt │ │ │ │ │ │ ├── with-xml-file-path │ │ │ │ │ │ │ └── 1-file.txt │ │ │ │ │ │ ├── within-xml-tags │ │ │ │ │ │ │ └── 1-file.txt │ │ │ │ │ │ ├── within-xml-tags-unquoted-path │ │ │ │ │ │ │ └── 1-file.txt │ │ │ │ │ │ └── within-xml-tags-with-cdata │ │ │ │ │ │ └── 1-file.txt │ │ │ │ │ └── diff-parser.spec.ts │ │ │ │ └── response-parser.ts │ │ │ └── generate-commit-message-command │ │ │ └── actions │ │ │ └── get-prompt-data.ts │ │ ├── constants │ │ │ ├── edit-format-instructions.ts │ │ │ └── instructions.ts │ │ ├── features │ │ │ └── commit-messages │ │ │ └── utils │ │ │ └── build-commit-message-prompt.ts │ │ ├── utils │ │ │ ├── changes-integration │ │ │ │ ├── diff-processor │ │ │ │ │ ├── test-cases │ │ │ │ │ │ ├── deletion-only │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── empty-file │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── empty-file-2 │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── failing │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── failing-2 │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── generic-1 │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── generic-2 │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── generic-3 │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── generic-4 │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── generic-5 │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── generic-6 │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── generic-7 │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── generic-8 │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── generic-9 │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── insert-start-end │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── loose-gap-match │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── multiple-hunks │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ ├── redundant-new-empty-line │ │ │ │ │ │ │ └── diff.txt │ │ │ │ │ │ └── same-line-replace │ │ │ │ │ │ └── diff.txt │ │ │ │ │ └── utils │ │ │ │ │ └── normalize.ts │ │ │ │ └── search-replace-processor │ │ │ │ └── apply-search-replace-to-content │ │ │ │ └── test-cases │ │ │ │ └── rst-syntax │ │ │ │ ├── expected.txt │ │ │ │ └── original.txt │ │ │ └── prompt-builder.ts │ │ └── views │ │ └── prompt │ │ └── backend │ │ ├── message-handlers │ │ │ └── handle-hash-sign-quick-pick │ │ │ └── symbols │ │ │ └── skill-symbol.ts │ │ └── utils │ │ └── symbols │ │ └── git │ │ └── replace-git-symbols.ts │ └── old-website │ ├── blog │ │ └── 2025-03-16-welcome │ │ └── index.md │ └── copy-readme.js ├── docs │ ├── api-tools │ │ ├── code-completions.mdx │ │ ├── commit-messages.mdx │ │ ├── context-edit.mdx │ │ ├── index.mdx │ │ └── intelligent-update.mdx │ ├── chatbot-initialization.mdx │ ├── context-selection.mdx │ ├── privacy.mdx │ └── tips.mdx └── packages └── ui └── src └── components └── editor └── settings └── SortableList └── SortableList.stories.tsx
1 parent 2b726c1 commit 15db8dc

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎apps/editor/src/utils/prompt-builder.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,19 @@ export namespace PromptBuilder {
8181
}
8282

8383
const has_system = !!params.system_instructions
84-
const has_user = !!params.user_instructions
85-
const separator = params.separator !== false && has_system && has_user
84+
const separator = params.separator !== false && has_system
8685

8786
if (params.system_instructions) {
8887
const sys = params.system_instructions.trimEnd()
8988
if (sys) {
9089
part2 += `${sys}\n`
9190
full_prompt += `${sys}\n`
9291
if (separator) {
93-
part2 += `\n---\n\n`
92+
part2 += `\n---\n`
9493
full_prompt += `\n---\n\n`
94+
if (params.user_instructions) {
95+
part2 += `\n`
96+
}
9597
} else {
9698
part2 += `\n\n`
9799
full_prompt += `\n\n`

0 commit comments

Comments
 (0)