Skip to content

fix(shared): preserve paragraph breaks in the Bot system prompt - #48

Open
arpan7sarkar wants to merge 1 commit into
CopilotKit:mainfrom
arpan7sarkar:fix/system-prompt-paragraph-breaks
Open

fix(shared): preserve paragraph breaks in the Bot system prompt#48
arpan7sarkar wants to merge 1 commit into
CopilotKit:mainfrom
arpan7sarkar:fix/system-prompt-paragraph-breaks

Conversation

@arpan7sarkar

Copy link
Copy Markdown

Fixes #47

SYSTEM_PROMPT was an array of lines with "" entries marking paragraph
breaks, joined with .join(" "). That turned every break into a double
space instead of a real paragraph gap, collapsing the whole multi-section
prompt into one run-on string before it reached the model.

Reproduced first: SYSTEM_PROMPT.includes("\n") was false and
.includes(" ") was true on main.

Fix: split the array into paragraphs (lines within a paragraph joined
with a space) and join paragraphs with a blank line, so the rendered
prompt has 5 clear paragraphs and zero double-spaces.

Added shared/bot-prompt.test.ts to lock in both invariants.

SYSTEM_PROMPT was an array of lines with "" entries marking paragraph
breaks, joined with .join(" "). That turns every break into a double
space instead of a real paragraph gap, collapsing the whole multi-section
prompt into one run-on string before it reaches the model.

Split the array into paragraphs (lines joined with a space) and join
paragraphs with a blank line instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SYSTEM_PROMPT collapses all paragraph breaks into a run-on string

1 participant