From b3602d142e50cafcbf4d706a1d843030303423b0 Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Fri, 20 Feb 2026 10:05:33 +0700 Subject: [PATCH] Remove hard timeouts and fallback paths in chat flow --- Frontend/app.vue | 36 +++++------- Frontend/scripts/compose-dev.sh | 2 +- Frontend/scripts/compose-worker.sh | 2 +- Frontend/server/agent/crmAgent.ts | 2 +- Frontend/server/agent/langgraphCrmAgent.ts | 56 ++++++------------- .../server/api/omni/delivery/enqueue.post.ts | 2 - Frontend/server/api/pilot-chat.post.ts | 16 +++++- Frontend/server/graphql/schema.ts | 10 ---- Frontend/server/queues/outboundDelivery.ts | 3 - Frontend/server/utils/auth.ts | 19 +------ 10 files changed, 49 insertions(+), 99 deletions(-) diff --git a/Frontend/app.vue b/Frontend/app.vue index 5057c3b..cdf8af1 100644 --- a/Frontend/app.vue +++ b/Frontend/app.vue @@ -361,7 +361,6 @@ let pilotWaveRecordPlugin: any = null; let pilotWaveMicSession: { onDestroy: () => void; onEnd: () => void } | null = null; const commCallWaveHosts = new Map(); const commCallWaveSurfers = new Map(); -const FALLBACK_CALL_AUDIO_URL = "/audio-samples/national-road-9.m4a"; const callTranscriptOpen = ref>({}); const callTranscriptLoading = ref>({}); const callTranscriptText = ref>({}); @@ -731,23 +730,15 @@ async function sendPilotText(rawText: string) { const text = rawText.trim(); if (!text || pilotSending.value) return; - const sendTimeoutMs = 45000; pilotSending.value = true; pilotInput.value = ""; livePilotUserText.value = text; livePilotAssistantText.value = ""; pilotLiveLogs.value = []; try { - await Promise.race([ - pilotChat.sendMessage({ text }), - new Promise((_, reject) => { - setTimeout(() => reject(new Error("pilot_send_timeout")), sendTimeoutMs); - }), - ]); - } catch (error: any) { - if (error?.message !== "pilot_send_timeout") { - pilotInput.value = text; - } + await pilotChat.sendMessage({ text }); + } catch { + pilotInput.value = text; } finally { const latestAssistant = [...pilotChat.messages] .reverse() @@ -840,8 +831,7 @@ function buildCallWavePeaks(item: CommItem, size = 320) { } function getCallAudioUrl(item?: CommItem) { - const direct = String(item?.audioUrl ?? "").trim(); - return direct || FALLBACK_CALL_AUDIO_URL; + return String(item?.audioUrl ?? "").trim(); } async function ensureCommCallWave(itemId: string) { @@ -1688,7 +1678,7 @@ const selectedCommThread = computed(() => commThreads.value.find((thread) => thread.id === selectedCommThreadId.value), ); -const commSendChannel = ref("Telegram"); +const commSendChannel = ref(""); const commPinnedOnly = ref(false); const commDraft = ref(""); const commSending = ref(false); @@ -1735,14 +1725,14 @@ watch(selectedCommThreadId, () => { eventArchiveRecordingById.value = {}; eventArchiveTranscribingById.value = {}; eventArchiveMicErrorById.value = {}; - const fallback = selectedCommThread.value?.channels.find((channel) => channel !== "Phone") ?? "Telegram"; - commSendChannel.value = fallback; + const preferred = selectedCommThread.value?.channels.find((channel) => channel !== "Phone") ?? ""; + commSendChannel.value = preferred; }); const commSendChannelOptions = computed(() => { - if (!selectedCommThread.value) return ["Telegram"]; + if (!selectedCommThread.value) return []; const items = selectedCommThread.value.channels.filter((channel) => channel !== "Phone"); - return items.length ? items : ["Telegram"]; + return items; }); const visibleThreadItems = computed(() => { @@ -2468,8 +2458,8 @@ async function sendCommMessage() { commSending.value = true; try { - const fallback = selectedCommThread.value.channels.find((channel) => channel !== "Phone") ?? "Telegram"; - const channel = commSendChannel.value || fallback; + const channel = commSendChannel.value; + if (!channel) return; await gqlFetch<{ createCommunication: { ok: boolean; id: string } }>(createCommunicationMutation, { input: { @@ -3758,7 +3748,7 @@ async function decideFeedCard(card: FeedCard, decision: "accepted" | "rejected") :disabled="commSending" :title="`Channel: ${commSendChannel}`" > - {{ commSendChannel }} + {{ commSendChannel || "Channel" }} @@ -3799,7 +3789,7 @@ async function decideFeedCard(card: FeedCard, decision: "accepted" | "rejected")