fix(chat): read messages via /api/ea2/edges/defines instead of /graph

process-definitions/{key}/graph filters to published process definitions
and returns empty for chat-thread flows, so the second persona saw no
message bodies. The raw defines edge endpoint returns the link correctly.
This commit is contained in:
2026-06-14 12:37:33 +04:00
parent fd8c4853df
commit 333667366d
2 changed files with 95 additions and 4 deletions
+4 -4
View File
@@ -88,13 +88,13 @@ export const chatApi = {
return body._key;
},
/** Read every message under a thread via the graph endpoint. */
/** Read every message under a thread via the edges endpoint. */
async listMessages(threadKey: string, signal?: AbortSignal): Promise<ChatMessage[]> {
const res = await jsonFetch(`/api/ea2/process-definitions/${threadKey}/graph`, { signal });
const edges = (res?.edges || []) as any[];
const res = await jsonFetch(`/api/ea2/edges/defines?from=flow/${threadKey}&limit=200`, { signal });
const edges = (res?.items || []) as any[];
const childKeys = edges
.filter((e) => e?.role === "next")
.map((e) => (e.to_id || e._to || "").split("/").pop())
.map((e) => (e._to || "").split("/").pop())
.filter(Boolean) as string[];
const messages = await Promise.all(