Skip to content

Commit 3155d27

Browse files
authored
Merge pull request #66 from elastic/workplace-ui
Workplace UI
2 parents f136211 + bb847db commit 3155d27

File tree

94 files changed

+1501
-1792
lines changed

Some content is hidden

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

94 files changed

+1501
-1792
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# osx
2-
2+
.idea
33
.DS_Store

example-apps/workplace-search/README.md

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,26 @@ curl https://codeload.github.com/elastic/elasticsearch-labs/tar.gz/main | \
1313
tar -xz --strip=2 elasticsearch-labs-main/example-apps/workplace-search
1414
```
1515

16-
## 2. Index Data
16+
## 2. Credentials
1717

18-
You can index the data from the provided .json files by following the [README](./example-data/README.md) instructions in the `example-data` folder. At the moment indexing your own data should be possible. The UI will attempt to use the URL in the data file for the HTML link to the source.
18+
This app requires the following environment variables to be set:
1919

20-
### Loading your own data
21-
22-
See the [medicare](./example-data/README.md#loading-custom-data) example in the example-data folder for loding your own data.
23-
24-
## 3. Credentials
25-
26-
Requires the following environment variables to be set. This can be done by creating a `.env` file in the `/api` directory of the project.
27-
28-
### Setup with OpenAI
20+
```sh
21+
export ELASTIC_CLOUD_ID=...
22+
export ELASTIC_USERNAME=...
23+
export ELASTIC_PASSWORD=...
24+
export OPENAI_API_KEY=...
25+
```
2926

30-
You can get your OpenAI key from the [OpenAI dashboard](https://platform.openai.com/account/api-keys).
27+
Note: you can get your OpenAI key from the [OpenAI dashboard](https://platform.openai.com/account/api-keys).
3128

32-
```
33-
openai_type=openai
34-
openai_api_model="gpt-3.5-turbo-0613"
35-
openai_api_key=<your-openai-key>
36-
cloud_id=<elasticsearch-cloud-id>
37-
cloud_pass=<elasticsearch-password>
38-
cloud_user=<elasticsearch-user>
39-
```
4029

41-
### Setup with Azure OpenAI Credentials
30+
## 3. Index Data
4231

43-
You can get your Azure OpenAI key from the [Azure OpenAI dashboard](https://ms.portal.azure.com/#blade/Microsoft_Azure_Marketplace/GalleryFeaturedMenuItemBlade/selectedMenuItemId/home/searchQuery/openai/resetMenuId/).
32+
You can index the data from the provided .json files in the `data` folder:
4433

45-
```
46-
openai_type=azure
47-
openai_api_key=<your openai api key>
48-
openai_api_type=azure
49-
openai_api_base=<your openai api base url>
50-
openai_api_version=2023-03-15-preview
51-
openai_api_engine=<your openai api engine>
52-
cloud_id=<elasticsearch-cloud-id>
53-
cloud_pass=<elasticsearch-password>
54-
cloud_user=<elasticsearch-user>
34+
```sh
35+
python data/index-data.py
5536
```
5637

5738
## Developing
@@ -65,18 +46,33 @@ With the environment variables set, you can run the following commands to start
6546

6647
### Install the dependencies
6748

49+
For Python we recommend using a virtual environment.
50+
51+
_ℹ️ Here's a good [primer](https://realpython.com/python-virtual-environments-a-primer) on virtual environments from Real Python._
52+
53+
```sh
54+
# Create a virtual environment
55+
python -m venv .venv
56+
57+
# Activate the virtual environment
58+
source .venv/bin/activate
6859
```
69-
cd api && pip3 install -r requirements.txt
60+
61+
```sh
62+
# Install Python dependencies
63+
pip install -r requirements.txt
64+
65+
# Install Node dependencies
7066
cd frontend && yarn
7167
```
7268

7369
### Run API and frontend
7470

75-
```
76-
cd api && python3 app.py
77-
78-
# in a separate terminal
71+
```sh
72+
# Launch API app
73+
python api/app.py
7974

75+
# In a separate terminal launch frontend app
8076
cd frontend && yarn start
8177
```
8278

0 commit comments

Comments
 (0)