From 848beb11dfe0fb50b056b0fbb9fce2545080c846 Mon Sep 17 00:00:00 2001 From: utin-francis-peter Date: Mon, 14 Oct 2024 12:33:56 +0100 Subject: [PATCH] chore: corrected typo in var declaration --- extensions/react-widget/src/requests/streamingApi.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extensions/react-widget/src/requests/streamingApi.ts b/extensions/react-widget/src/requests/streamingApi.ts index 9cb9fddc..d5f79fe1 100644 --- a/extensions/react-widget/src/requests/streamingApi.ts +++ b/extensions/react-widget/src/requests/streamingApi.ts @@ -1,8 +1,10 @@ import { FEEDBACK } from "@/types"; + interface HistoryItem { prompt: string; response?: string; } + interface FetchAnswerStreamingProps { question?: string; apiKey?: string; @@ -12,12 +14,14 @@ interface FetchAnswerStreamingProps { apiHost?: string; onEvent?: (event: MessageEvent) => void; } + interface FeedbackPayload { question: string; answer: string; apikey: string; feedback: FEEDBACK; } + export function fetchAnswerStreaming({ question = '', apiKey = '', @@ -46,7 +50,7 @@ export function fetchAnswerStreaming({ const reader = response.body.getReader(); const decoder = new TextDecoder('utf-8'); - let counterrr = 0; + let counter = 0; const processStream = ({ done, value, @@ -56,7 +60,7 @@ export function fetchAnswerStreaming({ return; } - counterrr += 1; + counter += 1; const chunk = decoder.decode(value);