MoonEnergy is a fictitious company selling moon energy and this solution contains an example AI Chatbot.
- Chat interface for interacting with OpenAI's API.
- Ability to get weather information. 'What's the weather in Amsterdam?'
- Manage user information such as "Installment amount" or "Termijnbedrag". Examples: 'What is my installment amount?', 'Wat is mijn termijnbedrag', 'Change my installment amount' or 'Wijzig mijn termijnbdrag'
- Backend REST API services for handling chat functionality.
- Render json as part of the response.
- Obtain your Open AI API key (see Configuration)
- Start both projects and frontend app
- When prompted to login use alice:alice or bob:bob as credentials. (can be changed in MoonEnergy.Sso/Pages/TestUsers.cs)
- .NET 8.0 SDK
- Node.js (for frontend development)
- OpenAI API Key
-
Clone the repository:
git clone https://github.com/your-repository.git cd your-repository/src/MoonEnergy/MoonEnergy
-
Install frontend dependencies:
cd clientapp npm install
-
Restore backend dependencies:
cd .. dotnet restore
-
OpenAI API Key:
To integrate with OpenAI, you will need an API key. Follow these steps to obtain it:
- Go to OpenAI's API.
- Sign up for an account or log in if you already have one.
- Navigate to the API keys section in your account settings.
- Create a new API key.
- Copy the API key and paste it into your project's configuration file or environment variables.
-
Configure API Key:
Add the OpenAI API key to your
appsettings.json
or betterappsettings.local.json
file:{ "OpenAI": { "ApiKey": "your_openai_api_key_here" } }
-
Run the backend:
dotnet run
The backend server will start running on
https://localhost:5001
or another URL specified in your configuration. -
Run the frontend:
cd clientapp npm run dev
The frontend development server will start, typically on
http://localhost:5173
.
To build the application for production:
-
Build the backend:
dotnet build --configuration Release
-
Build the frontend:
cd clientapp npm run build