Skip to content

Commit

Permalink
fix: add missing env value; improve docs and error message (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
leehuwuj authored Mar 13, 2024
1 parent 20206bc commit d919422
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions create-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ export async function createApp({
await installTemplate({ ...args, backend: true });
}

await writeDevcontainer(root, templatesDir, framework, frontend);

process.chdir(root);
if (tryGitInit(root)) {
console.log("Initialized a git repository.");
console.log();
}

await writeDevcontainer(root, templatesDir, framework, frontend);

if (toolsRequireConfig(tools)) {
console.log(
yellow(
Expand Down
1 change: 1 addition & 0 deletions helpers/env-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ Given this information, please answer the question: {query_str}
name: "NEXT_PUBLIC_MODEL",
description:
"The LLM model to use (hardcode to front-end artifact).",
value: opts.model || "gpt-3.5-turbo",
}
: {},
],
Expand Down
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ Got error: ${(error as Error).message}.\n`,
),
);
console.log(
`Make sure you have VSCode installed and added to your PATH.
`Make sure you have VSCode installed and added to your PATH (shell alias will not work).
Please check ${cyan(
terminalLink(
"This documentation",
Expand Down
6 changes: 4 additions & 2 deletions templates/types/simple/fastapi/README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ This is a [LlamaIndex](https://www.llamaindex.ai/) project using [FastAPI](https

## Getting Started

First, setup the environment:
First, setup the environment with poetry:

> **_Note:_** This step is not needed if you are using the dev-container.
```
poetry install
Expand Down Expand Up @@ -44,7 +46,7 @@ Open [http://localhost:8000/docs](http://localhost:8000/docs) with your browser
The API allows CORS for all origins to simplify development. You can change this behavior by setting the `ENVIRONMENT` environment variable to `prod`:

```
ENVIRONMENT=prod uvicorn main:app
ENVIRONMENT=prod python main.py
```

## Learn More
Expand Down
3 changes: 2 additions & 1 deletion templates/types/simple/fastapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
if __name__ == "__main__":
app_host = os.getenv("APP_HOST", "0.0.0.0")
app_port = int(os.getenv("APP_PORT", "8000"))
reload = True if environment == "dev" else False

uvicorn.run(app="main:app", host=app_host, port=app_port, reload=True)
uvicorn.run(app="main:app", host=app_host, port=app_port, reload=reload)
6 changes: 4 additions & 2 deletions templates/types/streaming/fastapi/README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ This is a [LlamaIndex](https://www.llamaindex.ai/) project using [FastAPI](https

## Getting Started

First, setup the environment:
First, setup the environment with poetry:

> **_Note:_** This step is not needed if you are using the dev-container.
```
poetry install
Expand Down Expand Up @@ -44,7 +46,7 @@ Open [http://localhost:8000/docs](http://localhost:8000/docs) with your browser
The API allows CORS for all origins to simplify development. You can change this behavior by setting the `ENVIRONMENT` environment variable to `prod`:

```
ENVIRONMENT=prod uvicorn main:app
ENVIRONMENT=prod python main.py
```

## Learn More
Expand Down
3 changes: 2 additions & 1 deletion templates/types/streaming/fastapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
if __name__ == "__main__":
app_host = os.getenv("APP_HOST", "0.0.0.0")
app_port = int(os.getenv("APP_PORT", "8000"))
reload = True if environment == "dev" else False

uvicorn.run(app="main:app", host=app_host, port=app_port, reload=True)
uvicorn.run(app="main:app", host=app_host, port=app_port, reload=reload)

0 comments on commit d919422

Please sign in to comment.