Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,77 +4,54 @@
:disable-cache: true
:lab-filename: bot.py
:lab: {repository-blob}/main/{lab-filename}
:branch: main


Let's start by getting the project up and running.

If you plan to complete the course using the online IDE, you can skip to link:#explore[Exploring the `src/` folder].
include::../../../../../../shared/courses/codespace/get-started.adoc[]

== Local install

To run the project locally, you need to install the project dependencies.

[TIP]
.Online Labs
====
You can use the buttons on each lesson to complete the code in an Online IDE provided by link:https://gitpod.io[GitPod^].
To use GitPod, you must authenticate with a Github account.

lab::Explore Repository in GitPod[]
[%collapsible]
.Develop on your local machine
====
You will need link:https://nodejs.org/[Node.js] installed and the ability to install packages using `npm`.

=== Node.js

To run the project, you will need Node.js installed locally.
We have designed the project to work with Node.js **v20.11.x0 LTS**.

To install Node.js, follow the link:https://nodejs.org/[installation steps on nodejs.org^].
The project was created using Node.js **v20.11.x0 LTS**.

You can verify your Node.js version by running the following command.

[source,sh]
.Verify Node.js Version
node --version

Clone the link:{repository-link}[github.com/neo4j-graphacademy/llm-chatbot-typescript] repository:


=== Setting up the Project

The link:https://github.com/neo4j-graphacademy/llm-chatbot-typescript[project is hosted in a Github repository^].

You can use the GitHub UI or CLI to clone the repository or link:https://github.com/neo4j-graphacademy/llm-chatbot-typescript/archive/refs/heads/main.zip[download a ZIP archive^].
We recommend https://github.com/neo4j-graphacademy/llm-chatbot-typescript/fork[forking the repository] so you have a personal copy for future reference.

To clone the repository using the `git` CLI, you can run the following command.

[source,sh]
[source,bash]
.Clone the Repository
----
git clone https://github.com/neo4j-graphacademy/llm-chatbot-typescript
----

=== Installing Dependencies

You can review the dependencies required to run the project in the link:{repository-blob}/main/package.json[`package.json`] file in the project root.
[TIP]
.Fork the repository
You can https://github.com/neo4j-graphacademy/llm-chatbot-typescript/fork[fork the repository] and have a copy for future reference.

Run the `npm install` command to install the dependencies.

[source,sh]
.Install Depencencies
cd llm-chatbot-typescript
npm install --include=dev
====


=== Setting Environment Variables
== Setup the environment

To connect to Neo4j, you must set your Neo4j Sandbox credentials as environment variables.

To set environment variables in a Next.js application, you can create a `.env.local` file.
You can link:https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables[read more about Next.js Environment Variables in the Next.js documentation^].

We have included an example `.env.example` file in the project root with the variables you must set to use Neo4j and OpenAI.

Copy the `.env.example` file to `.env.local` and append the following variables:
Copy the `.env.example` file to `.env.local` and update the Neo4j connection settings:

.env.local
[source,env,subs="attributes+"]
Expand All @@ -99,11 +76,10 @@ OPENAI_API_KEY="sk-..."
.Keep your secrets safe
====
Never share your API keys.
We have added the `.env.local` file to `.gitignore` so the contents are not unintentionally committed to Github.
The `.env.local` file has been added to `.gitignore` so the contents are not unintentionally committed to Github.
====


=== Starting the App
== Start the Application

To start the app, run the `npm run dev` command.

Expand All @@ -125,7 +101,7 @@ The app will display any messages returned by the API to the left of the screen.
[#explore]
== Exploring the `src/` folder

We have purposely kept the code simple so you can focus on the LLM integration.
The code is purposely simple so you can focus on the LLM integration.

The `app/` folder contains the general application code, plus some custom CSS.
The `components/` folder contains React components that display the chat interface, including the form, message, and a _thinking_ indicator.
Expand Down