fix(telegram,core): no draft for seed turns

This commit is contained in:
hh
2026-08-28 18:59:00 +02:00
parent 43407016d0
commit 38986cb82e
3 changed files with 10 additions and 2 deletions
+6 -1
View File
@@ -779,6 +779,7 @@ class Conversations:
use_session: bool = True,
tools: bool = True,
turn_id: str | None = None,
item_origin: str | None = None,
) -> AsyncIterator[MessageStreamEvent]:
"""Run one turn on ``conv`` under its lock; the only path to the backend.
@@ -799,6 +800,7 @@ class Conversations:
conversation_id=conv.external_id,
turn_id=turn_id,
origin=origin,
item_origin=item_origin,
)
stop = "error"
try:
@@ -825,6 +827,7 @@ class Conversations:
conversation_id=conv.external_id,
turn_id=turn_id,
origin=origin,
item_origin=item_origin,
stop=stop,
usage=_usage_dict(capture),
)
@@ -837,6 +840,7 @@ class Conversations:
origin: str,
tools: bool = True,
turn_id: str | None = None,
item_origin: str | None = None,
) -> tuple[str, TurnCapture]:
capture = TurnCapture()
acc = StreamAccumulator()
@@ -848,6 +852,7 @@ class Conversations:
capture=capture,
tools=tools,
turn_id=turn_id,
item_origin=item_origin,
):
acc.feed(event)
message = acc.finalize(model=agent.model)
@@ -1062,7 +1067,7 @@ class Conversations:
prompt = "\n\n".join(f"{inject_header(i.origin)}\n{i.text}" for i in batch)
try:
text, capture = await self.run_text_turn(
conv, prompt, origin=origin, turn_id=turn_id
conv, prompt, origin=origin, turn_id=turn_id, item_origin=head.origin
)
except Exception: # noqa: BLE001
_log.exception("turn %s on %s failed", turn_id, conv.external_id)
@@ -648,7 +648,9 @@ class TelegramFrontend(Frontend):
return
match kind:
case "turn.start":
if event.get("origin") == "user":
if event.get("origin") == "user" and not str(
event.get("item_origin") or ""
).startswith("сид"):
await self._open_draft(key, event, target)
case "stream":
self._feed_draft(key, event)