🔧 Initial dev copy from live
This commit is contained in:
35
tests/test_title_sanitization.py
Normal file
35
tests/test_title_sanitization.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import unittest
|
||||
|
||||
from api.streaming import _first_exchange_snippets, _sanitize_generated_title
|
||||
|
||||
|
||||
class TestGeneratedTitleSanitization(unittest.TestCase):
|
||||
def test_strips_session_title_markdown_prefix(self):
|
||||
self.assertEqual(
|
||||
_sanitize_generated_title("**Session Title:** Clarifying Topic for Discussion"),
|
||||
"Clarifying Topic for Discussion",
|
||||
)
|
||||
|
||||
def test_strips_plain_title_prefix(self):
|
||||
self.assertEqual(
|
||||
_sanitize_generated_title("Title: Clarifying Topic for Discussion"),
|
||||
"Clarifying Topic for Discussion",
|
||||
)
|
||||
|
||||
def test_strips_wrapping_markdown_emphasis(self):
|
||||
self.assertEqual(
|
||||
_sanitize_generated_title("**Clarifying Topic for Discussion**"),
|
||||
"Clarifying Topic for Discussion",
|
||||
)
|
||||
|
||||
def test_first_exchange_skips_empty_assistant_tool_call_placeholder(self):
|
||||
messages = [
|
||||
{"role": "user", "content": "What time is it in San Francisco?"},
|
||||
{"role": "assistant", "content": "", "tool_calls": [{"id": "call_1"}]},
|
||||
{"role": "tool", "content": "tool output", "tool_call_id": "call_1"},
|
||||
{"role": "assistant", "content": "It is 6:16 PM in San Francisco."},
|
||||
]
|
||||
self.assertEqual(
|
||||
_first_exchange_snippets(messages),
|
||||
("What time is it in San Francisco?", "It is 6:16 PM in San Francisco."),
|
||||
)
|
||||
Reference in New Issue
Block a user