File tree Expand file tree Collapse file tree 6 files changed +13
-15
lines changed Expand file tree Collapse file tree 6 files changed +13
-15
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " create-llama " : patch
3+ ---
4+
5+ Generate NEXT_PUBLIC_CHAT_API for NextJS backend to specify alternative backend
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import { configVSCode } from "./helpers/vscode";
1616
1717export type InstallAppArgs = Omit <
1818 InstallTemplateArgs ,
19- "appName" | "root" | "isOnline" | "customApiPath "
19+ "appName" | "root" | "isOnline" | "port "
2020> & {
2121 appPath : string ;
2222 frontend : boolean ;
@@ -34,7 +34,6 @@ export async function createApp({
3434 communityProjectConfig,
3535 llamapack,
3636 vectorDb,
37- port,
3837 postInstallAction,
3938 dataSources,
4039 tools,
@@ -80,7 +79,6 @@ export async function createApp({
8079 communityProjectConfig,
8180 llamapack,
8281 vectorDb,
83- port,
8482 postInstallAction,
8583 dataSources,
8684 tools,
@@ -100,7 +98,6 @@ export async function createApp({
10098 ...args ,
10199 root : frontendRoot ,
102100 framework : "nextjs" ,
103- customApiPath : `http://localhost:${ port ?? 8000 } /api/chat` ,
104101 backend : false ,
105102 } ) ;
106103 }
Original file line number Diff line number Diff line change @@ -407,6 +407,13 @@ const getFrameworkEnvs = (
407407 ] ,
408408 ) ;
409409 }
410+ if ( framework === "nextjs" ) {
411+ result . push ( {
412+ name : "NEXT_PUBLIC_CHAT_API" ,
413+ description :
414+ "The API for the chat endpoint. Set when using a custom backend (e.g. Express). Use full URL like http://localhost:8000/api/chat" ,
415+ } ) ;
416+ }
410417 return result ;
411418} ;
412419
@@ -585,18 +592,10 @@ export const createBackendEnvFile = async (
585592export const createFrontendEnvFile = async (
586593 root : string ,
587594 opts : {
588- customApiPath ?: string ;
589595 vectorDb ?: TemplateVectorDB ;
590596 } ,
591597) => {
592598 const defaultFrontendEnvs = [
593- {
594- name : "NEXT_PUBLIC_CHAT_API" ,
595- description : "The backend API for chat endpoint." ,
596- value : opts . customApiPath
597- ? opts . customApiPath
598- : "http://localhost:8000/api/chat" ,
599- } ,
600599 {
601600 name : "NEXT_PUBLIC_USE_LLAMACLOUD" ,
602601 description : "Let's the user change indexes in LlamaCloud projects" ,
Original file line number Diff line number Diff line change @@ -225,7 +225,6 @@ export const installTemplate = async (
225225 } else {
226226 // this is a frontend for a full-stack app, create .env file with model information
227227 await createFrontendEnvFile ( props . root , {
228- customApiPath : props . customApiPath ,
229228 vectorDb : props . vectorDb ,
230229 } ) ;
231230 }
Original file line number Diff line number Diff line change @@ -89,7 +89,6 @@ export interface InstallTemplateArgs {
8989 framework : TemplateFramework ;
9090 ui : TemplateUI ;
9191 dataSources : TemplateDataSource [ ] ;
92- customApiPath ?: string ;
9392 modelConfig : ModelConfig ;
9493 llamaCloudKey ?: string ;
9594 useLlamaParse ?: boolean ;
Original file line number Diff line number Diff line change @@ -326,7 +326,6 @@ async function run(): Promise<void> {
326326 ...answers ,
327327 appPath : resolvedProjectPath ,
328328 packageManager,
329- port : options . port ,
330329 } ) ;
331330
332331 if ( answers . postInstallAction === "VSCode" ) {
You can’t perform that action at this time.
0 commit comments