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:
+4
-4
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user