feat(conversations): pre-SDK rows read from canonical messages, implied titles, markdown adopts them by first prompt

This commit is contained in:
hh
2026-08-29 01:44:05 +02:00
parent 0cc2c5291f
commit 0479d7cdda
5 changed files with 145 additions and 6 deletions
+5 -1
View File
@@ -30,7 +30,7 @@ from sqlmodel import col, select
from beaver_gateway.core import audit
from beaver_gateway.core.auth import VALID_SCOPES, hash_token
from beaver_gateway.core.conversations import SEEDS
from beaver_gateway.core.conversations import SEEDS, implied_title
from beaver_gateway.core.kinds import Kind, as_kind
from beaver_gateway.frontends._auth import require_token
from beaver_gateway.frontends._sse import (
@@ -215,10 +215,14 @@ def build_app(runtime: GatewayRuntime, *, memory_root: Path | None = None) -> Fa
limit=query_int(request, "limit", 200),
)
latest = await conversations.queue.latest(cast("int", r.id) for r in rows)
firsts = await conversations.first_user_texts(
cast("int", r.id) for r in rows if not r.title
)
return {
"conversations": [
{
**conversations.public(r),
"title": r.title or implied_title(firsts.get(cast("int", r.id))),
"last_item": _queue_item(latest.get(cast("int", r.id))),
}
for r in rows