Update chat events/transcription flow and container startup fixes

This commit is contained in:
Ruslan Bakiev
2026-02-19 12:54:16 +07:00
parent 7cc86579b2
commit 3ac487c25b
27 changed files with 3888 additions and 780 deletions

View File

@@ -97,6 +97,8 @@ export async function runCrmAgentFor(
teamId: string;
userId: string;
userText: string;
requestId?: string;
conversationId?: string;
onTrace?: (event: AgentTraceEvent) => Promise<void> | void;
},
): Promise<AgentReply> {
@@ -246,29 +248,23 @@ export async function persistChatMessage(input: {
at: string;
}>;
changeSet?: ChangeSet | null;
requestId?: string;
eventType?: "user" | "trace" | "assistant" | "note";
phase?: "pending" | "running" | "final" | "error";
transient?: boolean;
teamId: string;
conversationId: string;
authorUserId?: string | null;
}) {
const hasDebugPayload = Boolean(
(input.plan && input.plan.length) ||
(input.tools && input.tools.length) ||
(input.thinking && input.thinking.length) ||
(input.toolRuns && input.toolRuns.length) ||
input.changeSet,
);
const hasStoredPayload = Boolean(input.changeSet);
const data: Prisma.ChatMessageCreateInput = {
team: { connect: { id: input.teamId } },
conversation: { connect: { id: input.conversationId } },
authorUser: input.authorUserId ? { connect: { id: input.authorUserId } } : undefined,
role: input.role,
text: input.text,
planJson: hasDebugPayload
planJson: hasStoredPayload
? ({
steps: input.plan ?? [],
tools: input.tools ?? [],
thinking: input.thinking ?? input.plan ?? [],
toolRuns: input.toolRuns ?? [],
changeSet: input.changeSet ?? null,
} as any)
: undefined,