mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-05-04 22:30:38 +00:00
fix: detect Claude Code 2.1+ session title requests for optimization skip
Expand is_title_generation_request to match sentence-case/JSON title prompts in addition to legacy new-conversation-topic copy. Add unit test for the current session-title system text shape.
This commit is contained in:
parent
2df42c1846
commit
080ebefc7b
2 changed files with 28 additions and 1 deletions
|
|
@ -151,6 +151,20 @@ class TestTitleGenerationRequest:
|
|||
|
||||
assert is_title_generation_request(req) is False
|
||||
|
||||
def test_title_generation_claude_code_session_title_prompt(self):
|
||||
"""Claude Code 2.1+ session title JSON (sentence-case) is detected."""
|
||||
block = MagicMock()
|
||||
block.text = (
|
||||
"Generate a concise, sentence-case title (3-7 words) that captures the "
|
||||
"main topic or goal of this coding session. Return JSON with a single "
|
||||
'"title" field.'
|
||||
)
|
||||
req = MagicMock(spec=MessagesRequest)
|
||||
req.system = [block]
|
||||
req.tools = None
|
||||
|
||||
assert is_title_generation_request(req) is True
|
||||
|
||||
|
||||
class TestExtractCommandPrefix:
|
||||
"""Tests for extract_command_prefix function."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue