Improve pilot chat live traces and remove mock placeholders
This commit is contained in:
@@ -30,6 +30,17 @@ export type AgentReply = {
|
||||
dbWrites?: Array<{ kind: string; detail: string }>;
|
||||
};
|
||||
|
||||
export type AgentTraceEvent = {
|
||||
text: string;
|
||||
toolRun?: {
|
||||
name: string;
|
||||
status: "ok" | "error";
|
||||
input: string;
|
||||
output: string;
|
||||
at: string;
|
||||
};
|
||||
};
|
||||
|
||||
function normalize(s: string) {
|
||||
return s.trim().toLowerCase();
|
||||
}
|
||||
@@ -81,7 +92,12 @@ export async function runCrmAgent(userText: string): Promise<AgentReply> {
|
||||
}
|
||||
|
||||
export async function runCrmAgentFor(
|
||||
input: { teamId: string; userId: string; userText: string },
|
||||
input: {
|
||||
teamId: string;
|
||||
userId: string;
|
||||
userText: string;
|
||||
onTrace?: (event: AgentTraceEvent) => Promise<void> | void;
|
||||
},
|
||||
): Promise<AgentReply> {
|
||||
const mode = (process.env.CF_AGENT_MODE ?? "langgraph").toLowerCase();
|
||||
const llmApiKey =
|
||||
|
||||
Reference in New Issue
Block a user