Update chat events/transcription flow and container startup fixes
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user