Skip to content

Commit

Permalink
remove uneeded console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanniasingheTT committed Jan 24, 2025
1 parent c7d3cb9 commit 626eea8
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions app/frontend/src/components/chatui/runInference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ export const runInference = async (
console.log("Response received. Status:", response.status);
console.log("Response headers:", response.headers);

console.log("Testing response object: ", response);
const reader = response.body?.getReader();
console.log("Testing this: ", reader);
const decoder = new TextDecoder("utf-8");
let buffer = "";
let accumulatedText = "";
Expand All @@ -99,25 +97,19 @@ export const runInference = async (
// eslint-disable-next-line no-constant-condition
while (true) {
const { done, value } = await reader.read();
console.log("Value: ", value)

if (done) {
console.log("Stream complete");
break;
}

buffer += decoder.decode(value, { stream: true });
console.log("Buffer: ", buffer)
const lines = buffer.split("\n");
buffer = lines.pop() || "";
console.log("Popped Buffer: ", buffer);
console.log("Lines: ", lines);

for (const line of lines) {
const trimmedLine = line.trim();
console.log("Trimmed Line works")
if (trimmedLine.startsWith("data: ")) {
console.log("data: works")
if (trimmedLine === "data: [DONE]") {
console.log("Received [DONE] signal");
continue;
Expand Down Expand Up @@ -147,7 +139,6 @@ export const runInference = async (
}
// Handle the generated text
const content = jsonData.choices[0]?.delta?.content || "";
console.log(content)
if (content) {
accumulatedText += content;
setChatHistory((prevHistory) => {
Expand Down

0 comments on commit 626eea8

Please sign in to comment.