Skip to content

Commit 48266ba

Browse files
author
jiangpeiling
committed
🐛 When generating prompts using deep thinking models, it is necessary to remove the deep thinking content. #1229
1 parent 6c93db5 commit 48266ba

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

test/backend/services/test_prompt_service.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
get_enabled_sub_agent_description_for_generate_prompt,
2727
generate_system_prompt,
2828
join_info_for_generate_system_prompt,
29-
process_thinking_tokens
29+
_process_thinking_tokens
3030
)
3131

3232

@@ -493,7 +493,7 @@ def test_process_thinking_tokens_normal_token(self):
493493
def mock_callback(text):
494494
callback_calls.append(text)
495495

496-
is_thinking = process_thinking_tokens(
496+
is_thinking = _process_thinking_tokens(
497497
"Hello", False, token_join, mock_callback)
498498

499499
self.assertFalse(is_thinking)
@@ -508,7 +508,7 @@ def test_process_thinking_tokens_start_thinking(self):
508508
def mock_callback(text):
509509
callback_calls.append(text)
510510

511-
is_thinking = process_thinking_tokens(
511+
is_thinking = _process_thinking_tokens(
512512
"<think>", False, token_join, mock_callback)
513513

514514
self.assertTrue(is_thinking)
@@ -523,7 +523,7 @@ def test_process_thinking_tokens_content_while_thinking(self):
523523
def mock_callback(text):
524524
callback_calls.append(text)
525525

526-
is_thinking = process_thinking_tokens(
526+
is_thinking = _process_thinking_tokens(
527527
"thinking content", True, token_join, mock_callback)
528528

529529
self.assertTrue(is_thinking)
@@ -538,7 +538,7 @@ def test_process_thinking_tokens_end_thinking(self):
538538
def mock_callback(text):
539539
callback_calls.append(text)
540540

541-
is_thinking = process_thinking_tokens(
541+
is_thinking = _process_thinking_tokens(
542542
"</think>", True, token_join, mock_callback)
543543

544544
self.assertFalse(is_thinking)
@@ -553,7 +553,7 @@ def test_process_thinking_tokens_content_after_thinking(self):
553553
def mock_callback(text):
554554
callback_calls.append(text)
555555

556-
is_thinking = process_thinking_tokens(
556+
is_thinking = _process_thinking_tokens(
557557
"World", False, token_join, mock_callback)
558558

559559
self.assertFalse(is_thinking)
@@ -569,32 +569,32 @@ def mock_callback(text):
569569
callback_calls.append(text)
570570

571571
# Start with normal content
572-
is_thinking = process_thinking_tokens(
572+
is_thinking = _process_thinking_tokens(
573573
"Start ", False, token_join, mock_callback)
574574
self.assertFalse(is_thinking)
575575

576576
# Enter thinking mode
577-
is_thinking = process_thinking_tokens(
577+
is_thinking = _process_thinking_tokens(
578578
"<think>", False, token_join, mock_callback)
579579
self.assertTrue(is_thinking)
580580

581581
# Thinking content (ignored)
582-
is_thinking = process_thinking_tokens(
582+
is_thinking = _process_thinking_tokens(
583583
"thinking", True, token_join, mock_callback)
584584
self.assertTrue(is_thinking)
585585

586586
# More thinking content (ignored)
587-
is_thinking = process_thinking_tokens(
587+
is_thinking = _process_thinking_tokens(
588588
" more", True, token_join, mock_callback)
589589
self.assertTrue(is_thinking)
590590

591591
# End thinking
592-
is_thinking = process_thinking_tokens(
592+
is_thinking = _process_thinking_tokens(
593593
"</think>", True, token_join, mock_callback)
594594
self.assertFalse(is_thinking)
595595

596596
# Continue with normal content
597-
is_thinking = process_thinking_tokens(
597+
is_thinking = _process_thinking_tokens(
598598
" End", False, token_join, mock_callback)
599599
self.assertFalse(is_thinking)
600600

@@ -606,7 +606,7 @@ def test_process_thinking_tokens_no_callback(self):
606606
"""Test process_thinking_tokens without callback function"""
607607
token_join = []
608608

609-
is_thinking = process_thinking_tokens("Hello", False, token_join, None)
609+
is_thinking = _process_thinking_tokens("Hello", False, token_join, None)
610610

611611
self.assertFalse(is_thinking)
612612
self.assertEqual(token_join, ["Hello"])
@@ -619,7 +619,7 @@ def test_process_thinking_tokens_empty_token(self):
619619
def mock_callback(text):
620620
callback_calls.append(text)
621621

622-
is_thinking = process_thinking_tokens(
622+
is_thinking = _process_thinking_tokens(
623623
"", False, token_join, mock_callback)
624624

625625
self.assertFalse(is_thinking)

0 commit comments

Comments
 (0)