mirror of
https://github.com/vegu-ai/talemate.git
synced 2026-09-02 03:59:12 +02:00
linting
This commit is contained in:
@@ -99,9 +99,7 @@ class PlanMixin:
|
||||
async def _plan_revise_narrator_content(self, narrator, content: str) -> str:
|
||||
"""Send narrator generated signal so automatic revision can process the content."""
|
||||
emission = NarratorAgentEmission(agent=narrator, response=content)
|
||||
await talemate.emit.async_signals.get("agent.narrator.generated").send(
|
||||
emission
|
||||
)
|
||||
await talemate.emit.async_signals.get("agent.narrator.generated").send(emission)
|
||||
return emission.response
|
||||
|
||||
async def _plan_push_and_emit_block(self, scene, block: dict, narrator) -> int:
|
||||
@@ -153,7 +151,9 @@ class PlanMixin:
|
||||
|
||||
revised = extracted.get("response", [])
|
||||
if not revised:
|
||||
log.warning("expand.critique.no_blocks_returned", fallback="using originals")
|
||||
log.warning(
|
||||
"expand.critique.no_blocks_returned", fallback="using originals"
|
||||
)
|
||||
return blocks
|
||||
|
||||
log.info("expand.critique.done", original=len(blocks), revised=len(revised))
|
||||
@@ -239,18 +239,14 @@ class PlanMixin:
|
||||
|
||||
blocks = extracted.get("response", [])
|
||||
if not blocks:
|
||||
log.warning(
|
||||
"expand.no_blocks", chunk=chunk_num, attempt=attempt
|
||||
)
|
||||
log.warning("expand.no_blocks", chunk=chunk_num, attempt=attempt)
|
||||
continue
|
||||
|
||||
# Validate: check for leaked block tags in content
|
||||
if not has_leaked_tags(blocks):
|
||||
break
|
||||
|
||||
log.warning(
|
||||
"expand.leaked_tags", chunk=chunk_num, attempt=attempt
|
||||
)
|
||||
log.warning("expand.leaked_tags", chunk=chunk_num, attempt=attempt)
|
||||
blocks = []
|
||||
|
||||
if not blocks:
|
||||
|
||||
@@ -30,7 +30,7 @@ from ..test_director_templates import ( # noqa: F401
|
||||
active_context,
|
||||
MockCharacter,
|
||||
)
|
||||
from .conftest import capture_prompt, capture_all_prompts
|
||||
from .conftest import capture_prompt
|
||||
|
||||
AGENT = "director"
|
||||
|
||||
@@ -274,17 +274,26 @@ def _make_test_beats() -> list[Beat]:
|
||||
return [
|
||||
Beat(
|
||||
description="The protagonist discovers the door is locked from the inside.",
|
||||
order=1, tension=0.3, pacing="slow", type="narration",
|
||||
order=1,
|
||||
tension=0.3,
|
||||
pacing="slow",
|
||||
type="narration",
|
||||
characters=["Elena"],
|
||||
),
|
||||
Beat(
|
||||
description="Elena confronts Hero about what happened last night, demanding answers.",
|
||||
order=2, tension=0.5, pacing="moderate", type="dialogue",
|
||||
order=2,
|
||||
tension=0.5,
|
||||
pacing="moderate",
|
||||
type="dialogue",
|
||||
characters=["Elena"],
|
||||
),
|
||||
Beat(
|
||||
description="A sudden noise from the basement forces both characters to investigate together.",
|
||||
order=3, tension=0.7, pacing="fast", type="action",
|
||||
order=3,
|
||||
tension=0.7,
|
||||
pacing="fast",
|
||||
type="action",
|
||||
characters=["Hero", "Elena"],
|
||||
),
|
||||
]
|
||||
@@ -301,6 +310,7 @@ class TestPlanExpandBaselines:
|
||||
|
||||
director = active_context
|
||||
from talemate.instance import AGENTS
|
||||
|
||||
narrator = AGENTS.get("narrator")
|
||||
narrator.agent_type = "narrator"
|
||||
narrator.client = director.client
|
||||
@@ -352,6 +362,7 @@ class TestPlanExpandBaselines:
|
||||
|
||||
director = active_context
|
||||
from talemate.instance import AGENTS
|
||||
|
||||
narrator = AGENTS.get("narrator")
|
||||
narrator.agent_type = "narrator"
|
||||
narrator.client = director.client
|
||||
@@ -408,9 +419,19 @@ class TestPlanExpandBaselines:
|
||||
narrator.content_use_writing_style = False
|
||||
|
||||
blocks = [
|
||||
{"type": "narrator", "content": "The room was dark and cold. A chill ran down her spine."},
|
||||
{"type": "character", "name": "Elena", "content": "She stepped forward, her hands trembling. \"Who's there?\" she whispered."},
|
||||
{"type": "narrator", "content": "A chill ran through the room. The darkness pressed in from all sides."},
|
||||
{
|
||||
"type": "narrator",
|
||||
"content": "The room was dark and cold. A chill ran down her spine.",
|
||||
},
|
||||
{
|
||||
"type": "character",
|
||||
"name": "Elena",
|
||||
"content": 'She stepped forward, her hands trembling. "Who\'s there?" she whispered.',
|
||||
},
|
||||
{
|
||||
"type": "narrator",
|
||||
"content": "A chill ran through the room. The darkness pressed in from all sides.",
|
||||
},
|
||||
]
|
||||
|
||||
director.client.send_prompt = AsyncMock(
|
||||
|
||||
@@ -9,8 +9,7 @@ Tests cover:
|
||||
- Chat creation for generate_arc modes
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import Mock, AsyncMock, patch
|
||||
from unittest.mock import Mock
|
||||
|
||||
from talemate.agents.director.plan.expand import (
|
||||
compute_chunks,
|
||||
@@ -25,7 +24,7 @@ def _make_beats(tensions: list[float]) -> list[Beat]:
|
||||
"""Helper to create Beat objects with given tension values."""
|
||||
return [
|
||||
Beat(
|
||||
description=f"Beat {i+1}",
|
||||
description=f"Beat {i + 1}",
|
||||
order=i + 1,
|
||||
tension=t,
|
||||
pacing="moderate",
|
||||
|
||||
Reference in New Issue
Block a user