Merge branch 'main' into main

This commit is contained in:
Sheng Fan
2024-04-08 16:51:00 +08:00
committed by GitHub
28 changed files with 1758 additions and 177 deletions

View File

@@ -44,6 +44,7 @@ export interface RequestMessage {
}
export interface RequestBody {
chatSessionId: string;
messages: RequestMessage[];
isAzure: boolean;
azureApiVersion?: string;

View File

@@ -44,6 +44,13 @@ async function handle(req: NextRequest) {
},
{ basePath: baseUrl },
);
const ragEmbeddings = new OpenAIEmbeddings(
{
modelName: process.env.RAG_EMBEDDING_MODEL ?? "text-embedding-3-large",
openAIApiKey: apiKey,
},
{ basePath: baseUrl },
);
var dalleCallback = async (data: string) => {
var response = new ResponseBody();
@@ -62,6 +69,8 @@ async function handle(req: NextRequest) {
baseUrl,
model,
embeddings,
reqBody.chatSessionId,
ragEmbeddings,
dalleCallback,
);
var nodejsTools = await nodejsTool.getCustomTools();