This is a LlamaIndex project using Next.js that is ejected from llamaindex-server via npm eject command.
npm install
npm run devOpen http://localhost:3000 with your browser to see the result.
The same as llamaindex-server, you can customize the application via .env file.
Here's the examples of how to migrate from LlamaIndexServer configs to Next.js project:
// src/index.ts
new LlamaIndexServer({
workflow: workflowFactory,
suggestNextQuestions: true,
uiConfig: {
devMode: true,
llamaCloudIndexSelector: true,
starterQuestions: ["Summarize the document", "What are the key points?"],
componentsDir: "components",
layoutDir: "layout",
},
}).start();.env file:
SUGGEST_NEXT_QUESTIONS=true # Whether to suggest next questions (`suggestNextQuestions`)
COMPONENTS_DIR=components # Directory for custom components (`componentsDir`)
NEXT_PUBLIC_DEV_MODE=true # Whether to enable dev mode (`devMode`)
NEXT_PUBLIC_STARTER_QUESTIONS=[] # Initial questions to display in the chat (`starterQuestions`)
NEXT_PUBLIC_SHOW_LLAMACLOUD_SELECTOR=true # Whether to show LlamaCloud selector for frontend (`llamaCloudIndexSelector`)
NEXT_PUBLIC_USE_COMPONENTS_DIR=true # Whether to use components directory for frontend
For customizing layout, you can directly edit the layout files in the generated nextjs project (app/components/ui/chat/layout).
- Generate Datasource (in case having
./datafolder):npm run generate - Typecheck:
npm run typecheck - Lint:
npm run lint - Format:
npm run format - Build & Start:
npm run build && npm run start
To learn more about LlamaIndex, take a look at the following resources:
- LlamaIndex Documentation - learn about LlamaIndex (Python features).
- LlamaIndexTS Documentation - learn about LlamaIndex (Typescript features).
You can check out the LlamaIndexTS GitHub repository - your feedback and contributions are welcome!