Skip to content

Commit

Permalink
chore: Import nextTick utility function from the correct location in …
Browse files Browse the repository at this point in the history
…chatRequestAPIHandler
  • Loading branch information
n4ze3m committed Jul 13, 2024
1 parent c7ccc45 commit 7ba152e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions server/src/handlers/bot/post.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { DialoqbaseHybridRetrival } from "../../utils/hybrid";
import { Document } from "langchain/document";
import { createChain, groupMessagesByConversation } from "../../chain";
import { getModelInfo } from "../../utils/get-model-info";
import { nextTick } from "../../utils/nextTick";

export const chatRequestHandler = async (
request: FastifyRequest<ChatRequestBody>,
Expand Down Expand Up @@ -142,7 +143,7 @@ export const chatRequestHandler = async (
model: bot.model,
prisma,
type: "chat",
})
});

if (!modelinfo) {
return {
Expand Down Expand Up @@ -254,10 +255,6 @@ export const chatRequestHandler = async (
}
};

export function nextTick() {
return new Promise((resolve) => setTimeout(resolve, 0));
}

export const chatRequestStreamHandler = async (
request: FastifyRequest<ChatRequestBody>,
reply: FastifyReply
Expand Down Expand Up @@ -342,7 +339,7 @@ export const chatRequestStreamHandler = async (
model: bot.embedding,
prisma,
type: "embedding",
})
});

if (!embeddingInfo) {
return {
Expand Down Expand Up @@ -415,7 +412,7 @@ export const chatRequestStreamHandler = async (
model: bot.model,
prisma,
type: "chat",
})
});

if (!modelinfo) {
reply.raw.setHeader("Content-Type", "text/event-stream");
Expand Down

0 comments on commit 7ba152e

Please sign in to comment.