Skip to content

Commit e3a90f6

Browse files
authored
Merge branch 'main' into update_main_readme
2 parents e05f917 + f7433f6 commit e3a90f6

File tree

178 files changed

+28222
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+28222
-0
lines changed

.github/workflows/actionlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ jobs:
4040
VALIDATE_TERRAFORM_TFLINT: true
4141
VALIDATE_YAML: true
4242
VALIDATE_PYTHON_PYLINT: true
43+
VALIDATE_TYPESCRIPT_ES: true
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
NEXT_PUBLIC_LOGIN_PROVIDER=cognito
2+
NEXT_PUBLIC_KNOWLEDGE_BASE_ID=YOUR_KNOWLEDGE_BASE_ID
3+
NEXT_PUBLIC_AWS_USER_POOLS_ID=YOUR_AWS_USER_POOLS_ID
4+
NEXT_PUBLIC_AWS_USER_WEB_CLIENT_ID=YOUR_AWS_USER_WEB_CLIENT_ID
5+
6+
# NEXT_PUBLIC_LOGIN_PROVIDER=clerk
7+
# NEXT_PUBLIC_KNOWLEDGE_BASE_ID=YOUR_KNOWLEDGE_BASE_ID
8+
# NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=YOUR_NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
9+
# CLERK_SECRET_KEY=YOUR_CLERK_SECRET_KEY
10+
# NEXT_PUBLIC_CLERK_TEMPLATE=YOUR_CLERK_TEMPLATE
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
dimensions: false,
3+
};
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# NetApp Workload Factory GenAI sample application
2+
3+
## Introduction
4+
The NetApp Workload Factory GenAI sample application enables external application developers to test authentication and retrieval from a published NetApp Workload Factory knowledge base by interacting directly with it in a web-based chatbot application. Its features are similar to the chatbot interface within the NetApp Workload Factory UI, and it uses the same Workload Factory API for conversations. As a developer, you can use this sample application to test published knowledge bases and see API examples that can help you develop your own chatbot application.
5+
6+
## Application components
7+
The NetApp Workload Factory GenAI sample application is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
8+
9+
The sample application uses [Redux Toolkit](https://redux-toolkit.js.org) with [RTK Query](https://redux-toolkit.js.org/tutorials/rtk-query) for data fetching.
10+
11+
## Requirements
12+
- [Node.js](https://nodejs.org/) 18.17 or later stable version.
13+
- The NetApp Workload Factory GenAI sample application relies on one of the following login providers:
14+
- [Amazon Cognito](https://aws.amazon.com/cognito/) + [Amazon Amplify Framework](https://aws-amplify.github.io/docs/js/start)
15+
- [Clerk](https://clerk.com/)
16+
- You need a knowledge base created with NetApp Workload Factory GenAI that is configured for active authentication and published:
17+
- [Activate external authentication for a knowledge base](https://docs.netapp.com/us-en/workload-genai/activate-authentication.html)
18+
- [Publish a knowledge base](https://docs.netapp.com/us-en/workload-genai/publish-knowledgebase.html)
19+
- You need the ID of the published knowledge base. You can find the knowledge base ID on the **Knowledge bases > Manage knowledge base** page in Workload Factory GenAI, or you can work with the person that created the knowledge base.
20+
21+
## Set up login providers
22+
To get started, you need to configure one of the supported login providers. Configure the same login provider (issuer) that is used by the knowledge base that will integrate with the sample chatbot application.
23+
24+
### Set up AWS Cognito
25+
1. Follow the [Create user pool](https://www.cognitobuilders.training/20-lab1/20-setup-and-explore/10-create-userpool/) instructions to create a Cognito user pool.
26+
2. Use the Amazon Cognito documentation to find your user pool ID and user web client ID:
27+
1. [Find your user pool ID](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cognito-idp/list-user-pools.html).
28+
For example: `aws cognito-idp list-user-pools --max-results=60 --output=table`
29+
2. [Find your web client ID](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cognito-idp/list-user-pool-clients.html).
30+
For example: `aws cognito-idp list-user-pool-clients --user-pool-id $(USER_POOL_ID) --output=table`
31+
3. Download and unpack the Workload Factory GenAI sample application source package.
32+
4. In the Workload Factory GenAI sample application source, rename the `.env.local.sample` file to `.env.local`.
33+
5. In the `.env.local` file, uncomment the corresponding section for the login provider you plan to use, and make sure the section for the other provider is commented out.
34+
6. In the `.env.local` file, change the following variables in the appropriate provider section to match your environment. Replace `YOUR_KNOWLEDGE_BASE_ID` with the knowledge base ID from Workload Factory:
35+
- NEXT_PUBLIC_LOGIN_PROVIDER=cognito
36+
- NEXT_PUBLIC_KNOWLEDGE_BASE_ID=YOUR_KNOWLEDGE_BASE_ID
37+
- NEXT_PUBLIC_AWS_USER_POOLS_ID=YOUR_AWS_USER_POOLS_ID
38+
- NEXT_PUBLIC_AWS_USER_WEB_CLIENT_ID=YOUR_AWS_USER_WEB_CLIENT_ID
39+
40+
### Set up Clerk
41+
1. Follow the [Sign up](https://dashboard.clerk.com/sign-in?redirect_url=https%3A%2F%2Fdashboard.clerk.com%2F) instructions to sign up for a Clerk account.
42+
2. Download and unpack the Workload Factory GenAI sample application source package.
43+
3. In the Workload Factory GenAI sample application source, rename the `.env.local.sample` file to `.env.local`.
44+
4. In the `.env.local` file, uncomment the corresponding section for the login provider you plan to use, and make sure the section for the other provider is commented out.
45+
5. In the `.env.local` file, change the following variables in the appropriate provider section to match your environment. Replace `YOUR_KNOWLEDGE_BASE_ID` with the knowledge base ID from Workload Factory:
46+
- NEXT_PUBLIC_LOGIN_PROVIDER=clerk
47+
- NEXT_PUBLIC_KNOWLEDGE_BASE_ID=YOUR_KNOWLEDGE_BASE_ID
48+
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=YOUR_NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
49+
- CLERK_SECRET_KEY=YOUR_CLERK_SECRET_KEY
50+
- NEXT_PUBLIC_CLERK_TEMPLATE=YOUR_CLERK_TEMPLATE
51+
52+
## Download the application
53+
To download the application, clone the GitHub repository. Then, change to the sample application directory so that you can build or run it:
54+
55+
1.
56+
```bash
57+
git clone https://github.com/NetApp/FSx-ONTAP-samples-scripts
58+
```
59+
60+
2.
61+
```bash
62+
cd FSx-ONTAP-samples-scripts/AI/GenAI-ChatBot-application-sample
63+
```
64+
65+
## Install dependencies
66+
To install dependencies for the sample application, run the following command:
67+
68+
```bash
69+
npm install
70+
```
71+
72+
## Run the application
73+
1. To run the application locally, run the following command:
74+
75+
```bash
76+
npm run dev
77+
```
78+
79+
2. Open [http://localhost:9091](http://localhost:9091) with your browser to log in to the application.
80+
81+
## Build the application
82+
To build bundle.js, run the following command:
83+
84+
```bash
85+
npm run build
86+
```
87+
88+
## Learn More
89+
90+
- Learn more about [BlueXP Workload Factory for AWS](https://docs.netapp.com/us-en/workload-genai/index.html).
91+
- Learn more about the APIs used in this sample application by visiting the [Workload Factory API documentation](https://console.workloads.netapp.com/api-doc).
92+
- To learn more about Next.js, take a look at the following resources:
93+
- [Next.js documentation](https://nextjs.org/docs) - learn about Next.js features and API.
94+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
95+
96+
## Author Information
97+
98+
This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors).
99+
100+
## License
101+
102+
Licensed under the Apache License, Version 2.0 (the "License").
103+
104+
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).
105+
106+
Unless required by applicable law or agreed to in writing, software distributed under the License
107+
is distributed on an _"AS IS"_ basis, without WARRANTIES or conditions of any kind, either express or implied.
108+
109+
See the License for the specific language governing permissions and limitations under the License.
110+
111+
© 2024 NetApp, Inc. All Rights Reserved.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
webpack(config) {
4+
// Grab the existing rule that handles SVG imports
5+
const fileLoaderRule = config.module.rules.find((rule) =>
6+
rule.test?.test?.('.svg'),
7+
)
8+
9+
config.module.rules.push(
10+
// Reapply the existing rule, but only for svg imports ending in ?url
11+
{
12+
...fileLoaderRule,
13+
test: /\.svg$/i,
14+
resourceQuery: /url/, // *.svg?url
15+
},
16+
// Convert all other *.svg imports to React components
17+
{
18+
test: /\.svg$/i,
19+
issuer: fileLoaderRule.issuer,
20+
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
21+
use: ['@svgr/webpack'],
22+
},
23+
)
24+
25+
// Modify the file loader rule to ignore *.svg, since we have it handled now.
26+
fileLoaderRule.exclude = /\.svg$/i
27+
28+
return config
29+
}
30+
};
31+
32+
export default nextConfig;

0 commit comments

Comments
 (0)