Remove plan from chat payload and UI

This commit is contained in:
Ruslan Bakiev
2026-02-19 06:31:55 +07:00
parent 6156aa482c
commit 39dcfc97c4
4 changed files with 99 additions and 29 deletions

View File

@@ -859,7 +859,6 @@ export async function runLangGraphCrmAgentFor(input: {
tools: [crmTool],
responseFormat: z.object({
answer: z.string().describe("Final assistant answer for the user."),
plan: z.array(z.string()).min(1).max(10).describe("Short plan (3-8 steps)."),
}),
});
@@ -924,7 +923,7 @@ export async function runLangGraphCrmAgentFor(input: {
return String(msg?.type ?? msg?.role ?? msg?.constructor?.name ?? "");
};
const structured = res?.structuredResponse as { answer?: string; plan?: string[] } | undefined;
const structured = res?.structuredResponse as { answer?: string } | undefined;
const fallbackText = (() => {
const messages = Array.isArray(res?.messages) ? res.messages : [];
for (let i = messages.length - 1; i >= 0; i -= 1) {
@@ -945,7 +944,7 @@ export async function runLangGraphCrmAgentFor(input: {
if (!text) {
throw new Error("Model returned empty response");
}
const plan = Array.isArray(structured?.plan) ? structured.plan : [];
const plan: string[] = [];
return {
text,

View File

@@ -225,7 +225,6 @@ async function getChatMessages(auth: AuthContext | null) {
id: m.id,
role: m.role === "USER" ? "user" : m.role === "ASSISTANT" ? "assistant" : "system",
text: m.text,
plan: Array.isArray(debug.steps) ? (debug.steps as string[]) : [],
thinking: Array.isArray(debug.thinking) ? (debug.thinking as string[]) : [],
tools: Array.isArray(debug.tools) ? (debug.tools as string[]) : [],
toolRuns: Array.isArray(debug.toolRuns)
@@ -619,7 +618,6 @@ async function sendPilotMessage(auth: AuthContext | null, textInput: string) {
authorUserId: null,
role: "SYSTEM",
text: event.text,
plan: [],
thinking: [],
tools: event.toolRun ? [event.toolRun.name] : [],
toolRuns: event.toolRun ? [event.toolRun] : [],
@@ -636,7 +634,6 @@ async function sendPilotMessage(auth: AuthContext | null, textInput: string) {
authorUserId: null,
role: "ASSISTANT",
text: reply.text,
plan: reply.plan,
thinking: reply.thinking ?? [],
tools: reply.tools,
toolRuns: reply.toolRuns ?? [],
@@ -657,7 +654,6 @@ async function logPilotNote(auth: AuthContext | null, textInput: string) {
authorUserId: null,
role: "ASSISTANT",
text,
plan: [],
thinking: [],
tools: [],
toolRuns: [],
@@ -747,7 +743,6 @@ export const crmGraphqlSchema = buildSchema(`
id: ID!
role: String!
text: String!
plan: [String!]!
thinking: [String!]!
tools: [String!]!
toolRuns: [PilotToolRun!]!