limcheekin commited on
Commit
13a1e24
1 Parent(s): dcc537b

first import

Browse files
.env.local.template ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use .env.local to change these variables
2
+ # DO NOT EDIT THIS FILE WITH SENSITIVE DATA
3
+
4
+ MONGODB_URL=${MONGODB_URL}
5
+ MONGODB_DB_NAME=chat-ui
6
+ MONGODB_DIRECT_CONNECTION=false
7
+
8
+
9
+ COOKIE_NAME=chat-ui
10
+ HF_ACCESS_TOKEN=#hf_<token> from from https://huggingface.co/settings/token
11
+
12
+ # used to activate search with web functionality. disabled if not defined
13
+ SERPAPI_KEY=#your serpapi key here
14
+
15
+ # Parameters to enable "Sign in with HF"
16
+ OPENID_CLIENT_ID=${OPENID_CLIENT_ID}
17
+ OPENID_CLIENT_SECRET=${OPENID_CLIENT_SECRET}
18
+ OPENID_SCOPES="openid profile" # Add "email" for some providers like Google that do not provide preferred_username
19
+ OPENID_PROVIDER_URL=https://huggingface.co # for Google, use https://accounts.google.com
20
+
21
+ MODELS=`[
22
+ {
23
+ "name": "zephyr-7b-beta-gguf",
24
+ "id": "zephyr-7b-beta-gguf",
25
+ "parameters": {
26
+ "temperature": 0.9,
27
+ "top_p": 0.95,
28
+ "repetition_penalty": 1.2,
29
+ "top_k": 50,
30
+ "truncate": 1000,
31
+ "max_new_tokens": 1024,
32
+ "stop": [],
33
+ "stream": true
34
+ },
35
+ "endpoints": [{
36
+ "type" : "openai",
37
+ "baseURL": "https://limcheekin-zephyr-7b-beta-gguf.hf.space/v1"
38
+ }]
39
+ },
40
+ {
41
+ "name": "neural-chat-7b-v3-1-gguf",
42
+ "id": "neural-chat-7b-v3-1-gguf",
43
+ "parameters": {
44
+ "temperature": 0.9,
45
+ "top_p": 0.95,
46
+ "repetition_penalty": 1.2,
47
+ "top_k": 50,
48
+ "truncate": 1000,
49
+ "max_new_tokens": 1024,
50
+ "stop": [],
51
+ "stream": true
52
+ },
53
+ "endpoints": [{
54
+ "type" : "openai",
55
+ "baseURL": "https://limcheekin-neural-chat-7b-v3-1-gguf.hf.space/v1"
56
+ }]
57
+ }
58
+ ]`
59
+
60
+ OLD_MODELS=`[]`# any removed models, `{ name: string, displayName?: string, id?: string }`
61
+
62
+ PUBLIC_ORIGIN=${SPACE_HOST}
63
+ PUBLIC_SHARE_PREFIX=${SPACE_HOST}/r
64
+ PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable
65
+ PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID=#UA-XXXXXXXX-X / Leave empty to disable
66
+ PUBLIC_ANNOUNCEMENT_BANNERS=`[
67
+ {
68
+ "title": "Chat UI is now open sourced on GitHub",
69
+ "linkTitle": "GitHub repo",
70
+ "linkHref": "https://github.com/huggingface/chat-ui"
71
+ }
72
+ ]`
73
+
74
+ PARQUET_EXPORT_DATASET=
75
+ PARQUET_EXPORT_HF_TOKEN=
76
+ PARQUET_EXPORT_SECRET=
77
+
78
+ PUBLIC_APP_NAME=${APP_NAME} # name used as title throughout the app
79
+ PUBLIC_APP_ASSETS=chatui # used to find logos & favicons in static/$PUBLIC_APP_ASSETS
80
+ PUBLIC_APP_COLOR=${APP_COLOR} # can be any of tailwind colors: https://tailwindcss.com/docs/customizing-colors#default-color-palette
81
+ PUBLIC_APP_DATA_SHARING=1 #set to 1 to enable disclaimers & options about data sharing
82
+ PUBLIC_APP_DATA_DISCLAIMER=1 #set to 1 to enable disclaimers about model outputs
Dockerfile ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ARG APP_COLOR
2
+ ARG APP_NAME
3
+
4
+ FROM node:20 as chatui-builder
5
+ ARG APP_COLOR
6
+ ARG APP_NAME
7
+
8
+ WORKDIR /app
9
+
10
+ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
11
+ git gettext && \
12
+ rm -rf /var/lib/apt/lists/*
13
+
14
+ RUN git clone https://github.com/huggingface/chat-ui.git
15
+
16
+ WORKDIR /app/chat-ui
17
+
18
+ COPY .env.local.template .env.local.template
19
+
20
+ RUN mkdir defaults
21
+ ADD defaults /defaults
22
+ RUN chmod -R 777 /defaults
23
+ RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
24
+ --mount=type=secret,id=OPENID_CLIENT_SECRET,mode=0444 \
25
+ APP_COLOR="${APP_COLOR:="$(cat /defaults/APP_COLOR)"}" && export APP_COLOR \
26
+ && APP_NAME="${APP_NAME:="$(cat /defaults/APP_NAME)"}" && export APP_NAME \
27
+ && OPENID_CLIENT_ID="${OPENID_CLIENT_ID:="$(cat /defaults/OPENID_CLIENT_ID)"}" && export OPENID_CLIENT_ID \
28
+ && MONGODB_URL=$(cat /run/secrets/MONGODB_URL > /dev/null | grep '^' || cat /defaults/MONGODB_URL) && export MONGODB_URL && \
29
+ OPENID_CLIENT_SECRET=$(cat /run/secrets/OPENID_CLIENT_SECRET > /dev/null | grep '^' || cat /defaults/OPENID_CLIENT_SECRET) && export OPENID_CLIENT_SECRET && \
30
+ envsubst < ".env.local.template" > ".env.local" \
31
+ && rm .env.local.template
32
+
33
+ RUN --mount=type=cache,target=/app/.npm \
34
+ npm set cache /app/.npm && \
35
+ npm ci
36
+
37
+ RUN npm install saslprep --save && npm run build
38
+
39
+ FROM node:20-slim
40
+
41
+ ARG APP_COLOR
42
+ ARG APP_NAME
43
+
44
+ ENV TZ=Asia/Kuala_Lumpur \
45
+ PORT=3000
46
+
47
+ RUN npm install -g pm2
48
+
49
+ RUN mkdir /app
50
+ RUN chown -R 1000:1000 /app
51
+
52
+ RUN adduser --disabled-password --gecos "" user
53
+
54
+ # Switch to the "user" user
55
+ USER user
56
+
57
+ ENV HOME=/home/user \
58
+ PATH=/home/user/.local/bin:$PATH
59
+
60
+ COPY --from=chatui-builder --chown=1000 /app/chat-ui/node_modules /app/node_modules
61
+ COPY --from=chatui-builder --chown=1000 /app/chat-ui/package.json /app/package.json
62
+ COPY --from=chatui-builder --chown=1000 /app/chat-ui/build /app/build
63
+
64
+ CMD pm2 start /app/build/index.js -i $CPU_CORES --no-daemon
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Lim Chee Kin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
defaults/APP_COLOR ADDED
@@ -0,0 +1 @@
 
 
1
+ blue
defaults/APP_NAME ADDED
@@ -0,0 +1 @@
 
 
1
+ Chat UI
defaults/OPENID_CLIENT_ID ADDED
@@ -0,0 +1 @@
 
 
1
+ e1a9d013-8142-40ff-a34e-1c69cf03c6d3