Remove hard timeouts and fallback paths in chat flow

This commit is contained in:
Ruslan Bakiev
2026-02-20 10:05:33 +07:00
parent d49b00d688
commit b3602d142e
10 changed files with 49 additions and 99 deletions

View File

@@ -9,7 +9,6 @@ type EnqueueBody = {
method?: "POST" | "PUT" | "PATCH";
headers?: Record<string, string>;
payload?: unknown;
timeoutMs?: number;
provider?: string;
channel?: string;
attempts?: number;
@@ -44,7 +43,6 @@ export default defineEventHandler(async (event) => {
method: body?.method ?? "POST",
headers: body?.headers ?? {},
payload: body?.payload ?? {},
timeoutMs: body?.timeoutMs,
provider: body?.provider ?? undefined,
channel: body?.channel ?? undefined,
},

View File

@@ -106,6 +106,20 @@ export default defineEventHandler(async (event) => {
writer.write({ type: "text-end", id: textId });
writer.write({ type: "finish", finishReason: "stop" });
} catch (error: any) {
const errorText = String(error?.message ?? error);
await persistChatMessage({
teamId: auth.teamId,
conversationId: auth.conversationId,
authorUserId: null,
role: "ASSISTANT",
text: errorText,
requestId,
eventType: "assistant",
phase: "error",
transient: false,
});
writer.write({
type: "data-agent-log",
data: {
@@ -118,7 +132,7 @@ export default defineEventHandler(async (event) => {
writer.write({
type: "text-delta",
id: textId,
delta: `Не удалось завершить задачу: ${String(error?.message ?? "unknown error")}`,
delta: errorText,
});
writer.write({ type: "text-end", id: textId });
writer.write({ type: "finish", finishReason: "stop" });