coyotte508 HF staff commited on
Commit
3ebd805
1 Parent(s): d16d319

🔧 Standardize environment config (#13)

Browse files
Files changed (4) hide show
  1. .env +4 -0
  2. Dockerfile +3 -2
  3. README.md +2 -0
  4. src/routes/api/conversation/+server.ts +2 -2
.env CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  PUBLIC_MODEL_ENDPOINT=https://api-inference.huggingface.co/models/OpenAssistant/oasst-sft-1-pythia-12b
2
  PUBLIC_MODEL_NAME=OpenAssistant/oasst-sft-1-pythia-12b
3
  PUBLIC_MODEL_TAGLINE=This is the first iteration English supervised-fine-tuning (SFT) model of the <a class="underline" href="https://github.com/LAION-AI/Open-Assistant">Open-Assistant</a> project. It is based on a Pythia 12B that was fine-tuned on ~22k human demonstrations of assistant conversations collected through the <a class="underline" href="https://open-assistant.io/">https://open-assistant.io/</a> human feedback web app before March 7, 2023.
 
1
+ MONGODB_URL=mongodb://localhost:27017
2
+ MONGODB_DB_NAME=chat-ui
3
+ HF_TOKEN=#your huggingface token here
4
+
5
  PUBLIC_MODEL_ENDPOINT=https://api-inference.huggingface.co/models/OpenAssistant/oasst-sft-1-pythia-12b
6
  PUBLIC_MODEL_NAME=OpenAssistant/oasst-sft-1-pythia-12b
7
  PUBLIC_MODEL_TAGLINE=This is the first iteration English supervised-fine-tuning (SFT) model of the <a class="underline" href="https://github.com/LAION-AI/Open-Assistant">Open-Assistant</a> project. It is based on a Pythia 12B that was fine-tuned on ~22k human demonstrations of assistant conversations collected through the <a class="underline" href="https://open-assistant.io/">https://open-assistant.io/</a> human feedback web app before March 7, 2023.
Dockerfile CHANGED
@@ -11,8 +11,9 @@ RUN npm i
11
 
12
  RUN chown -R 1000:1000 /app
13
 
14
- RUN --mount=type=secret,id=PUBLIC_MODEL_ENDPOINT,mode=0444,required=true \
15
- PUBLIC_MODEL_ENDPOINT=$(cat /run/secrets/PUBLIC_MODEL_ENDPOINT) npm run build
 
16
 
17
  ENV PORT 7860
18
 
 
11
 
12
  RUN chown -R 1000:1000 /app
13
 
14
+ RUN --mount=type=secret,id=DOTENV_LOCAL,mode=0444,required=true cat /run/secrets/DOTENV_LOCAL > .env.local
15
+
16
+ RUN npm run build
17
 
18
  ENV PORT 7860
19
 
README.md CHANGED
@@ -23,6 +23,8 @@ npm run dev
23
 
24
  Default configuration is in `.env`. Put custom config and secrets in `.env.local`, it will override the values in `.env`.
25
 
 
 
26
  ## Building
27
 
28
  To create a production version of your app:
 
23
 
24
  Default configuration is in `.env`. Put custom config and secrets in `.env.local`, it will override the values in `.env`.
25
 
26
+ Check out [.env](./.env) to see what needs to be set.
27
+
28
  ## Building
29
 
30
  To create a production version of your app:
src/routes/api/conversation/+server.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { env } from '$env/dynamic/private';
2
  import { PUBLIC_MODEL_ENDPOINT } from '$env/static/public';
3
 
4
  export async function POST({ request }) {
@@ -6,7 +6,7 @@ export async function POST({ request }) {
6
  headers: {
7
  ...request.headers,
8
  'Content-Type': 'application/json',
9
- Authorization: `Basic ${env.HF_TOKEN}`
10
  },
11
  method: 'POST',
12
  body: await request.text()
 
1
+ import { HF_TOKEN } from '$env/static/private';
2
  import { PUBLIC_MODEL_ENDPOINT } from '$env/static/public';
3
 
4
  export async function POST({ request }) {
 
6
  headers: {
7
  ...request.headers,
8
  'Content-Type': 'application/json',
9
+ Authorization: `Basic ${HF_TOKEN}`
10
  },
11
  method: 'POST',
12
  body: await request.text()