From 44fd57780258816b343df5cdb7d1d4cec8a95c34 Mon Sep 17 00:00:00 2001 From: thucpn <thucsh2@gmail.com> Date: Wed, 19 Mar 2025 17:05:50 +0700 Subject: [PATCH] fix: type any for workflow factory --- packages/server/src/types.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/server/src/types.ts b/packages/server/src/types.ts index 9567c41ef..6743a689b 100644 --- a/packages/server/src/types.ts +++ b/packages/server/src/types.ts @@ -6,11 +6,19 @@ import { } from "llamaindex"; import type next from "next"; +/** + * The input for an AgentWorkflow + * userInput is the last message content from the user + * chatHistory is the previous chat history (not including the last message) + */ export type AgentInput = { - userInput: string; // the last message content from the user - chatHistory: ChatMessage[]; // the previous chat history (not including the last message) + userInput: string; + chatHistory: ChatMessage[]; }; +/** + * ServerWorkflow can be either a normal Workflow or an AgentWorkflow + */ export type ServerWorkflow = | Workflow<null, AgentInput, ChatResponseChunk> | AgentWorkflow; @@ -20,7 +28,8 @@ export type ServerWorkflow = * The requestBody parameter is the body from the request, which can be used to customize the workflow per request. */ export type WorkflowFactory = ( - requestBody?: unknown, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + requestBody?: any, ) => Promise<ServerWorkflow> | ServerWorkflow; export type NextAppOptions = Omit<Parameters<typeof next>[0], "dir">; -- GitLab