Skip to content

Commit

Permalink
feat: add llamacloud config api for express
Browse files Browse the repository at this point in the history
  • Loading branch information
thucpn committed Aug 2, 2024
1 parent 9efbc61 commit 77ad309
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Request, Response } from "express";
import { LLamaCloudFileService } from "./llamaindex/streaming/service";

export const chatConfig = async (_req: Request, res: Response) => {
let starterQuestions = undefined;
Expand All @@ -12,3 +13,10 @@ export const chatConfig = async (_req: Request, res: Response) => {
starterQuestions,
});
};

export const chatLlamaCloudConfig = async (_req: Request, res: Response) => {
const config = {
projects: await LLamaCloudFileService.getAllProjectsWithPipelines(),
};
return res.status(200).json(config);
};
6 changes: 5 additions & 1 deletion templates/types/streaming/express/src/routes/chat.route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import express, { Router } from "express";
import { chatConfig } from "../controllers/chat-config.controller";
import {
chatConfig,
chatLlamaCloudConfig,
} from "../controllers/chat-config.controller";
import { chatRequest } from "../controllers/chat-request.controller";
import { chatUpload } from "../controllers/chat-upload.controller";
import { chat } from "../controllers/chat.controller";
Expand All @@ -11,6 +14,7 @@ initSettings();
llmRouter.route("/").post(chat);
llmRouter.route("/request").post(chatRequest);
llmRouter.route("/config").get(chatConfig);
llmRouter.route("/config/llamacloud").get(chatLlamaCloudConfig);
llmRouter.route("/upload").post(chatUpload);

export default llmRouter;

0 comments on commit 77ad309

Please sign in to comment.