Skip to content

Commit 1c71e83

Browse files
committed
🐛(backend) improve prompt to not use code blocks delimiter
The AI answer was activating the code block feature in the editor, which was not desired. The prompt for AI actions has been updated to instruct the AI to return content directly without wrapping it in code blocks or markdown delimiters.
1 parent ac0c16a commit 1c71e83

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ and this project adheres to
1212

1313
- ⚡️(docker) Optimize Dockerfile to use apk with --no-cache #743
1414

15+
### Fixed
16+
17+
- 🐛(backend) improve prompt to not use code blocks delimiter #1188
18+
19+
1520
## [3.4.1] - 2025-07-15
1621

1722
### Fixed
@@ -31,7 +36,7 @@ and this project adheres to
3136
- ✨Ask for access #1081
3237
- ✨(frontend) add customization for translations #857
3338
- ✨(backend) add ancestors links definitions to document abilities #846
34-
- ✨(backend) include ancestors accesses on document accesses list view # 846
39+
- ✨(backend) include ancestors accesses on document accesses list view #846
3540
- ✨(backend) add ancestors links reach and role to document API #846
3641
- 📝(project) add troubleshoot doc #1066
3742
- 📝(project) add system-requirement doc #1066

src/backend/core/services/ai_services.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
AI_ACTIONS = {
1111
"prompt": (
12-
"Answer the prompt in markdown format. "
12+
"Answer the prompt using markdown formatting for structure and emphasis. "
13+
"Return the content directly without wrapping it in code blocks or markdown delimiters. "
1314
"Preserve the language and markdown formatting. "
1415
"Do not provide any other information. "
1516
"Preserve the language."

src/backend/core/tests/documents/test_api_documents_ai_transform.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,11 @@ def test_api_documents_ai_transform_authenticated_success(mock_create, reach, ro
175175
{
176176
"role": "system",
177177
"content": (
178-
"Answer the prompt in markdown format. Preserve the language and markdown "
179-
"formatting. Do not provide any other information. Preserve the language."
178+
"Answer the prompt using markdown formatting for structure and emphasis. "
179+
"Return the content directly without wrapping it in code blocks or markdown delimiters. "
180+
"Preserve the language and markdown formatting. "
181+
"Do not provide any other information. "
182+
"Preserve the language."
180183
),
181184
},
182185
{"role": "user", "content": "Hello"},
@@ -249,8 +252,11 @@ def test_api_documents_ai_transform_success(mock_create, via, role, mock_user_te
249252
{
250253
"role": "system",
251254
"content": (
252-
"Answer the prompt in markdown format. Preserve the language and markdown "
253-
"formatting. Do not provide any other information. Preserve the language."
255+
"Answer the prompt using markdown formatting for structure and emphasis. "
256+
"Return the content directly without wrapping it in code blocks or markdown delimiters. "
257+
"Preserve the language and markdown formatting. "
258+
"Do not provide any other information. "
259+
"Preserve the language."
254260
),
255261
},
256262
{"role": "user", "content": "Hello"},

0 commit comments

Comments
 (0)