Datasets:
Upload 517 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- chat-ui-main/.dockerignore +11 -0
- chat-ui-main/.env +200 -0
- chat-ui-main/.env.ci +1 -0
- chat-ui-main/.eslintignore +13 -0
- chat-ui-main/.eslintrc.cjs +44 -0
- chat-ui-main/.github/ISSUE_TEMPLATE/bug-report--chat-ui-.md +43 -0
- chat-ui-main/.github/ISSUE_TEMPLATE/config-support.md +9 -0
- chat-ui-main/.github/ISSUE_TEMPLATE/feature-request--chat-ui-.md +17 -0
- chat-ui-main/.github/ISSUE_TEMPLATE/huggingchat.md +11 -0
- chat-ui-main/.github/release.yml +16 -0
- chat-ui-main/.github/workflows/build-docs.yml +18 -0
- chat-ui-main/.github/workflows/build-image.yml +140 -0
- chat-ui-main/.github/workflows/build-pr-docs.yml +20 -0
- chat-ui-main/.github/workflows/deploy-prod.yml +79 -0
- chat-ui-main/.github/workflows/lint-and-test.yml +52 -0
- chat-ui-main/.github/workflows/trufflehog.yml +15 -0
- chat-ui-main/.github/workflows/upload-pr-documentation.yml +16 -0
- chat-ui-main/.gitignore +14 -0
- chat-ui-main/.husky/lint-stage-config.js +4 -0
- chat-ui-main/.husky/pre-commit +2 -0
- chat-ui-main/.npmrc +1 -0
- chat-ui-main/.prettierignore +14 -0
- chat-ui-main/.prettierrc +8 -0
- chat-ui-main/.vscode/launch.json +11 -0
- chat-ui-main/.vscode/settings.json +11 -0
- chat-ui-main/Dockerfile +95 -0
- chat-ui-main/LICENSE +203 -0
- chat-ui-main/PRIVACY.md +42 -0
- chat-ui-main/PROMPTS.md +69 -0
- chat-ui-main/README.md +1012 -0
- chat-ui-main/chart/Chart.yaml +5 -0
- chat-ui-main/chart/env/prod.yaml +587 -0
- chat-ui-main/chart/templates/_helpers.tpl +22 -0
- chat-ui-main/chart/templates/config.yaml +10 -0
- chat-ui-main/chart/templates/deployment.yaml +80 -0
- chat-ui-main/chart/templates/hpa.yaml +45 -0
- chat-ui-main/chart/templates/infisical.yaml +24 -0
- chat-ui-main/chart/templates/ingress.yaml +32 -0
- chat-ui-main/chart/templates/network-policy.yaml +36 -0
- chat-ui-main/chart/templates/service-account.yaml +13 -0
- chat-ui-main/chart/templates/service-monitor.yaml +15 -0
- chat-ui-main/chart/templates/service.yaml +21 -0
- chat-ui-main/chart/values.yaml +67 -0
- chat-ui-main/docs/source/_toctree.yml +64 -0
- chat-ui-main/docs/source/configuration/common-issues.md +7 -0
- chat-ui-main/docs/source/configuration/embeddings.md +105 -0
- chat-ui-main/docs/source/configuration/metrics.md +9 -0
- chat-ui-main/docs/source/configuration/models/multimodal.md +24 -0
- chat-ui-main/docs/source/configuration/models/overview.md +147 -0
.gitattributes
CHANGED
@@ -57,3 +57,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
57 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
58 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
59 |
nltk_data/corpora/wordnet/data.noun filter=lfs diff=lfs merge=lfs -text
|
|
|
|
57 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
58 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
59 |
nltk_data/corpora/wordnet/data.noun filter=lfs diff=lfs merge=lfs -text
|
60 |
+
results[[:space:]](2)/nltk_data/corpora/wordnet/data.noun filter=lfs diff=lfs merge=lfs -text
|
chat-ui-main/.dockerignore
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Dockerfile
|
2 |
+
.vscode/
|
3 |
+
.idea
|
4 |
+
.gitignore
|
5 |
+
LICENSE
|
6 |
+
README.md
|
7 |
+
node_modules/
|
8 |
+
.svelte-kit/
|
9 |
+
.env*
|
10 |
+
!.env
|
11 |
+
.env.local
|
chat-ui-main/.env
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use .env.local to change these variables
|
2 |
+
# DO NOT EDIT THIS FILE WITH SENSITIVE DATA
|
3 |
+
|
4 |
+
### MongoDB ###
|
5 |
+
MONGODB_URL=#your mongodb URL here, use chat-ui-db image if you don't want to set this
|
6 |
+
MONGODB_DB_NAME=chat-ui
|
7 |
+
MONGODB_DIRECT_CONNECTION=false
|
8 |
+
|
9 |
+
|
10 |
+
### Endpoints config ###
|
11 |
+
HF_API_ROOT=https://api-inference.huggingface.co/models
|
12 |
+
# HF_TOKEN is used for a lot of things, not only for inference but also fetching tokenizers, etc.
|
13 |
+
# We recommend using an HF_TOKEN even if you use a local endpoint.
|
14 |
+
HF_TOKEN= #get it from https://huggingface.co/settings/token
|
15 |
+
# API Keys for providers, you will need to specify models in the MODELS section but these keys can be kept secret
|
16 |
+
OPENAI_API_KEY=#your openai api key here
|
17 |
+
ANTHROPIC_API_KEY=#your anthropic api key here
|
18 |
+
CLOUDFLARE_ACCOUNT_ID=#your cloudflare account id here
|
19 |
+
CLOUDFLARE_API_TOKEN=#your cloudflare api token here
|
20 |
+
COHERE_API_TOKEN=#your cohere api token here
|
21 |
+
GOOGLE_GENAI_API_KEY=#your google genai api token here
|
22 |
+
|
23 |
+
|
24 |
+
### Models ###
|
25 |
+
## Models can support many different endpoints, check the documentation for more details
|
26 |
+
MODELS=`[
|
27 |
+
{
|
28 |
+
"name": "NousResearch/Hermes-3-Llama-3.1-8B",
|
29 |
+
"description": "Nous Research's latest Hermes 3 release in 8B size.",
|
30 |
+
"promptExamples": [
|
31 |
+
{
|
32 |
+
"title": "Write an email from bullet list",
|
33 |
+
"prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
|
34 |
+
}, {
|
35 |
+
"title": "Code a snake game",
|
36 |
+
"prompt": "Code a basic snake game in python, give explanations for each step."
|
37 |
+
}, {
|
38 |
+
"title": "Assist in a task",
|
39 |
+
"prompt": "How do I make a delicious lemon cheesecake?"
|
40 |
+
}
|
41 |
+
]
|
42 |
+
}
|
43 |
+
]`
|
44 |
+
## Text Embedding Models used for websearch
|
45 |
+
# Default is a model that runs locally on CPU.
|
46 |
+
TEXT_EMBEDDING_MODELS = `[
|
47 |
+
{
|
48 |
+
"name": "Xenova/gte-small",
|
49 |
+
"displayName": "Xenova/gte-small",
|
50 |
+
"description": "Local embedding model running on the server.",
|
51 |
+
"chunkCharLength": 512,
|
52 |
+
"endpoints": [
|
53 |
+
{ "type": "transformersjs" }
|
54 |
+
]
|
55 |
+
}
|
56 |
+
]`
|
57 |
+
|
58 |
+
## Removed models, useful for migrating conversations
|
59 |
+
# { name: string, displayName?: string, id?: string, transferTo?: string }`
|
60 |
+
OLD_MODELS=`[]`
|
61 |
+
|
62 |
+
## Task model
|
63 |
+
# name of the model used for tasks such as summarizing title, creating query, etc.
|
64 |
+
# if not set, the first model in MODELS will be used
|
65 |
+
TASK_MODEL=
|
66 |
+
|
67 |
+
|
68 |
+
### Authentication ###
|
69 |
+
# Parameters to enable open id login
|
70 |
+
OPENID_CONFIG=
|
71 |
+
MESSAGES_BEFORE_LOGIN=# how many messages a user can send in a conversation before having to login. set to 0 to force login right away
|
72 |
+
# if it's defined, only these emails will be allowed to use login
|
73 |
+
ALLOWED_USER_EMAILS=`[]`
|
74 |
+
# valid alternative redirect URLs for OAuth, used for HuggingChat apps
|
75 |
+
ALTERNATIVE_REDIRECT_URLS=`[]`
|
76 |
+
### Cookies
|
77 |
+
# name of the cookie used to store the session
|
78 |
+
COOKIE_NAME=hf-chat
|
79 |
+
# specify secure behaviour for cookies
|
80 |
+
COOKIE_SAMESITE=# can be "lax", "strict", "none" or left empty
|
81 |
+
COOKIE_SECURE=# set to true to only allow cookies over https
|
82 |
+
|
83 |
+
|
84 |
+
### Websearch ###
|
85 |
+
## API Keys used to activate search with web functionality. websearch is disabled if none are defined. choose one of the following:
|
86 |
+
YDC_API_KEY=#your docs.you.com api key here
|
87 |
+
SERPER_API_KEY=#your serper.dev api key here
|
88 |
+
SERPAPI_KEY=#your serpapi key here
|
89 |
+
SERPSTACK_API_KEY=#your serpstack api key here
|
90 |
+
SEARCHAPI_KEY=#your searchapi api key here
|
91 |
+
USE_LOCAL_WEBSEARCH=#set to true to parse google results yourself, overrides other API keys
|
92 |
+
SEARXNG_QUERY_URL=# where '<query>' will be replaced with query keywords see https://docs.searxng.org/dev/search_api.html eg https://searxng.yourdomain.com/search?q=<query>&engines=duckduckgo,google&format=json
|
93 |
+
BING_SUBSCRIPTION_KEY=#your key
|
94 |
+
## Websearch configuration
|
95 |
+
PLAYWRIGHT_ADBLOCKER=true
|
96 |
+
WEBSEARCH_ALLOWLIST=`[]` # if it's defined, allow websites from only this list.
|
97 |
+
WEBSEARCH_BLOCKLIST=`[]` # if it's defined, block websites from this list.
|
98 |
+
WEBSEARCH_JAVASCRIPT=true # CPU usage reduces by 60% on average by disabling javascript. Enable to improve website compatibility
|
99 |
+
WEBSEARCH_TIMEOUT = 3500 # in milliseconds, determines how long to wait to load a page before timing out
|
100 |
+
ENABLE_LOCAL_FETCH=false #set to true to allow fetches on the local network. /!\ Only enable this if you have the proper firewall rules to prevent SSRF attacks and understand the implications.
|
101 |
+
|
102 |
+
|
103 |
+
## Public app configuration ##
|
104 |
+
PUBLIC_APP_GUEST_MESSAGE=# a message to the guest user. If not set, no message will be shown. Only used if you have authentication enabled.
|
105 |
+
PUBLIC_APP_NAME=ChatUI # name used as title throughout the app
|
106 |
+
PUBLIC_APP_ASSETS=chatui # used to find logos & favicons in static/$PUBLIC_APP_ASSETS
|
107 |
+
PUBLIC_APP_DESCRIPTION=# description used throughout the app
|
108 |
+
PUBLIC_APP_DATA_SHARING=# Set to 1 to enable an option in the user settings to share conversations with model authors
|
109 |
+
PUBLIC_APP_DISCLAIMER=# Set to 1 to show a disclaimer on login page
|
110 |
+
PUBLIC_APP_DISCLAIMER_MESSAGE=# Message to show on the login page
|
111 |
+
PUBLIC_ANNOUNCEMENT_BANNERS=`[
|
112 |
+
{
|
113 |
+
"title": "chat-ui is now open source!",
|
114 |
+
"linkTitle": "check it out",
|
115 |
+
"linkHref": "https://github.com/huggingface/chat-ui"
|
116 |
+
}
|
117 |
+
]`
|
118 |
+
PUBLIC_SMOOTH_UPDATES=false # set to true to enable smoothing of messages client-side, can be CPU intensive
|
119 |
+
PUBLIC_ORIGIN=#https://huggingface.co
|
120 |
+
PUBLIC_SHARE_PREFIX=#https://hf.co/chat
|
121 |
+
|
122 |
+
# mostly huggingchat specific
|
123 |
+
PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable
|
124 |
+
PUBLIC_PLAUSIBLE_SCRIPT_URL=#/js/script.js / Leave empty to disable
|
125 |
+
PUBLIC_APPLE_APP_ID=#1234567890 / Leave empty to disable
|
126 |
+
|
127 |
+
|
128 |
+
### Feature Flags ###
|
129 |
+
LLM_SUMMARIZATION=true # generate conversation titles with LLMs
|
130 |
+
ENABLE_ASSISTANTS=false #set to true to enable assistants feature
|
131 |
+
ENABLE_ASSISTANTS_RAG=false # /!\ This will let users specify arbitrary URLs that the server will then request. Make sure you have the proper firewall rules in place.
|
132 |
+
REQUIRE_FEATURED_ASSISTANTS=false # require featured assistants to show in the list
|
133 |
+
COMMUNITY_TOOLS=false # set to true to enable community tools
|
134 |
+
EXPOSE_API=true # make the /api routes available
|
135 |
+
ALLOW_IFRAME=true # Allow the app to be embedded in an iframe
|
136 |
+
|
137 |
+
|
138 |
+
### Tools ###
|
139 |
+
# Check out public config in `chart/env/prod.yaml` for more details
|
140 |
+
TOOLS=`[]`
|
141 |
+
|
142 |
+
### Rate limits ###
|
143 |
+
# See `src/lib/server/usageLimits.ts`
|
144 |
+
# {
|
145 |
+
# conversations: number, # how many conversations
|
146 |
+
# messages: number, # how many messages in a conversation
|
147 |
+
# assistants: number, # how many assistants
|
148 |
+
# messageLength: number, # how long can a message be before we cut it off
|
149 |
+
# messagesPerMinute: number, # how many messages per minute
|
150 |
+
# tools: number # how many tools
|
151 |
+
# }
|
152 |
+
USAGE_LIMITS=`{}`
|
153 |
+
|
154 |
+
|
155 |
+
### HuggingFace specific ###
|
156 |
+
# Let user authenticate with their HF token in the /api routes. This is only useful if you have OAuth configured with huggingface.
|
157 |
+
USE_HF_TOKEN_IN_API=false
|
158 |
+
## Feature flag & admin settings
|
159 |
+
# Used for setting early access & admin flags to users
|
160 |
+
HF_ORG_ADMIN=
|
161 |
+
HF_ORG_EARLY_ACCESS=
|
162 |
+
WEBHOOK_URL_REPORT_ASSISTANT=#provide slack webhook url to get notified for reports/feature requests
|
163 |
+
|
164 |
+
|
165 |
+
|
166 |
+
### Metrics ###
|
167 |
+
METRICS_ENABLED=false
|
168 |
+
METRICS_PORT=5565
|
169 |
+
LOG_LEVEL=info
|
170 |
+
|
171 |
+
|
172 |
+
### Parquet export ###
|
173 |
+
# Not in use anymore but useful to export conversations to a parquet file as a HuggingFace dataset
|
174 |
+
PARQUET_EXPORT_DATASET=
|
175 |
+
PARQUET_EXPORT_HF_TOKEN=
|
176 |
+
ADMIN_API_SECRET=# secret to admin API calls, like computing usage stats or exporting parquet data
|
177 |
+
|
178 |
+
|
179 |
+
### Docker build variables ###
|
180 |
+
# These values cannot be updated at runtime
|
181 |
+
# They need to be passed when building the docker image
|
182 |
+
# See https://github.com/huggingface/chat-ui/main/.github/workflows/deploy-prod.yml#L44-L47
|
183 |
+
APP_BASE="" # base path of the app, e.g. /chat, left blank as default
|
184 |
+
PUBLIC_APP_COLOR=blue # can be any of tailwind colors: https://tailwindcss.com/docs/customizing-colors#default-color-palette
|
185 |
+
### Body size limit for SvelteKit https://svelte.dev/docs/kit/adapter-node#Environment-variables-BODY_SIZE_LIMIT
|
186 |
+
BODY_SIZE_LIMIT=15728640
|
187 |
+
PUBLIC_COMMIT_SHA=
|
188 |
+
|
189 |
+
### LEGACY parameters
|
190 |
+
HF_ACCESS_TOKEN=#LEGACY! Use HF_TOKEN instead
|
191 |
+
ALLOW_INSECURE_COOKIES=false # LEGACY! Use COOKIE_SECURE and COOKIE_SAMESITE instead
|
192 |
+
PARQUET_EXPORT_SECRET=#DEPRECATED, use ADMIN_API_SECRET instead
|
193 |
+
RATE_LIMIT= # /!\ DEPRECATED definition of messages per minute. Use USAGE_LIMITS.messagesPerMinute instead
|
194 |
+
OPENID_CLIENT_ID=
|
195 |
+
OPENID_CLIENT_SECRET=
|
196 |
+
OPENID_SCOPES="openid profile" # Add "email" for some providers like Google that do not provide preferred_username
|
197 |
+
OPENID_NAME_CLAIM="name" # Change to "username" for some providers that do not provide name
|
198 |
+
OPENID_PROVIDER_URL=https://huggingface.co # for Google, use https://accounts.google.com
|
199 |
+
OPENID_TOLERANCE=
|
200 |
+
OPENID_RESOURCE=
|
chat-ui-main/.env.ci
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
MONGODB_URL=mongodb://localhost:27017/
|
chat-ui-main/.eslintignore
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.DS_Store
|
2 |
+
node_modules
|
3 |
+
/build
|
4 |
+
/.svelte-kit
|
5 |
+
/package
|
6 |
+
.env
|
7 |
+
.env.*
|
8 |
+
!.env.example
|
9 |
+
|
10 |
+
# Ignore files for PNPM, NPM and YARN
|
11 |
+
pnpm-lock.yaml
|
12 |
+
package-lock.json
|
13 |
+
yarn.lock
|
chat-ui-main/.eslintrc.cjs
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module.exports = {
|
2 |
+
root: true,
|
3 |
+
parser: "@typescript-eslint/parser",
|
4 |
+
extends: [
|
5 |
+
"eslint:recommended",
|
6 |
+
"plugin:@typescript-eslint/recommended",
|
7 |
+
"plugin:svelte/recommended",
|
8 |
+
"prettier",
|
9 |
+
],
|
10 |
+
plugins: ["@typescript-eslint"],
|
11 |
+
ignorePatterns: ["*.cjs"],
|
12 |
+
overrides: [
|
13 |
+
{
|
14 |
+
files: ["*.svelte"],
|
15 |
+
parser: "svelte-eslint-parser",
|
16 |
+
parserOptions: {
|
17 |
+
parser: "@typescript-eslint/parser",
|
18 |
+
},
|
19 |
+
},
|
20 |
+
],
|
21 |
+
parserOptions: {
|
22 |
+
sourceType: "module",
|
23 |
+
ecmaVersion: 2020,
|
24 |
+
extraFileExtensions: [".svelte"],
|
25 |
+
},
|
26 |
+
rules: {
|
27 |
+
"require-yield": "off",
|
28 |
+
"@typescript-eslint/no-explicit-any": "error",
|
29 |
+
"@typescript-eslint/no-non-null-assertion": "error",
|
30 |
+
"@typescript-eslint/no-unused-vars": [
|
31 |
+
// prevent variables with a _ prefix from being marked as unused
|
32 |
+
"error",
|
33 |
+
{
|
34 |
+
argsIgnorePattern: "^_",
|
35 |
+
},
|
36 |
+
],
|
37 |
+
"object-shorthand": ["error", "always"],
|
38 |
+
},
|
39 |
+
env: {
|
40 |
+
browser: true,
|
41 |
+
es2017: true,
|
42 |
+
node: true,
|
43 |
+
},
|
44 |
+
};
|
chat-ui-main/.github/ISSUE_TEMPLATE/bug-report--chat-ui-.md
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
name: Bug Report (chat-ui)
|
3 |
+
about: Use this for confirmed issues with chat-ui
|
4 |
+
title: ""
|
5 |
+
labels: bug
|
6 |
+
assignees: ""
|
7 |
+
---
|
8 |
+
|
9 |
+
## Bug description
|
10 |
+
|
11 |
+
<!-- A clear and concise description of what the bug is. -->
|
12 |
+
|
13 |
+
## Steps to reproduce
|
14 |
+
|
15 |
+
<!-- Steps to reproduce the issue -->
|
16 |
+
|
17 |
+
## Screenshots
|
18 |
+
|
19 |
+
<!-- If applicable, add screenshots to help explain your problem. -->
|
20 |
+
|
21 |
+
## Context
|
22 |
+
|
23 |
+
### Logs
|
24 |
+
|
25 |
+
<!-- Add any logs that are relevant to your issue. Could be browser or server logs. Wrap in code blocks. -->
|
26 |
+
|
27 |
+
```
|
28 |
+
// logs here if relevant
|
29 |
+
```
|
30 |
+
|
31 |
+
### Specs
|
32 |
+
|
33 |
+
- **OS**:
|
34 |
+
- **Browser**:
|
35 |
+
- **chat-ui commit**:
|
36 |
+
|
37 |
+
### Config
|
38 |
+
|
39 |
+
<!-- Add the environment variables you've used to setup chat-ui, making sure to redact any secrets. -->
|
40 |
+
|
41 |
+
## Notes
|
42 |
+
|
43 |
+
<!-- Anything else relevant to help the issue get solved -->
|
chat-ui-main/.github/ISSUE_TEMPLATE/config-support.md
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
name: Config Support
|
3 |
+
about: Help with setting up chat-ui locally
|
4 |
+
title: ""
|
5 |
+
labels: support
|
6 |
+
assignees: ""
|
7 |
+
---
|
8 |
+
|
9 |
+
**Please use the discussions on GitHub** for getting help with setting things up instead of opening an issue: https://github.com/huggingface/chat-ui/discussions
|
chat-ui-main/.github/ISSUE_TEMPLATE/feature-request--chat-ui-.md
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
name: Feature Request (chat-ui)
|
3 |
+
about: Suggest new features to be added to chat-ui
|
4 |
+
title: ""
|
5 |
+
labels: enhancement
|
6 |
+
assignees: ""
|
7 |
+
---
|
8 |
+
|
9 |
+
## Describe your feature request
|
10 |
+
|
11 |
+
<!-- Short description of what this is about -->
|
12 |
+
|
13 |
+
## Screenshots (if relevant)
|
14 |
+
|
15 |
+
## Implementation idea
|
16 |
+
|
17 |
+
<!-- If you know how this should be implemented in the codebase, share your thoughts. Let us know if you feel like implementing it yourself as well! -->
|
chat-ui-main/.github/ISSUE_TEMPLATE/huggingchat.md
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
name: HuggingChat
|
3 |
+
about: Requests & reporting outages on HuggingChat, the hosted version of chat-ui.
|
4 |
+
title: ""
|
5 |
+
labels: huggingchat
|
6 |
+
assignees: ""
|
7 |
+
---
|
8 |
+
|
9 |
+
**Do not use GitHub issues** for requesting models on HuggingChat or reporting issues with HuggingChat being down/overloaded.
|
10 |
+
|
11 |
+
**Use the discussions page on the hub instead:** https://huggingface.co/spaces/huggingchat/chat-ui/discussions
|
chat-ui-main/.github/release.yml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
changelog:
|
2 |
+
exclude:
|
3 |
+
labels:
|
4 |
+
- huggingchat
|
5 |
+
- CI/CD
|
6 |
+
- documentation
|
7 |
+
categories:
|
8 |
+
- title: Features
|
9 |
+
labels:
|
10 |
+
- enhancement
|
11 |
+
- title: Bugfixes
|
12 |
+
labels:
|
13 |
+
- bug
|
14 |
+
- title: Other changes
|
15 |
+
labels:
|
16 |
+
- "*"
|
chat-ui-main/.github/workflows/build-docs.yml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Build documentation
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
- v*-release
|
8 |
+
|
9 |
+
jobs:
|
10 |
+
build:
|
11 |
+
uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
|
12 |
+
with:
|
13 |
+
commit_sha: ${{ github.sha }}
|
14 |
+
package: chat-ui
|
15 |
+
additional_args: --not_python_module
|
16 |
+
secrets:
|
17 |
+
token: ${{ secrets.HUGGINGFACE_PUSH }}
|
18 |
+
hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
|
chat-ui-main/.github/workflows/build-image.yml
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Build and Publish Image
|
2 |
+
|
3 |
+
permissions:
|
4 |
+
packages: write
|
5 |
+
|
6 |
+
on:
|
7 |
+
push:
|
8 |
+
branches:
|
9 |
+
- "main"
|
10 |
+
pull_request:
|
11 |
+
branches:
|
12 |
+
- "*"
|
13 |
+
paths:
|
14 |
+
- "Dockerfile"
|
15 |
+
- "entrypoint.sh"
|
16 |
+
workflow_dispatch:
|
17 |
+
release:
|
18 |
+
types: [published, edited]
|
19 |
+
|
20 |
+
jobs:
|
21 |
+
build-and-publish-image-with-db:
|
22 |
+
runs-on: ubuntu-latest
|
23 |
+
steps:
|
24 |
+
- name: Checkout
|
25 |
+
uses: actions/checkout@v4
|
26 |
+
|
27 |
+
- name: Extract package version
|
28 |
+
id: package-version
|
29 |
+
run: |
|
30 |
+
VERSION=$(jq -r .version package.json)
|
31 |
+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
32 |
+
MAJOR=$(echo $VERSION | cut -d '.' -f1)
|
33 |
+
echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
|
34 |
+
MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)
|
35 |
+
echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
|
36 |
+
|
37 |
+
- name: Docker metadata
|
38 |
+
id: meta
|
39 |
+
uses: docker/metadata-action@v5
|
40 |
+
with:
|
41 |
+
images: |
|
42 |
+
ghcr.io/huggingface/chat-ui-db
|
43 |
+
tags: |
|
44 |
+
type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}
|
45 |
+
type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}
|
46 |
+
type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}
|
47 |
+
type=raw,value=latest,enable={{is_default_branch}}
|
48 |
+
type=sha,enable={{is_default_branch}}
|
49 |
+
|
50 |
+
- name: Set up QEMU
|
51 |
+
uses: docker/setup-qemu-action@v3
|
52 |
+
|
53 |
+
- name: Set up Docker Buildx
|
54 |
+
uses: docker/setup-buildx-action@v3
|
55 |
+
|
56 |
+
- name: Login to GitHub Container Registry
|
57 |
+
if: github.event_name != 'pull_request'
|
58 |
+
uses: docker/login-action@v3
|
59 |
+
with:
|
60 |
+
registry: ghcr.io
|
61 |
+
username: ${{ github.repository_owner }}
|
62 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
63 |
+
|
64 |
+
- name: Inject slug/short variables
|
65 |
+
uses: rlespinasse/github-slug-action@v4.5.0
|
66 |
+
|
67 |
+
- name: Build and Publish Docker Image with DB
|
68 |
+
uses: docker/build-push-action@v5
|
69 |
+
with:
|
70 |
+
context: .
|
71 |
+
file: Dockerfile
|
72 |
+
push: ${{ github.event_name != 'pull_request' }}
|
73 |
+
tags: ${{ steps.meta.outputs.tags }}
|
74 |
+
labels: ${{ steps.meta.outputs.labels }}
|
75 |
+
platforms: linux/amd64,linux/arm64
|
76 |
+
cache-from: type=gha
|
77 |
+
cache-to: type=gha,mode=max
|
78 |
+
build-args: |
|
79 |
+
INCLUDE_DB=true
|
80 |
+
PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
81 |
+
build-and-publish-image-nodb:
|
82 |
+
runs-on: ubuntu-latest
|
83 |
+
steps:
|
84 |
+
- name: Checkout
|
85 |
+
uses: actions/checkout@v4
|
86 |
+
|
87 |
+
- name: Extract package version
|
88 |
+
id: package-version
|
89 |
+
run: |
|
90 |
+
VERSION=$(jq -r .version package.json)
|
91 |
+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
92 |
+
MAJOR=$(echo $VERSION | cut -d '.' -f1)
|
93 |
+
echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
|
94 |
+
MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)
|
95 |
+
echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
|
96 |
+
|
97 |
+
- name: Docker metadata
|
98 |
+
id: meta
|
99 |
+
uses: docker/metadata-action@v5
|
100 |
+
with:
|
101 |
+
images: |
|
102 |
+
ghcr.io/huggingface/chat-ui
|
103 |
+
tags: |
|
104 |
+
type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}
|
105 |
+
type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}
|
106 |
+
type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}
|
107 |
+
type=raw,value=latest,enable={{is_default_branch}}
|
108 |
+
type=sha,enable={{is_default_branch}}
|
109 |
+
|
110 |
+
- name: Set up QEMU
|
111 |
+
uses: docker/setup-qemu-action@v3
|
112 |
+
|
113 |
+
- name: Set up Docker Buildx
|
114 |
+
uses: docker/setup-buildx-action@v3
|
115 |
+
|
116 |
+
- name: Login to GitHub Container Registry
|
117 |
+
if: github.event_name != 'pull_request'
|
118 |
+
uses: docker/login-action@v3
|
119 |
+
with:
|
120 |
+
registry: ghcr.io
|
121 |
+
username: ${{ github.repository_owner }}
|
122 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
123 |
+
|
124 |
+
- name: Inject slug/short variables
|
125 |
+
uses: rlespinasse/github-slug-action@v4.5.0
|
126 |
+
|
127 |
+
- name: Build and Publish Docker Image without DB
|
128 |
+
uses: docker/build-push-action@v5
|
129 |
+
with:
|
130 |
+
context: .
|
131 |
+
file: Dockerfile
|
132 |
+
push: ${{ github.event_name != 'pull_request' }}
|
133 |
+
tags: ${{ steps.meta.outputs.tags }}
|
134 |
+
labels: ${{ steps.meta.outputs.labels }}
|
135 |
+
platforms: linux/amd64,linux/arm64
|
136 |
+
cache-from: type=gha
|
137 |
+
cache-to: type=gha,mode=max
|
138 |
+
build-args: |
|
139 |
+
INCLUDE_DB=false
|
140 |
+
PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
chat-ui-main/.github/workflows/build-pr-docs.yml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Build PR Documentation
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
paths:
|
6 |
+
- "docs/source/**"
|
7 |
+
- ".github/workflows/build-pr-docs.yml"
|
8 |
+
|
9 |
+
concurrency:
|
10 |
+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
11 |
+
cancel-in-progress: true
|
12 |
+
|
13 |
+
jobs:
|
14 |
+
build:
|
15 |
+
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
|
16 |
+
with:
|
17 |
+
commit_sha: ${{ github.event.pull_request.head.sha }}
|
18 |
+
pr_number: ${{ github.event.number }}
|
19 |
+
package: chat-ui
|
20 |
+
additional_args: --not_python_module
|
chat-ui-main/.github/workflows/deploy-prod.yml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Deploy to k8s
|
2 |
+
on:
|
3 |
+
# run this workflow manually from the Actions tab
|
4 |
+
workflow_dispatch:
|
5 |
+
|
6 |
+
jobs:
|
7 |
+
build-and-publish-huggingchat-image:
|
8 |
+
runs-on: ubuntu-latest
|
9 |
+
steps:
|
10 |
+
- name: Checkout
|
11 |
+
uses: actions/checkout@v4
|
12 |
+
|
13 |
+
- name: Login to Registry
|
14 |
+
uses: docker/login-action@v3
|
15 |
+
with:
|
16 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
17 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
18 |
+
|
19 |
+
- name: Docker metadata
|
20 |
+
id: meta
|
21 |
+
uses: docker/metadata-action@v5
|
22 |
+
with:
|
23 |
+
images: |
|
24 |
+
huggingface/chat-ui
|
25 |
+
tags: |
|
26 |
+
type=raw,value=latest,enable={{is_default_branch}}
|
27 |
+
type=sha,enable={{is_default_branch}}
|
28 |
+
|
29 |
+
- name: Set up Docker Buildx
|
30 |
+
uses: docker/setup-buildx-action@v3
|
31 |
+
|
32 |
+
- name: Inject slug/short variables
|
33 |
+
uses: rlespinasse/github-slug-action@v4.5.0
|
34 |
+
|
35 |
+
- name: Build and Publish HuggingChat image
|
36 |
+
uses: docker/build-push-action@v5
|
37 |
+
with:
|
38 |
+
context: .
|
39 |
+
file: Dockerfile
|
40 |
+
push: ${{ github.event_name != 'pull_request' }}
|
41 |
+
tags: ${{ steps.meta.outputs.tags }}
|
42 |
+
labels: ${{ steps.meta.outputs.labels }}
|
43 |
+
platforms: linux/amd64
|
44 |
+
cache-to: type=gha,mode=max,scope=amd64
|
45 |
+
cache-from: type=gha,scope=amd64
|
46 |
+
provenance: false
|
47 |
+
build-args: |
|
48 |
+
INCLUDE_DB=false
|
49 |
+
APP_BASE=/chat
|
50 |
+
PUBLIC_APP_COLOR=yellow
|
51 |
+
PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
52 |
+
deploy:
|
53 |
+
name: Deploy on prod
|
54 |
+
runs-on: ubuntu-latest
|
55 |
+
needs: ["build-and-publish-huggingchat-image"]
|
56 |
+
steps:
|
57 |
+
- name: Inject slug/short variables
|
58 |
+
uses: rlespinasse/github-slug-action@v4.5.0
|
59 |
+
|
60 |
+
- name: Gen values
|
61 |
+
run: |
|
62 |
+
VALUES=$(cat <<-END
|
63 |
+
image:
|
64 |
+
tag: "sha-${{ env.GITHUB_SHA_SHORT }}"
|
65 |
+
END
|
66 |
+
)
|
67 |
+
echo "VALUES=$(echo "$VALUES" | yq -o=json | jq tostring)" >> $GITHUB_ENV
|
68 |
+
|
69 |
+
- name: Deploy on infra-deployments
|
70 |
+
uses: aurelien-baudet/workflow-dispatch@v2
|
71 |
+
with:
|
72 |
+
workflow: Update application values
|
73 |
+
repo: huggingface/infra-deployments
|
74 |
+
wait-for-completion: true
|
75 |
+
wait-for-completion-interval: 10s
|
76 |
+
display-workflow-run-url-interval: 10s
|
77 |
+
ref: refs/heads/main
|
78 |
+
token: ${{ secrets.GIT_TOKEN_INFRA_DEPLOYMENT }}
|
79 |
+
inputs: '{"path": "hub/chat-ui/chat-ui.yaml", "values": ${{ env.VALUES }}, "url": "${{ github.event.head_commit.url }}"}'
|
chat-ui-main/.github/workflows/lint-and-test.yml
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Lint and test
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
push:
|
6 |
+
branches:
|
7 |
+
- main
|
8 |
+
|
9 |
+
jobs:
|
10 |
+
lint:
|
11 |
+
runs-on: ubuntu-latest
|
12 |
+
timeout-minutes: 10
|
13 |
+
|
14 |
+
steps:
|
15 |
+
- uses: actions/checkout@v3
|
16 |
+
|
17 |
+
- uses: actions/setup-node@v3
|
18 |
+
with:
|
19 |
+
node-version: "20"
|
20 |
+
cache: "npm"
|
21 |
+
- run: |
|
22 |
+
npm install ci
|
23 |
+
- name: "Checking lint/format errors"
|
24 |
+
run: |
|
25 |
+
npm run lint
|
26 |
+
- name: "Checking type errors"
|
27 |
+
run: |
|
28 |
+
npm run check
|
29 |
+
|
30 |
+
test:
|
31 |
+
runs-on: ubuntu-latest
|
32 |
+
timeout-minutes: 10
|
33 |
+
|
34 |
+
steps:
|
35 |
+
- uses: actions/checkout@v3
|
36 |
+
- uses: actions/setup-node@v3
|
37 |
+
with:
|
38 |
+
node-version: "20"
|
39 |
+
cache: "npm"
|
40 |
+
- run: |
|
41 |
+
npm ci
|
42 |
+
- name: "Tests"
|
43 |
+
run: |
|
44 |
+
npm run test
|
45 |
+
|
46 |
+
build-check:
|
47 |
+
runs-on: ubuntu-latest
|
48 |
+
timeout-minutes: 10
|
49 |
+
steps:
|
50 |
+
- uses: actions/checkout@v3
|
51 |
+
- name: Build Docker image
|
52 |
+
run: docker build --secret id=DOTENV_LOCAL,src=.env.ci -t chat-ui:latest .
|
chat-ui-main/.github/workflows/trufflehog.yml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
on:
|
2 |
+
push:
|
3 |
+
|
4 |
+
name: Secret Leaks
|
5 |
+
|
6 |
+
jobs:
|
7 |
+
trufflehog:
|
8 |
+
runs-on: ubuntu-latest
|
9 |
+
steps:
|
10 |
+
- name: Checkout code
|
11 |
+
uses: actions/checkout@v4
|
12 |
+
with:
|
13 |
+
fetch-depth: 0
|
14 |
+
- name: Secret Scanning
|
15 |
+
uses: trufflesecurity/trufflehog@main
|
chat-ui-main/.github/workflows/upload-pr-documentation.yml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Upload PR Documentation
|
2 |
+
|
3 |
+
on:
|
4 |
+
workflow_run:
|
5 |
+
workflows: ["Build PR Documentation"]
|
6 |
+
types:
|
7 |
+
- completed
|
8 |
+
|
9 |
+
jobs:
|
10 |
+
build:
|
11 |
+
uses: huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml@main
|
12 |
+
with:
|
13 |
+
package_name: chat-ui
|
14 |
+
secrets:
|
15 |
+
hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
|
16 |
+
comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }}
|
chat-ui-main/.gitignore
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.DS_Store
|
2 |
+
node_modules
|
3 |
+
/build
|
4 |
+
/.svelte-kit
|
5 |
+
/package
|
6 |
+
.env
|
7 |
+
.env.*
|
8 |
+
vite.config.js.timestamp-*
|
9 |
+
vite.config.ts.timestamp-*
|
10 |
+
SECRET_CONFIG
|
11 |
+
.idea
|
12 |
+
!.env.ci
|
13 |
+
!.env
|
14 |
+
gcp-*.json
|
chat-ui-main/.husky/lint-stage-config.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export default {
|
2 |
+
"*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix", "eslint"],
|
3 |
+
"*.json": ["prettier --write"],
|
4 |
+
};
|
chat-ui-main/.husky/pre-commit
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
set -e
|
2 |
+
npx lint-staged --config ./.husky/lint-stage-config.js
|
chat-ui-main/.npmrc
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
engine-strict=true
|
chat-ui-main/.prettierignore
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.DS_Store
|
2 |
+
node_modules
|
3 |
+
/build
|
4 |
+
/.svelte-kit
|
5 |
+
/package
|
6 |
+
/chart
|
7 |
+
.env
|
8 |
+
.env.*
|
9 |
+
!.env.example
|
10 |
+
|
11 |
+
# Ignore files for PNPM, NPM and YARN
|
12 |
+
pnpm-lock.yaml
|
13 |
+
package-lock.json
|
14 |
+
yarn.lock
|
chat-ui-main/.prettierrc
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"useTabs": true,
|
3 |
+
"trailingComma": "es5",
|
4 |
+
"printWidth": 100,
|
5 |
+
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
|
6 |
+
"pluginSearchDirs": ["."],
|
7 |
+
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
8 |
+
}
|
chat-ui-main/.vscode/launch.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"version": "0.2.0",
|
3 |
+
"configurations": [
|
4 |
+
{
|
5 |
+
"command": "npm run dev",
|
6 |
+
"name": "Run development server",
|
7 |
+
"request": "launch",
|
8 |
+
"type": "node-terminal"
|
9 |
+
}
|
10 |
+
]
|
11 |
+
}
|
chat-ui-main/.vscode/settings.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"editor.formatOnSave": true,
|
3 |
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
4 |
+
"editor.codeActionsOnSave": {
|
5 |
+
"source.fixAll": "explicit"
|
6 |
+
},
|
7 |
+
"eslint.validate": ["javascript", "svelte"],
|
8 |
+
"[svelte]": {
|
9 |
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
10 |
+
}
|
11 |
+
}
|
chat-ui-main/Dockerfile
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# syntax=docker/dockerfile:1
|
2 |
+
ARG INCLUDE_DB=false
|
3 |
+
|
4 |
+
FROM node:20-slim AS base
|
5 |
+
ENV PLAYWRIGHT_SKIP_BROWSER_GC=1
|
6 |
+
|
7 |
+
# install dotenv-cli
|
8 |
+
RUN npm install -g dotenv-cli
|
9 |
+
|
10 |
+
# switch to a user that works for spaces
|
11 |
+
RUN userdel -r node
|
12 |
+
RUN useradd -m -u 1000 user
|
13 |
+
USER user
|
14 |
+
|
15 |
+
ENV HOME=/home/user \
|
16 |
+
PATH=/home/user/.local/bin:$PATH
|
17 |
+
|
18 |
+
WORKDIR /app
|
19 |
+
|
20 |
+
# add a .env.local if the user doesn't bind a volume to it
|
21 |
+
RUN touch /app/.env.local
|
22 |
+
|
23 |
+
|
24 |
+
RUN npm i --no-package-lock --no-save playwright@1.47.0
|
25 |
+
USER root
|
26 |
+
RUN apt-get update
|
27 |
+
RUN apt-get install gnupg curl -y
|
28 |
+
RUN npx playwright install --with-deps chromium
|
29 |
+
RUN chown -R 1000:1000 /home/user/.npm
|
30 |
+
USER user
|
31 |
+
|
32 |
+
COPY --chown=1000 .env /app/.env
|
33 |
+
COPY --chown=1000 entrypoint.sh /app/entrypoint.sh
|
34 |
+
COPY --chown=1000 gcp-*.json /app/
|
35 |
+
COPY --chown=1000 package.json /app/package.json
|
36 |
+
COPY --chown=1000 package-lock.json /app/package-lock.json
|
37 |
+
|
38 |
+
RUN chmod +x /app/entrypoint.sh
|
39 |
+
|
40 |
+
|
41 |
+
FROM node:20 AS builder
|
42 |
+
|
43 |
+
WORKDIR /app
|
44 |
+
|
45 |
+
COPY --link --chown=1000 package-lock.json package.json ./
|
46 |
+
|
47 |
+
ARG APP_BASE=
|
48 |
+
ARG PUBLIC_APP_COLOR=blue
|
49 |
+
ENV BODY_SIZE_LIMIT=15728640
|
50 |
+
|
51 |
+
RUN --mount=type=cache,target=/app/.npm \
|
52 |
+
npm set cache /app/.npm && \
|
53 |
+
npm ci
|
54 |
+
|
55 |
+
COPY --link --chown=1000 . .
|
56 |
+
|
57 |
+
RUN git config --global --add safe.directory /app && \
|
58 |
+
npm run build
|
59 |
+
|
60 |
+
# mongo image
|
61 |
+
FROM mongo:7 AS mongo
|
62 |
+
|
63 |
+
# image to be used if INCLUDE_DB is false
|
64 |
+
FROM base AS local_db_false
|
65 |
+
|
66 |
+
# image to be used if INCLUDE_DB is true
|
67 |
+
FROM base AS local_db_true
|
68 |
+
|
69 |
+
# copy mongo from the other stage
|
70 |
+
COPY --from=mongo /usr/bin/mongo* /usr/bin/
|
71 |
+
|
72 |
+
ENV MONGODB_URL=mongodb://localhost:27017
|
73 |
+
USER root
|
74 |
+
RUN mkdir -p /data/db
|
75 |
+
RUN chown -R 1000:1000 /data/db
|
76 |
+
USER user
|
77 |
+
# final image
|
78 |
+
FROM local_db_${INCLUDE_DB} AS final
|
79 |
+
|
80 |
+
# build arg to determine if the database should be included
|
81 |
+
ARG INCLUDE_DB=false
|
82 |
+
ENV INCLUDE_DB=${INCLUDE_DB}
|
83 |
+
|
84 |
+
# svelte requires APP_BASE at build time so it must be passed as a build arg
|
85 |
+
ARG APP_BASE=
|
86 |
+
# tailwind requires the primary theme to be known at build time so it must be passed as a build arg
|
87 |
+
ARG PUBLIC_APP_COLOR=blue
|
88 |
+
ARG PUBLIC_COMMIT_SHA=
|
89 |
+
ENV PUBLIC_COMMIT_SHA=${PUBLIC_COMMIT_SHA}
|
90 |
+
ENV BODY_SIZE_LIMIT=15728640
|
91 |
+
#import the build & dependencies
|
92 |
+
COPY --from=builder --chown=1000 /app/build /app/build
|
93 |
+
COPY --from=builder --chown=1000 /app/node_modules /app/node_modules
|
94 |
+
|
95 |
+
CMD ["/bin/bash", "-c", "/app/entrypoint.sh"]
|
chat-ui-main/LICENSE
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright 2018- The Hugging Face team. All rights reserved.
|
2 |
+
|
3 |
+
Apache License
|
4 |
+
Version 2.0, January 2004
|
5 |
+
http://www.apache.org/licenses/
|
6 |
+
|
7 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
8 |
+
|
9 |
+
1. Definitions.
|
10 |
+
|
11 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
12 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
13 |
+
|
14 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
15 |
+
the copyright owner that is granting the License.
|
16 |
+
|
17 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
18 |
+
other entities that control, are controlled by, or are under common
|
19 |
+
control with that entity. For the purposes of this definition,
|
20 |
+
"control" means (i) the power, direct or indirect, to cause the
|
21 |
+
direction or management of such entity, whether by contract or
|
22 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
23 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
24 |
+
|
25 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
26 |
+
exercising permissions granted by this License.
|
27 |
+
|
28 |
+
"Source" form shall mean the preferred form for making modifications,
|
29 |
+
including but not limited to software source code, documentation
|
30 |
+
source, and configuration files.
|
31 |
+
|
32 |
+
"Object" form shall mean any form resulting from mechanical
|
33 |
+
transformation or translation of a Source form, including but
|
34 |
+
not limited to compiled object code, generated documentation,
|
35 |
+
and conversions to other media types.
|
36 |
+
|
37 |
+
"Work" shall mean the work of authorship, whether in Source or
|
38 |
+
Object form, made available under the License, as indicated by a
|
39 |
+
copyright notice that is included in or attached to the work
|
40 |
+
(an example is provided in the Appendix below).
|
41 |
+
|
42 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
43 |
+
form, that is based on (or derived from) the Work and for which the
|
44 |
+
editorial revisions, annotations, elaborations, or other modifications
|
45 |
+
represent, as a whole, an original work of authorship. For the purposes
|
46 |
+
of this License, Derivative Works shall not include works that remain
|
47 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
48 |
+
the Work and Derivative Works thereof.
|
49 |
+
|
50 |
+
"Contribution" shall mean any work of authorship, including
|
51 |
+
the original version of the Work and any modifications or additions
|
52 |
+
to that Work or Derivative Works thereof, that is intentionally
|
53 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
54 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
55 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
56 |
+
means any form of electronic, verbal, or written communication sent
|
57 |
+
to the Licensor or its representatives, including but not limited to
|
58 |
+
communication on electronic mailing lists, source code control systems,
|
59 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
60 |
+
Licensor for the purpose of discussing and improving the Work, but
|
61 |
+
excluding communication that is conspicuously marked or otherwise
|
62 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
63 |
+
|
64 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
65 |
+
on behalf of whom a Contribution has been received by Licensor and
|
66 |
+
subsequently incorporated within the Work.
|
67 |
+
|
68 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
69 |
+
this License, each Contributor hereby grants to You a perpetual,
|
70 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
71 |
+
copyright license to reproduce, prepare Derivative Works of,
|
72 |
+
publicly display, publicly perform, sublicense, and distribute the
|
73 |
+
Work and such Derivative Works in Source or Object form.
|
74 |
+
|
75 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
76 |
+
this License, each Contributor hereby grants to You a perpetual,
|
77 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
78 |
+
(except as stated in this section) patent license to make, have made,
|
79 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
80 |
+
where such license applies only to those patent claims licensable
|
81 |
+
by such Contributor that are necessarily infringed by their
|
82 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
83 |
+
with the Work to which such Contribution(s) was submitted. If You
|
84 |
+
institute patent litigation against any entity (including a
|
85 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
86 |
+
or a Contribution incorporated within the Work constitutes direct
|
87 |
+
or contributory patent infringement, then any patent licenses
|
88 |
+
granted to You under this License for that Work shall terminate
|
89 |
+
as of the date such litigation is filed.
|
90 |
+
|
91 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
92 |
+
Work or Derivative Works thereof in any medium, with or without
|
93 |
+
modifications, and in Source or Object form, provided that You
|
94 |
+
meet the following conditions:
|
95 |
+
|
96 |
+
(a) You must give any other recipients of the Work or
|
97 |
+
Derivative Works a copy of this License; and
|
98 |
+
|
99 |
+
(b) You must cause any modified files to carry prominent notices
|
100 |
+
stating that You changed the files; and
|
101 |
+
|
102 |
+
(c) You must retain, in the Source form of any Derivative Works
|
103 |
+
that You distribute, all copyright, patent, trademark, and
|
104 |
+
attribution notices from the Source form of the Work,
|
105 |
+
excluding those notices that do not pertain to any part of
|
106 |
+
the Derivative Works; and
|
107 |
+
|
108 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
109 |
+
distribution, then any Derivative Works that You distribute must
|
110 |
+
include a readable copy of the attribution notices contained
|
111 |
+
within such NOTICE file, excluding those notices that do not
|
112 |
+
pertain to any part of the Derivative Works, in at least one
|
113 |
+
of the following places: within a NOTICE text file distributed
|
114 |
+
as part of the Derivative Works; within the Source form or
|
115 |
+
documentation, if provided along with the Derivative Works; or,
|
116 |
+
within a display generated by the Derivative Works, if and
|
117 |
+
wherever such third-party notices normally appear. The contents
|
118 |
+
of the NOTICE file are for informational purposes only and
|
119 |
+
do not modify the License. You may add Your own attribution
|
120 |
+
notices within Derivative Works that You distribute, alongside
|
121 |
+
or as an addendum to the NOTICE text from the Work, provided
|
122 |
+
that such additional attribution notices cannot be construed
|
123 |
+
as modifying the License.
|
124 |
+
|
125 |
+
You may add Your own copyright statement to Your modifications and
|
126 |
+
may provide additional or different license terms and conditions
|
127 |
+
for use, reproduction, or distribution of Your modifications, or
|
128 |
+
for any such Derivative Works as a whole, provided Your use,
|
129 |
+
reproduction, and distribution of the Work otherwise complies with
|
130 |
+
the conditions stated in this License.
|
131 |
+
|
132 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
133 |
+
any Contribution intentionally submitted for inclusion in the Work
|
134 |
+
by You to the Licensor shall be under the terms and conditions of
|
135 |
+
this License, without any additional terms or conditions.
|
136 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
137 |
+
the terms of any separate license agreement you may have executed
|
138 |
+
with Licensor regarding such Contributions.
|
139 |
+
|
140 |
+
6. Trademarks. This License does not grant permission to use the trade
|
141 |
+
names, trademarks, service marks, or product names of the Licensor,
|
142 |
+
except as required for reasonable and customary use in describing the
|
143 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
144 |
+
|
145 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
146 |
+
agreed to in writing, Licensor provides the Work (and each
|
147 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
148 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
149 |
+
implied, including, without limitation, any warranties or conditions
|
150 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
151 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
152 |
+
appropriateness of using or redistributing the Work and assume any
|
153 |
+
risks associated with Your exercise of permissions under this License.
|
154 |
+
|
155 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
156 |
+
whether in tort (including negligence), contract, or otherwise,
|
157 |
+
unless required by applicable law (such as deliberate and grossly
|
158 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
159 |
+
liable to You for damages, including any direct, indirect, special,
|
160 |
+
incidental, or consequential damages of any character arising as a
|
161 |
+
result of this License or out of the use or inability to use the
|
162 |
+
Work (including but not limited to damages for loss of goodwill,
|
163 |
+
work stoppage, computer failure or malfunction, or any and all
|
164 |
+
other commercial damages or losses), even if such Contributor
|
165 |
+
has been advised of the possibility of such damages.
|
166 |
+
|
167 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
168 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
169 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
170 |
+
or other liability obligations and/or rights consistent with this
|
171 |
+
License. However, in accepting such obligations, You may act only
|
172 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
173 |
+
of any other Contributor, and only if You agree to indemnify,
|
174 |
+
defend, and hold each Contributor harmless for any liability
|
175 |
+
incurred by, or claims asserted against, such Contributor by reason
|
176 |
+
of your accepting any such warranty or additional liability.
|
177 |
+
|
178 |
+
END OF TERMS AND CONDITIONS
|
179 |
+
|
180 |
+
APPENDIX: How to apply the Apache License to your work.
|
181 |
+
|
182 |
+
To apply the Apache License to your work, attach the following
|
183 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
184 |
+
replaced with your own identifying information. (Don't include
|
185 |
+
the brackets!) The text should be enclosed in the appropriate
|
186 |
+
comment syntax for the file format. We also recommend that a
|
187 |
+
file or class name and description of purpose be included on the
|
188 |
+
same "printed page" as the copyright notice for easier
|
189 |
+
identification within third-party archives.
|
190 |
+
|
191 |
+
Copyright [yyyy] [name of copyright owner]
|
192 |
+
|
193 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
194 |
+
you may not use this file except in compliance with the License.
|
195 |
+
You may obtain a copy of the License at
|
196 |
+
|
197 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
198 |
+
|
199 |
+
Unless required by applicable law or agreed to in writing, software
|
200 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
201 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
202 |
+
See the License for the specific language governing permissions and
|
203 |
+
limitations under the License.
|
chat-ui-main/PRIVACY.md
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## Privacy
|
2 |
+
|
3 |
+
> Last updated: April 15, 2024
|
4 |
+
|
5 |
+
Users of HuggingChat are authenticated through their HF user account.
|
6 |
+
|
7 |
+
We endorse Privacy by Design. As such, your conversations are private to you and will not be shared with anyone, including model authors, for any purpose, including for research or model training purposes.
|
8 |
+
|
9 |
+
You conversation data will only be stored to let you access past conversations. You can click on the Delete icon to delete any past conversation at any moment.
|
10 |
+
|
11 |
+
🗓 Please also consult huggingface.co's main privacy policy at <https://huggingface.co/privacy>. To exercise any of your legal privacy rights, please send an email to <privacy@huggingface.co>.
|
12 |
+
|
13 |
+
## About available LLMs
|
14 |
+
|
15 |
+
The goal of this app is to showcase that it is now possible to build an open source alternative to ChatGPT. 💪
|
16 |
+
|
17 |
+
We aim to always provide a diverse set of state of the art open LLMs, hence we rotate the available models over time.
|
18 |
+
|
19 |
+
Historically, HuggingChat has been running models such as:
|
20 |
+
|
21 |
+
- [Llama 2 70B](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf)
|
22 |
+
- [CodeLlama 35B](https://about.fb.com/news/2023/08/code-llama-ai-for-coding/)
|
23 |
+
- [Falcon 180B](https://www.tii.ae/news/technology-innovation-institute-introduces-worlds-most-powerful-open-llm-falcon-180b)
|
24 |
+
- [Mistral 7B](https://mistral.ai/news/announcing-mistral-7b/)
|
25 |
+
- [Cohere Command R+](https://huggingface.co/chat/models/CohereForAI/c4ai-command-r-plus)
|
26 |
+
- [Google Gemma 7B](https://huggingface.co/chat/models/google/gemma-1.1-7b-it)
|
27 |
+
|
28 |
+
This is only a partial list. Check the [models](https://huggingface.co/chat/models/) page for up-to-date list of the best available LLMs.
|
29 |
+
|
30 |
+
## Technical details
|
31 |
+
|
32 |
+
This app is running in a [Space](https://huggingface.co/docs/hub/spaces-overview), which entails that the code for this UI is publicly visible [inside the Space repo](https://huggingface.co/spaces/huggingchat/chat-ui/tree/main).
|
33 |
+
|
34 |
+
**Further development takes place on the [huggingface/chat-ui GitHub repo](https://github.com/huggingface/chat-ui).**
|
35 |
+
|
36 |
+
The inference backend is running the optimized [text-generation-inference](https://github.com/huggingface/text-generation-inference) on HuggingFace's Inference API infrastructure.
|
37 |
+
|
38 |
+
It is therefore possible to deploy a copy of this app to a Space and customize it (swap model, add some UI elements, or store user messages according to your own Terms and conditions). You can also 1-click deploy your own instance using the [Chat UI Spaces Docker template](https://huggingface.co/new-space?template=huggingchat/chat-ui-template).
|
39 |
+
|
40 |
+
We welcome any feedback on this app: please participate to the public discussion at <https://huggingface.co/spaces/huggingchat/chat-ui/discussions>
|
41 |
+
|
42 |
+
<a target="_blank" href="https://huggingface.co/spaces/huggingchat/chat-ui/discussions"><img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-a-discussion-xl.svg" title="open a discussion"></a>
|
chat-ui-main/PROMPTS.md
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Prompt templates
|
2 |
+
|
3 |
+
These are the templates used to format the conversation history for different models used in HuggingChat. Set them in your `.env.local` [like so](https://github.com/huggingface/chat-ui#chatprompttemplate).
|
4 |
+
|
5 |
+
## Llama 2
|
6 |
+
|
7 |
+
```env
|
8 |
+
<s>[INST] <<SYS>>\n{{preprompt}}\n<</SYS>>\n\n{{#each messages}}{{#ifUser}}{{content}} [/INST] {{/ifUser}}{{#ifAssistant}}{{content}} </s><s>[INST] {{/ifAssistant}}{{/each}}
|
9 |
+
```
|
10 |
+
|
11 |
+
## CodeLlama
|
12 |
+
|
13 |
+
```env
|
14 |
+
<s>[INST] <<SYS>>\n{{preprompt}}\n<</SYS>>\n\n{{#each messages}}{{#ifUser}}{{content}} [/INST] {{/ifUser}}{{#ifAssistant}}{{content}} </s><s>[INST] {{/ifAssistant}}{{/each}}
|
15 |
+
```
|
16 |
+
|
17 |
+
## Falcon
|
18 |
+
|
19 |
+
```env
|
20 |
+
System: {{preprompt}}\nUser:{{#each messages}}{{#ifUser}}{{content}}\nFalcon:{{/ifUser}}{{#ifAssistant}}{{content}}\nUser:{{/ifAssistant}}{{/each}}
|
21 |
+
```
|
22 |
+
|
23 |
+
## Mistral
|
24 |
+
|
25 |
+
```env
|
26 |
+
<s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}} {{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s> {{/ifAssistant}}{{/each}}
|
27 |
+
```
|
28 |
+
|
29 |
+
## Zephyr
|
30 |
+
|
31 |
+
```env
|
32 |
+
<|system|>\n{{preprompt}}</s>\n{{#each messages}}{{#ifUser}}<|user|>\n{{content}}</s>\n<|assistant|>\n{{/ifUser}}{{#ifAssistant}}{{content}}</s>\n{{/ifAssistant}}{{/each}}
|
33 |
+
```
|
34 |
+
|
35 |
+
## IDEFICS
|
36 |
+
|
37 |
+
```env
|
38 |
+
{{#each messages}}{{#ifUser}}User: {{content}}{{/ifUser}}<end_of_utterance>\nAssistant: {{#ifAssistant}}{{content}}\n{{/ifAssistant}}{{/each}}
|
39 |
+
```
|
40 |
+
|
41 |
+
## OpenChat
|
42 |
+
|
43 |
+
```env
|
44 |
+
<s>{{#each messages}}{{#ifUser}}GPT4 User: {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}}<|end_of_turn|>GPT4 Assistant: {{/ifUser}}{{#ifAssistant}}{{content}}<|end_of_turn|>{{/ifAssistant}}{{/each}}
|
45 |
+
```
|
46 |
+
|
47 |
+
## Mixtral
|
48 |
+
|
49 |
+
```env
|
50 |
+
<s> {{#each messages}}{{#ifUser}}[INST]{{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}} {{content}} [/INST]{{/ifUser}}{{#ifAssistant}} {{content}}</s> {{/ifAssistant}}{{/each}}
|
51 |
+
```
|
52 |
+
|
53 |
+
## ChatML
|
54 |
+
|
55 |
+
```env
|
56 |
+
{{#if @root.preprompt}}<|im_start|>system\n{{@root.preprompt}}<|im_end|>\n{{/if}}{{#each messages}}{{#ifUser}}<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n{{/ifUser}}{{#ifAssistant}}{{content}}<|im_end|>\n{{/ifAssistant}}{{/each}}
|
57 |
+
```
|
58 |
+
|
59 |
+
## CodeLlama 70B
|
60 |
+
|
61 |
+
```env
|
62 |
+
<s>{{#if @root.preprompt}}Source: system\n\n {{@root.preprompt}} <step> {{/if}}{{#each messages}}{{#ifUser}}Source: user\n\n {{content}} <step> {{/ifUser}}{{#ifAssistant}}Source: assistant\n\n {{content}} <step> {{/ifAssistant}}{{/each}}Source: assistant\nDestination: user\n\n ``
|
63 |
+
```
|
64 |
+
|
65 |
+
## Gemma
|
66 |
+
|
67 |
+
```env
|
68 |
+
{{#each messages}}{{#ifUser}}<start_of_turn>user\n{{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}}<end_of_turn>\n<start_of_turn>model\n{{/ifUser}}{{#ifAssistant}}{{content}}<end_of_turn>\n{{/ifAssistant}}{{/each}}
|
69 |
+
```
|
chat-ui-main/README.md
ADDED
@@ -0,0 +1,1012 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Chat UI
|
2 |
+
|
3 |
+
**Find the docs at [hf.co/docs/chat-ui](https://huggingface.co/docs/chat-ui/index).**
|
4 |
+
|
5 |
+
![Chat UI repository thumbnail](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/chatui-websearch.png)
|
6 |
+
|
7 |
+
A chat interface using open source models, eg OpenAssistant or Llama. It is a SvelteKit app and it powers the [HuggingChat app on hf.co/chat](https://huggingface.co/chat).
|
8 |
+
|
9 |
+
0. [Quickstart](#quickstart)
|
10 |
+
1. [No Setup Deploy](#no-setup-deploy)
|
11 |
+
2. [Setup](#setup)
|
12 |
+
3. [Launch](#launch)
|
13 |
+
4. [Web Search](#web-search)
|
14 |
+
5. [Text Embedding Models](#text-embedding-models)
|
15 |
+
6. [Extra parameters](#extra-parameters)
|
16 |
+
7. [Common issues](#common-issues)
|
17 |
+
8. [Deploying to a HF Space](#deploying-to-a-hf-space)
|
18 |
+
9. [Building](#building)
|
19 |
+
|
20 |
+
## Quickstart
|
21 |
+
|
22 |
+
### Docker image
|
23 |
+
|
24 |
+
You can deploy a chat-ui instance in a single command using the docker image. Get your huggingface token from [here](https://huggingface.co/settings/tokens).
|
25 |
+
|
26 |
+
```bash
|
27 |
+
docker run -p 3000 -e HF_TOKEN=hf_*** -v db:/data ghcr.io/huggingface/chat-ui-db:latest
|
28 |
+
```
|
29 |
+
|
30 |
+
Take a look at the [`.env` file](https://github.com/huggingface/chat-ui/blob/main/.env) and the readme to see all the environment variables that you can set. We have endpoint support for all OpenAI API compatible local services as well as many other providers like Anthropic, Cloudflare, Google Vertex AI, etc.
|
31 |
+
|
32 |
+
### Local setup
|
33 |
+
|
34 |
+
You can quickly start a locally running chat-ui & LLM text-generation server thanks to chat-ui's [llama.cpp server support](https://huggingface.co/docs/chat-ui/configuration/models/providers/llamacpp).
|
35 |
+
|
36 |
+
**Step 1 (Start llama.cpp server):**
|
37 |
+
|
38 |
+
Install llama.cpp w/ brew (for Mac):
|
39 |
+
|
40 |
+
```bash
|
41 |
+
# install llama.cpp
|
42 |
+
brew install llama.cpp
|
43 |
+
```
|
44 |
+
|
45 |
+
or [build directly from the source](https://github.com/ggerganov/llama.cpp/blob/master/docs/build.md) for your target device:
|
46 |
+
|
47 |
+
```
|
48 |
+
git clone https://github.com/ggerganov/llama.cpp && cd llama.cpp && make
|
49 |
+
```
|
50 |
+
|
51 |
+
Next, start the server with the [LLM of your choice](https://huggingface.co/models?library=gguf):
|
52 |
+
|
53 |
+
```bash
|
54 |
+
# start llama.cpp server (using hf.co/microsoft/Phi-3-mini-4k-instruct-gguf as an example)
|
55 |
+
llama-server --hf-repo microsoft/Phi-3-mini-4k-instruct-gguf --hf-file Phi-3-mini-4k-instruct-q4.gguf -c 4096
|
56 |
+
```
|
57 |
+
|
58 |
+
A local LLaMA.cpp HTTP Server will start on `http://localhost:8080`. Read more [here](https://huggingface.co/docs/chat-ui/configuration/models/providers/llamacpp).
|
59 |
+
|
60 |
+
**Step 3 (make sure you have MongoDb running locally):**
|
61 |
+
|
62 |
+
```bash
|
63 |
+
docker run -d -p 27017:27017 --name mongo-chatui mongo:latest
|
64 |
+
```
|
65 |
+
|
66 |
+
Read more [here](#database).
|
67 |
+
|
68 |
+
**Step 4 (clone chat-ui):**
|
69 |
+
|
70 |
+
```bash
|
71 |
+
git clone https://github.com/huggingface/chat-ui
|
72 |
+
cd chat-ui
|
73 |
+
```
|
74 |
+
|
75 |
+
**Step 5 (tell chat-ui to use local llama.cpp server):**
|
76 |
+
|
77 |
+
Add the following to your `.env.local`:
|
78 |
+
|
79 |
+
```ini
|
80 |
+
MODELS=`[
|
81 |
+
{
|
82 |
+
"name": "microsoft/Phi-3-mini-4k-instruct",
|
83 |
+
"endpoints": [{
|
84 |
+
"type" : "llamacpp",
|
85 |
+
"baseURL": "http://localhost:8080"
|
86 |
+
}],
|
87 |
+
},
|
88 |
+
]`
|
89 |
+
```
|
90 |
+
|
91 |
+
Read more [here](https://huggingface.co/docs/chat-ui/configuration/models/providers/llamacpp).
|
92 |
+
|
93 |
+
**Step 6 (start chat-ui):**
|
94 |
+
|
95 |
+
```bash
|
96 |
+
npm install
|
97 |
+
npm run dev -- --open
|
98 |
+
```
|
99 |
+
|
100 |
+
Read more [here](#launch).
|
101 |
+
|
102 |
+
<img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/chat-ui/llamacpp-dark.png" height="auto"/>
|
103 |
+
|
104 |
+
## No Setup Deploy
|
105 |
+
|
106 |
+
If you don't want to configure, setup, and launch your own Chat UI yourself, you can use this option as a fast deploy alternative.
|
107 |
+
|
108 |
+
You can deploy your own customized Chat UI instance with any supported [LLM](https://huggingface.co/models?pipeline_tag=text-generation&sort=trending) of your choice on [Hugging Face Spaces](https://huggingface.co/spaces). To do so, use the chat-ui template [available here](https://huggingface.co/new-space?template=huggingchat/chat-ui-template).
|
109 |
+
|
110 |
+
Set `HF_TOKEN` in [Space secrets](https://huggingface.co/docs/hub/spaces-overview#managing-secrets) to deploy a model with gated access or a model in a private repository. It's also compatible with [Inference for PROs](https://huggingface.co/blog/inference-pro) curated list of powerful models with higher rate limits. Make sure to create your personal token first in your [User Access Tokens settings](https://huggingface.co/settings/tokens).
|
111 |
+
|
112 |
+
Read the full tutorial [here](https://huggingface.co/docs/hub/spaces-sdks-docker-chatui#chatui-on-spaces).
|
113 |
+
|
114 |
+
## Setup
|
115 |
+
|
116 |
+
The default config for Chat UI is stored in the `.env` file. You will need to override some values to get Chat UI to run locally. This is done in `.env.local`.
|
117 |
+
|
118 |
+
Start by creating a `.env.local` file in the root of the repository. The bare minimum config you need to get Chat UI to run locally is the following:
|
119 |
+
|
120 |
+
```env
|
121 |
+
MONGODB_URL=<the URL to your MongoDB instance>
|
122 |
+
HF_TOKEN=<your access token>
|
123 |
+
```
|
124 |
+
|
125 |
+
### Database
|
126 |
+
|
127 |
+
The chat history is stored in a MongoDB instance, and having a DB instance available is needed for Chat UI to work.
|
128 |
+
|
129 |
+
You can use a local MongoDB instance. The easiest way is to spin one up using docker:
|
130 |
+
|
131 |
+
```bash
|
132 |
+
docker run -d -p 27017:27017 --name mongo-chatui mongo:latest
|
133 |
+
```
|
134 |
+
|
135 |
+
In which case the url of your DB will be `MONGODB_URL=mongodb://localhost:27017`.
|
136 |
+
|
137 |
+
Alternatively, you can use a [free MongoDB Atlas](https://www.mongodb.com/pricing) instance for this, Chat UI should fit comfortably within their free tier. After which you can set the `MONGODB_URL` variable in `.env.local` to match your instance.
|
138 |
+
|
139 |
+
### Hugging Face Access Token
|
140 |
+
|
141 |
+
If you use a remote inference endpoint, you will need a Hugging Face access token to run Chat UI locally. You can get one from [your Hugging Face profile](https://huggingface.co/settings/tokens).
|
142 |
+
|
143 |
+
## Launch
|
144 |
+
|
145 |
+
After you're done with the `.env.local` file you can run Chat UI locally with:
|
146 |
+
|
147 |
+
```bash
|
148 |
+
npm install
|
149 |
+
npm run dev
|
150 |
+
```
|
151 |
+
|
152 |
+
## Web Search
|
153 |
+
|
154 |
+
Chat UI features a powerful Web Search feature. It works by:
|
155 |
+
|
156 |
+
1. Generating an appropriate search query from the user prompt.
|
157 |
+
2. Performing web search and extracting content from webpages.
|
158 |
+
3. Creating embeddings from texts using a text embedding model.
|
159 |
+
4. From these embeddings, find the ones that are closest to the user query using a vector similarity search. Specifically, we use `inner product` distance.
|
160 |
+
5. Get the corresponding texts to those closest embeddings and perform [Retrieval-Augmented Generation](https://huggingface.co/papers/2005.11401) (i.e. expand user prompt by adding those texts so that an LLM can use this information).
|
161 |
+
|
162 |
+
## Text Embedding Models
|
163 |
+
|
164 |
+
By default (for backward compatibility), when `TEXT_EMBEDDING_MODELS` environment variable is not defined, [transformers.js](https://huggingface.co/docs/transformers.js) embedding models will be used for embedding tasks, specifically, [Xenova/gte-small](https://huggingface.co/Xenova/gte-small) model.
|
165 |
+
|
166 |
+
You can customize the embedding model by setting `TEXT_EMBEDDING_MODELS` in your `.env.local` file. For example:
|
167 |
+
|
168 |
+
```env
|
169 |
+
TEXT_EMBEDDING_MODELS = `[
|
170 |
+
{
|
171 |
+
"name": "Xenova/gte-small",
|
172 |
+
"displayName": "Xenova/gte-small",
|
173 |
+
"description": "locally running embedding",
|
174 |
+
"chunkCharLength": 512,
|
175 |
+
"endpoints": [
|
176 |
+
{"type": "transformersjs"}
|
177 |
+
]
|
178 |
+
},
|
179 |
+
{
|
180 |
+
"name": "intfloat/e5-base-v2",
|
181 |
+
"displayName": "intfloat/e5-base-v2",
|
182 |
+
"description": "hosted embedding model",
|
183 |
+
"chunkCharLength": 768,
|
184 |
+
"preQuery": "query: ", # See https://huggingface.co/intfloat/e5-base-v2#faq
|
185 |
+
"prePassage": "passage: ", # See https://huggingface.co/intfloat/e5-base-v2#faq
|
186 |
+
"endpoints": [
|
187 |
+
{
|
188 |
+
"type": "tei",
|
189 |
+
"url": "http://127.0.0.1:8080/",
|
190 |
+
"authorization": "TOKEN_TYPE TOKEN" // optional authorization field. Example: "Basic VVNFUjpQQVNT"
|
191 |
+
}
|
192 |
+
]
|
193 |
+
}
|
194 |
+
]`
|
195 |
+
```
|
196 |
+
|
197 |
+
The required fields are `name`, `chunkCharLength` and `endpoints`.
|
198 |
+
Supported text embedding backends are: [`transformers.js`](https://huggingface.co/docs/transformers.js), [`TEI`](https://github.com/huggingface/text-embeddings-inference) and [`OpenAI`](https://platform.openai.com/docs/guides/embeddings). `transformers.js` models run locally as part of `chat-ui`, whereas `TEI` models run in a different environment & accessed through an API endpoint. `openai` models are accessed through the [OpenAI API](https://platform.openai.com/docs/guides/embeddings).
|
199 |
+
|
200 |
+
When more than one embedding models are supplied in `.env.local` file, the first will be used by default, and the others will only be used on LLM's which configured `embeddingModel` to the name of the model.
|
201 |
+
|
202 |
+
## Extra parameters
|
203 |
+
|
204 |
+
### OpenID connect
|
205 |
+
|
206 |
+
The login feature is disabled by default and users are attributed a unique ID based on their browser. But if you want to use OpenID to authenticate your users, you can add the following to your `.env.local` file:
|
207 |
+
|
208 |
+
```env
|
209 |
+
OPENID_CONFIG=`{
|
210 |
+
PROVIDER_URL: "<your OIDC issuer>",
|
211 |
+
CLIENT_ID: "<your OIDC client ID>",
|
212 |
+
CLIENT_SECRET: "<your OIDC client secret>",
|
213 |
+
SCOPES: "openid profile",
|
214 |
+
TOLERANCE: // optional
|
215 |
+
RESOURCE: // optional
|
216 |
+
}`
|
217 |
+
```
|
218 |
+
|
219 |
+
These variables will enable the openID sign-in modal for users.
|
220 |
+
|
221 |
+
### Trusted header authentication
|
222 |
+
|
223 |
+
You can set the env variable `TRUSTED_EMAIL_HEADER` to point to the header that contains the user's email address. This will allow you to authenticate users from the header. This setup is usually combined with a proxy that will be in front of chat-ui and will handle the auth and set the header.
|
224 |
+
|
225 |
+
> [!WARNING]
|
226 |
+
> Make sure to only allow requests to chat-ui through your proxy which handles authentication, otherwise users could authenticate as anyone by setting the header manually! Only set this up if you understand the implications and know how to do it correctly.
|
227 |
+
|
228 |
+
Here is a list of header names for common auth providers:
|
229 |
+
|
230 |
+
- Tailscale Serve: `Tailscale-User-Login`
|
231 |
+
- Cloudflare Access: `Cf-Access-Authenticated-User-Email`
|
232 |
+
- oauth2-proxy: `X-Forwarded-Email`
|
233 |
+
|
234 |
+
### Theming
|
235 |
+
|
236 |
+
You can use a few environment variables to customize the look and feel of chat-ui. These are by default:
|
237 |
+
|
238 |
+
```env
|
239 |
+
PUBLIC_APP_NAME=ChatUI
|
240 |
+
PUBLIC_APP_ASSETS=chatui
|
241 |
+
PUBLIC_APP_COLOR=blue
|
242 |
+
PUBLIC_APP_DESCRIPTION="Making the community's best AI chat models available to everyone."
|
243 |
+
PUBLIC_APP_DATA_SHARING=
|
244 |
+
PUBLIC_APP_DISCLAIMER=
|
245 |
+
```
|
246 |
+
|
247 |
+
- `PUBLIC_APP_NAME` The name used as a title throughout the app.
|
248 |
+
- `PUBLIC_APP_ASSETS` Is used to find logos & favicons in `static/$PUBLIC_APP_ASSETS`, current options are `chatui` and `huggingchat`.
|
249 |
+
- `PUBLIC_APP_COLOR` Can be any of the [tailwind colors](https://tailwindcss.com/docs/customizing-colors#default-color-palette).
|
250 |
+
- `PUBLIC_APP_DATA_SHARING` Can be set to 1 to add a toggle in the user settings that lets your users opt-in to data sharing with models creator.
|
251 |
+
- `PUBLIC_APP_DISCLAIMER` If set to 1, we show a disclaimer about generated outputs on login.
|
252 |
+
|
253 |
+
### Web Search config
|
254 |
+
|
255 |
+
You can enable the web search through an API by adding `YDC_API_KEY` ([docs.you.com](https://docs.you.com)) or `SERPER_API_KEY` ([serper.dev](https://serper.dev/)) or `SERPAPI_KEY` ([serpapi.com](https://serpapi.com/)) or `SERPSTACK_API_KEY` ([serpstack.com](https://serpstack.com/)) or `SEARCHAPI_KEY` ([searchapi.io](https://www.searchapi.io/)) to your `.env.local`.
|
256 |
+
|
257 |
+
You can also simply enable the local google websearch by setting `USE_LOCAL_WEBSEARCH=true` in your `.env.local` or specify a SearXNG instance by adding the query URL to `SEARXNG_QUERY_URL`.
|
258 |
+
|
259 |
+
You can enable javascript when parsing webpages to improve compatibility with `WEBSEARCH_JAVASCRIPT=true` at the cost of increased CPU usage. You'll want at least 4 cores when enabling.
|
260 |
+
|
261 |
+
### Custom models
|
262 |
+
|
263 |
+
You can customize the parameters passed to the model or even use a new model by updating the `MODELS` variable in your `.env.local`. The default one can be found in `.env` and looks like this :
|
264 |
+
|
265 |
+
```env
|
266 |
+
MODELS=`[
|
267 |
+
{
|
268 |
+
"name": "mistralai/Mistral-7B-Instruct-v0.2",
|
269 |
+
"displayName": "mistralai/Mistral-7B-Instruct-v0.2",
|
270 |
+
"description": "Mistral 7B is a new Apache 2.0 model, released by Mistral AI that outperforms Llama2 13B in benchmarks.",
|
271 |
+
"websiteUrl": "https://mistral.ai/news/announcing-mistral-7b/",
|
272 |
+
"preprompt": "",
|
273 |
+
"chatPromptTemplate" : "<s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s>{{/ifAssistant}}{{/each}}",
|
274 |
+
"parameters": {
|
275 |
+
"temperature": 0.3,
|
276 |
+
"top_p": 0.95,
|
277 |
+
"repetition_penalty": 1.2,
|
278 |
+
"top_k": 50,
|
279 |
+
"truncate": 3072,
|
280 |
+
"max_new_tokens": 1024,
|
281 |
+
"stop": ["</s>"]
|
282 |
+
},
|
283 |
+
"promptExamples": [
|
284 |
+
{
|
285 |
+
"title": "Write an email from bullet list",
|
286 |
+
"prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
|
287 |
+
}, {
|
288 |
+
"title": "Code a snake game",
|
289 |
+
"prompt": "Code a basic snake game in python, give explanations for each step."
|
290 |
+
}, {
|
291 |
+
"title": "Assist in a task",
|
292 |
+
"prompt": "How do I make a delicious lemon cheesecake?"
|
293 |
+
}
|
294 |
+
]
|
295 |
+
}
|
296 |
+
]`
|
297 |
+
|
298 |
+
```
|
299 |
+
|
300 |
+
You can change things like the parameters, or customize the preprompt to better suit your needs. You can also add more models by adding more objects to the array, with different preprompts for example.
|
301 |
+
|
302 |
+
#### chatPromptTemplate
|
303 |
+
|
304 |
+
When querying the model for a chat response, the `chatPromptTemplate` template is used. `messages` is an array of chat messages, it has the format `[{ content: string }, ...]`. To identify if a message is a user message or an assistant message the `ifUser` and `ifAssistant` block helpers can be used.
|
305 |
+
|
306 |
+
The following is the default `chatPromptTemplate`, although newlines and indentiation have been added for readability. You can find the prompts used in production for HuggingChat [here](https://github.com/huggingface/chat-ui/blob/main/PROMPTS.md).
|
307 |
+
|
308 |
+
```prompt
|
309 |
+
{{preprompt}}
|
310 |
+
{{#each messages}}
|
311 |
+
{{#ifUser}}{{@root.userMessageToken}}{{content}}{{@root.userMessageEndToken}}{{/ifUser}}
|
312 |
+
{{#ifAssistant}}{{@root.assistantMessageToken}}{{content}}{{@root.assistantMessageEndToken}}{{/ifAssistant}}
|
313 |
+
{{/each}}
|
314 |
+
{{assistantMessageToken}}
|
315 |
+
```
|
316 |
+
|
317 |
+
#### Multi modal model
|
318 |
+
|
319 |
+
We currently support [IDEFICS](https://huggingface.co/blog/idefics) (hosted on TGI), OpenAI and Claude 3 as multimodal models. You can enable it by setting `multimodal: true` in your `MODELS` configuration. For IDEFICS, you must have a [PRO HF Api token](https://huggingface.co/settings/tokens). For OpenAI, see the [OpenAI section](#openai-api-compatible-models). For Anthropic, see the [Anthropic section](#anthropic).
|
320 |
+
|
321 |
+
```env
|
322 |
+
{
|
323 |
+
"name": "HuggingFaceM4/idefics-80b-instruct",
|
324 |
+
"multimodal" : true,
|
325 |
+
"description": "IDEFICS is the new multimodal model by Hugging Face.",
|
326 |
+
"preprompt": "",
|
327 |
+
"chatPromptTemplate" : "{{#each messages}}{{#ifUser}}User: {{content}}{{/ifUser}}<end_of_utterance>\nAssistant: {{#ifAssistant}}{{content}}\n{{/ifAssistant}}{{/each}}",
|
328 |
+
"parameters": {
|
329 |
+
"temperature": 0.1,
|
330 |
+
"top_p": 0.95,
|
331 |
+
"repetition_penalty": 1.2,
|
332 |
+
"top_k": 12,
|
333 |
+
"truncate": 1000,
|
334 |
+
"max_new_tokens": 1024,
|
335 |
+
"stop": ["<end_of_utterance>", "User:", "\nUser:"]
|
336 |
+
}
|
337 |
+
}
|
338 |
+
```
|
339 |
+
|
340 |
+
#### Running your own models using a custom endpoint
|
341 |
+
|
342 |
+
If you want to, instead of hitting models on the Hugging Face Inference API, you can run your own models locally.
|
343 |
+
|
344 |
+
A good option is to hit a [text-generation-inference](https://github.com/huggingface/text-generation-inference) endpoint. This is what is done in the official [Chat UI Spaces Docker template](https://huggingface.co/new-space?template=huggingchat/chat-ui-template) for instance: both this app and a text-generation-inference server run inside the same container.
|
345 |
+
|
346 |
+
To do this, you can add your own endpoints to the `MODELS` variable in `.env.local`, by adding an `"endpoints"` key for each model in `MODELS`.
|
347 |
+
|
348 |
+
```env
|
349 |
+
{
|
350 |
+
// rest of the model config here
|
351 |
+
"endpoints": [{
|
352 |
+
"type" : "tgi",
|
353 |
+
"url": "https://HOST:PORT",
|
354 |
+
}]
|
355 |
+
}
|
356 |
+
```
|
357 |
+
|
358 |
+
If `endpoints` are left unspecified, ChatUI will look for the model on the hosted Hugging Face inference API using the model name.
|
359 |
+
|
360 |
+
##### OpenAI API compatible models
|
361 |
+
|
362 |
+
Chat UI can be used with any API server that supports OpenAI API compatibility, for example [text-generation-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai), [LocalAI](https://github.com/go-skynet/LocalAI), [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md), [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), and [ialacol](https://github.com/chenhunghan/ialacol) and [vllm](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html).
|
363 |
+
|
364 |
+
The following example config makes Chat UI works with [text-generation-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai), the `endpoint.baseUrl` is the url of the OpenAI API compatible server, this overrides the baseUrl to be used by OpenAI instance. The `endpoint.completion` determine which endpoint to be used, default is `chat_completions` which uses `v1/chat/completions`, change to `endpoint.completion` to `completions` to use the `v1/completions` endpoint.
|
365 |
+
|
366 |
+
Parameters not supported by OpenAI (e.g., top_k, repetition_penalty, etc.) must be set in the extraBody of endpoints. Be aware that setting them in parameters will cause them to be omitted.
|
367 |
+
|
368 |
+
```
|
369 |
+
MODELS=`[
|
370 |
+
{
|
371 |
+
"name": "text-generation-webui",
|
372 |
+
"id": "text-generation-webui",
|
373 |
+
"parameters": {
|
374 |
+
"temperature": 0.9,
|
375 |
+
"top_p": 0.95,
|
376 |
+
"max_new_tokens": 1024,
|
377 |
+
"stop": []
|
378 |
+
},
|
379 |
+
"endpoints": [{
|
380 |
+
"type" : "openai",
|
381 |
+
"baseURL": "http://localhost:8000/v1",
|
382 |
+
"extraBody": {
|
383 |
+
"repetition_penalty": 1.2,
|
384 |
+
"top_k": 50,
|
385 |
+
"truncate": 1000
|
386 |
+
}
|
387 |
+
}]
|
388 |
+
}
|
389 |
+
]`
|
390 |
+
|
391 |
+
```
|
392 |
+
|
393 |
+
The `openai` type includes official OpenAI models. You can add, for example, GPT4/GPT3.5 as a "openai" model:
|
394 |
+
|
395 |
+
```
|
396 |
+
OPENAI_API_KEY=#your openai api key here
|
397 |
+
MODELS=`[{
|
398 |
+
"name": "gpt-4",
|
399 |
+
"displayName": "GPT 4",
|
400 |
+
"endpoints" : [{
|
401 |
+
"type": "openai"
|
402 |
+
}]
|
403 |
+
},
|
404 |
+
{
|
405 |
+
"name": "gpt-3.5-turbo",
|
406 |
+
"displayName": "GPT 3.5 Turbo",
|
407 |
+
"endpoints" : [{
|
408 |
+
"type": "openai"
|
409 |
+
}]
|
410 |
+
}]`
|
411 |
+
```
|
412 |
+
|
413 |
+
You may also consume any model provider that provides compatible OpenAI API endpoint. For example, you may self-host [Portkey](https://github.com/Portkey-AI/gateway) gateway and experiment with Claude or GPTs offered by Azure OpenAI. Example for Claude from Anthropic:
|
414 |
+
|
415 |
+
```
|
416 |
+
MODELS=`[{
|
417 |
+
"name": "claude-2.1",
|
418 |
+
"displayName": "Claude 2.1",
|
419 |
+
"description": "Anthropic has been founded by former OpenAI researchers...",
|
420 |
+
"parameters": {
|
421 |
+
"temperature": 0.5,
|
422 |
+
"max_new_tokens": 4096,
|
423 |
+
},
|
424 |
+
"endpoints": [
|
425 |
+
{
|
426 |
+
"type": "openai",
|
427 |
+
"baseURL": "https://gateway.example.com/v1",
|
428 |
+
"defaultHeaders": {
|
429 |
+
"x-portkey-config": '{"provider":"anthropic","api_key":"sk-ant-abc...xyz"}'
|
430 |
+
}
|
431 |
+
}
|
432 |
+
]
|
433 |
+
}]`
|
434 |
+
```
|
435 |
+
|
436 |
+
Example for GPT 4 deployed on Azure OpenAI:
|
437 |
+
|
438 |
+
```
|
439 |
+
MODELS=`[{
|
440 |
+
"id": "gpt-4-1106-preview",
|
441 |
+
"name": "gpt-4-1106-preview",
|
442 |
+
"displayName": "gpt-4-1106-preview",
|
443 |
+
"parameters": {
|
444 |
+
"temperature": 0.5,
|
445 |
+
"max_new_tokens": 4096,
|
446 |
+
},
|
447 |
+
"endpoints": [
|
448 |
+
{
|
449 |
+
"type": "openai",
|
450 |
+
"baseURL": "https://{resource-name}.openai.azure.com/openai/deployments/{deployment-id}",
|
451 |
+
"defaultHeaders": {
|
452 |
+
"api-key": "{api-key}"
|
453 |
+
},
|
454 |
+
"defaultQuery": {
|
455 |
+
"api-version": "2023-05-15"
|
456 |
+
}
|
457 |
+
}
|
458 |
+
]
|
459 |
+
}]`
|
460 |
+
```
|
461 |
+
|
462 |
+
Or try Mistral from [Deepinfra](https://deepinfra.com/mistralai/Mistral-7B-Instruct-v0.1/api?example=openai-http):
|
463 |
+
|
464 |
+
> Note, apiKey can either be set custom per endpoint, or globally using `OPENAI_API_KEY` variable.
|
465 |
+
|
466 |
+
```
|
467 |
+
MODELS=`[{
|
468 |
+
"name": "mistral-7b",
|
469 |
+
"displayName": "Mistral 7B",
|
470 |
+
"description": "A 7B dense Transformer, fast-deployed and easily customisable. Small, yet powerful for a variety of use cases. Supports English and code, and a 8k context window.",
|
471 |
+
"parameters": {
|
472 |
+
"temperature": 0.5,
|
473 |
+
"max_new_tokens": 4096,
|
474 |
+
},
|
475 |
+
"endpoints": [
|
476 |
+
{
|
477 |
+
"type": "openai",
|
478 |
+
"baseURL": "https://api.deepinfra.com/v1/openai",
|
479 |
+
"apiKey": "abc...xyz"
|
480 |
+
}
|
481 |
+
]
|
482 |
+
}]`
|
483 |
+
```
|
484 |
+
|
485 |
+
##### Llama.cpp API server
|
486 |
+
|
487 |
+
chat-ui also supports the llama.cpp API server directly without the need for an adapter. You can do this using the `llamacpp` endpoint type.
|
488 |
+
|
489 |
+
If you want to run Chat UI with llama.cpp, you can do the following, using [microsoft/Phi-3-mini-4k-instruct-gguf](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf) as an example model:
|
490 |
+
|
491 |
+
```bash
|
492 |
+
# install llama.cpp
|
493 |
+
brew install llama.cpp
|
494 |
+
# start llama.cpp server
|
495 |
+
llama-server --hf-repo microsoft/Phi-3-mini-4k-instruct-gguf --hf-file Phi-3-mini-4k-instruct-q4.gguf -c 4096
|
496 |
+
```
|
497 |
+
|
498 |
+
```env
|
499 |
+
MODELS=`[
|
500 |
+
{
|
501 |
+
"name": "Local Zephyr",
|
502 |
+
"chatPromptTemplate": "<|system|>\n{{preprompt}}</s>\n{{#each messages}}{{#ifUser}}<|user|>\n{{content}}</s>\n<|assistant|>\n{{/ifUser}}{{#ifAssistant}}{{content}}</s>\n{{/ifAssistant}}{{/each}}",
|
503 |
+
"parameters": {
|
504 |
+
"temperature": 0.1,
|
505 |
+
"top_p": 0.95,
|
506 |
+
"repetition_penalty": 1.2,
|
507 |
+
"top_k": 50,
|
508 |
+
"truncate": 1000,
|
509 |
+
"max_new_tokens": 2048,
|
510 |
+
"stop": ["</s>"]
|
511 |
+
},
|
512 |
+
"endpoints": [
|
513 |
+
{
|
514 |
+
"url": "http://127.0.0.1:8080",
|
515 |
+
"type": "llamacpp"
|
516 |
+
}
|
517 |
+
]
|
518 |
+
}
|
519 |
+
]`
|
520 |
+
```
|
521 |
+
|
522 |
+
Start chat-ui with `npm run dev` and you should be able to chat with Zephyr locally.
|
523 |
+
|
524 |
+
#### Ollama
|
525 |
+
|
526 |
+
We also support the Ollama inference server. Spin up a model with
|
527 |
+
|
528 |
+
```cli
|
529 |
+
ollama run mistral
|
530 |
+
```
|
531 |
+
|
532 |
+
Then specify the endpoints like so:
|
533 |
+
|
534 |
+
```env
|
535 |
+
MODELS=`[
|
536 |
+
{
|
537 |
+
"name": "Ollama Mistral",
|
538 |
+
"chatPromptTemplate": "<s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}} {{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s> {{/ifAssistant}}{{/each}}",
|
539 |
+
"parameters": {
|
540 |
+
"temperature": 0.1,
|
541 |
+
"top_p": 0.95,
|
542 |
+
"repetition_penalty": 1.2,
|
543 |
+
"top_k": 50,
|
544 |
+
"truncate": 3072,
|
545 |
+
"max_new_tokens": 1024,
|
546 |
+
"stop": ["</s>"]
|
547 |
+
},
|
548 |
+
"endpoints": [
|
549 |
+
{
|
550 |
+
"type": "ollama",
|
551 |
+
"url" : "http://127.0.0.1:11434",
|
552 |
+
"ollamaName" : "mistral"
|
553 |
+
}
|
554 |
+
]
|
555 |
+
}
|
556 |
+
]`
|
557 |
+
```
|
558 |
+
|
559 |
+
#### Anthropic
|
560 |
+
|
561 |
+
We also support Anthropic models (including multimodal ones via `multmodal: true`) through the official SDK. You may provide your API key via the `ANTHROPIC_API_KEY` env variable, or alternatively, through the `endpoints.apiKey` as per the following example.
|
562 |
+
|
563 |
+
```
|
564 |
+
MODELS=`[
|
565 |
+
{
|
566 |
+
"name": "claude-3-haiku-20240307",
|
567 |
+
"displayName": "Claude 3 Haiku",
|
568 |
+
"description": "Fastest and most compact model for near-instant responsiveness",
|
569 |
+
"multimodal": true,
|
570 |
+
"parameters": {
|
571 |
+
"max_new_tokens": 4096,
|
572 |
+
},
|
573 |
+
"endpoints": [
|
574 |
+
{
|
575 |
+
"type": "anthropic",
|
576 |
+
// optionals
|
577 |
+
"apiKey": "sk-ant-...",
|
578 |
+
"baseURL": "https://api.anthropic.com",
|
579 |
+
"defaultHeaders": {},
|
580 |
+
"defaultQuery": {}
|
581 |
+
}
|
582 |
+
]
|
583 |
+
},
|
584 |
+
{
|
585 |
+
"name": "claude-3-sonnet-20240229",
|
586 |
+
"displayName": "Claude 3 Sonnet",
|
587 |
+
"description": "Ideal balance of intelligence and speed",
|
588 |
+
"multimodal": true,
|
589 |
+
"parameters": {
|
590 |
+
"max_new_tokens": 4096,
|
591 |
+
},
|
592 |
+
"endpoints": [
|
593 |
+
{
|
594 |
+
"type": "anthropic",
|
595 |
+
// optionals
|
596 |
+
"apiKey": "sk-ant-...",
|
597 |
+
"baseURL": "https://api.anthropic.com",
|
598 |
+
"defaultHeaders": {},
|
599 |
+
"defaultQuery": {}
|
600 |
+
}
|
601 |
+
]
|
602 |
+
},
|
603 |
+
{
|
604 |
+
"name": "claude-3-opus-20240229",
|
605 |
+
"displayName": "Claude 3 Opus",
|
606 |
+
"description": "Most powerful model for highly complex tasks",
|
607 |
+
"multimodal": true,
|
608 |
+
"parameters": {
|
609 |
+
"max_new_tokens": 4096
|
610 |
+
},
|
611 |
+
"endpoints": [
|
612 |
+
{
|
613 |
+
"type": "anthropic",
|
614 |
+
// optionals
|
615 |
+
"apiKey": "sk-ant-...",
|
616 |
+
"baseURL": "https://api.anthropic.com",
|
617 |
+
"defaultHeaders": {},
|
618 |
+
"defaultQuery": {}
|
619 |
+
}
|
620 |
+
]
|
621 |
+
}
|
622 |
+
]`
|
623 |
+
```
|
624 |
+
|
625 |
+
We also support using Anthropic models running on Vertex AI. Authentication is done using Google Application Default Credentials. Project ID can be provided through the `endpoints.projectId` as per the following example:
|
626 |
+
|
627 |
+
```
|
628 |
+
MODELS=`[
|
629 |
+
{
|
630 |
+
"name": "claude-3-sonnet@20240229",
|
631 |
+
"displayName": "Claude 3 Sonnet",
|
632 |
+
"description": "Ideal balance of intelligence and speed",
|
633 |
+
"multimodal": true,
|
634 |
+
"parameters": {
|
635 |
+
"max_new_tokens": 4096,
|
636 |
+
},
|
637 |
+
"endpoints": [
|
638 |
+
{
|
639 |
+
"type": "anthropic-vertex",
|
640 |
+
"region": "us-central1",
|
641 |
+
"projectId": "gcp-project-id",
|
642 |
+
// optionals
|
643 |
+
"defaultHeaders": {},
|
644 |
+
"defaultQuery": {}
|
645 |
+
}
|
646 |
+
]
|
647 |
+
},
|
648 |
+
{
|
649 |
+
"name": "claude-3-haiku@20240307",
|
650 |
+
"displayName": "Claude 3 Haiku",
|
651 |
+
"description": "Fastest, most compact model for near-instant responsiveness",
|
652 |
+
"multimodal": true,
|
653 |
+
"parameters": {
|
654 |
+
"max_new_tokens": 4096
|
655 |
+
},
|
656 |
+
"endpoints": [
|
657 |
+
{
|
658 |
+
"type": "anthropic-vertex",
|
659 |
+
"region": "us-central1",
|
660 |
+
"projectId": "gcp-project-id",
|
661 |
+
// optionals
|
662 |
+
"defaultHeaders": {},
|
663 |
+
"defaultQuery": {}
|
664 |
+
}
|
665 |
+
]
|
666 |
+
}
|
667 |
+
]`
|
668 |
+
```
|
669 |
+
|
670 |
+
#### Amazon
|
671 |
+
|
672 |
+
You can also specify your Amazon SageMaker instance as an endpoint for chat-ui. The config goes like this:
|
673 |
+
|
674 |
+
```env
|
675 |
+
"endpoints": [
|
676 |
+
{
|
677 |
+
"type" : "aws",
|
678 |
+
"service" : "sagemaker"
|
679 |
+
"url": "",
|
680 |
+
"accessKey": "",
|
681 |
+
"secretKey" : "",
|
682 |
+
"sessionToken": "",
|
683 |
+
"region": "",
|
684 |
+
|
685 |
+
"weight": 1
|
686 |
+
}
|
687 |
+
]
|
688 |
+
```
|
689 |
+
|
690 |
+
You can also set `"service" : "lambda"` to use a lambda instance.
|
691 |
+
|
692 |
+
You can get the `accessKey` and `secretKey` from your AWS user, under programmatic access.
|
693 |
+
|
694 |
+
#### Cloudflare Workers AI
|
695 |
+
|
696 |
+
You can also use Cloudflare Workers AI to run your own models with serverless inference.
|
697 |
+
|
698 |
+
You will need to have a Cloudflare account, then get your [account ID](https://developers.cloudflare.com/fundamentals/setup/find-account-and-zone-ids/) as well as your [API token](https://developers.cloudflare.com/workers-ai/get-started/rest-api/#1-get-api-token-and-account-id) for Workers AI.
|
699 |
+
|
700 |
+
You can either specify them directly in your `.env.local` using the `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` variables, or you can set them directly in the endpoint config.
|
701 |
+
|
702 |
+
You can find the list of models available on Cloudflare [here](https://developers.cloudflare.com/workers-ai/models/#text-generation).
|
703 |
+
|
704 |
+
```env
|
705 |
+
{
|
706 |
+
"name" : "nousresearch/hermes-2-pro-mistral-7b",
|
707 |
+
"tokenizer": "nousresearch/hermes-2-pro-mistral-7b",
|
708 |
+
"parameters": {
|
709 |
+
"stop": ["<|im_end|>"]
|
710 |
+
},
|
711 |
+
"endpoints" : [
|
712 |
+
{
|
713 |
+
"type" : "cloudflare"
|
714 |
+
<!-- optionally specify these
|
715 |
+
"accountId": "your-account-id",
|
716 |
+
"authToken": "your-api-token"
|
717 |
+
-->
|
718 |
+
}
|
719 |
+
]
|
720 |
+
}
|
721 |
+
```
|
722 |
+
|
723 |
+
#### Cohere
|
724 |
+
|
725 |
+
You can also use Cohere to run their models directly from chat-ui. You will need to have a Cohere account, then get your [API token](https://dashboard.cohere.com/api-keys). You can either specify it directly in your `.env.local` using the `COHERE_API_TOKEN` variable, or you can set it in the endpoint config.
|
726 |
+
|
727 |
+
Here is an example of a Cohere model config. You can set which model you want to use by setting the `id` field to the model name.
|
728 |
+
|
729 |
+
```env
|
730 |
+
{
|
731 |
+
"name" : "CohereForAI/c4ai-command-r-v01",
|
732 |
+
"id": "command-r",
|
733 |
+
"description": "C4AI Command-R is a research release of a 35 billion parameter highly performant generative model",
|
734 |
+
"endpoints": [
|
735 |
+
{
|
736 |
+
"type": "cohere",
|
737 |
+
<!-- optionally specify these, or use COHERE_API_TOKEN
|
738 |
+
"apiKey": "your-api-token"
|
739 |
+
-->
|
740 |
+
}
|
741 |
+
]
|
742 |
+
}
|
743 |
+
```
|
744 |
+
|
745 |
+
##### Google Vertex models
|
746 |
+
|
747 |
+
Chat UI can connect to the google Vertex API endpoints ([List of supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models)).
|
748 |
+
|
749 |
+
To enable:
|
750 |
+
|
751 |
+
1. [Select](https://console.cloud.google.com/project) or [create](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project) a Google Cloud project.
|
752 |
+
1. [Enable billing for your project](https://cloud.google.com/billing/docs/how-to/modify-project).
|
753 |
+
1. [Enable the Vertex AI API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com).
|
754 |
+
1. [Set up authentication with a service account](https://cloud.google.com/docs/authentication/getting-started)
|
755 |
+
so you can access the API from your local workstation.
|
756 |
+
|
757 |
+
The service account credentials file can be imported as an environmental variable:
|
758 |
+
|
759 |
+
```env
|
760 |
+
GOOGLE_APPLICATION_CREDENTIALS = clientid.json
|
761 |
+
```
|
762 |
+
|
763 |
+
Make sure your docker container has access to the file and the variable is correctly set.
|
764 |
+
Afterwards Google Vertex endpoints can be configured as following:
|
765 |
+
|
766 |
+
```
|
767 |
+
MODELS=`[
|
768 |
+
//...
|
769 |
+
{
|
770 |
+
"name": "gemini-1.5-pro",
|
771 |
+
"displayName": "Vertex Gemini Pro 1.5",
|
772 |
+
"multimodal": true,
|
773 |
+
"endpoints" : [{
|
774 |
+
"type": "vertex",
|
775 |
+
"project": "abc-xyz",
|
776 |
+
"location": "europe-west3",
|
777 |
+
"extraBody": {
|
778 |
+
"model_version": "gemini-1.5-pro-preview-0409",
|
779 |
+
},
|
780 |
+
|
781 |
+
// Optional
|
782 |
+
"safetyThreshold": "BLOCK_MEDIUM_AND_ABOVE",
|
783 |
+
"apiEndpoint": "", // alternative api endpoint url,
|
784 |
+
"tools": [{
|
785 |
+
"googleSearchRetrieval": {
|
786 |
+
"disableAttribution": true
|
787 |
+
}
|
788 |
+
}],
|
789 |
+
"multimodal": {
|
790 |
+
"image": {
|
791 |
+
"supportedMimeTypes": ["image/png", "image/jpeg", "image/webp"],
|
792 |
+
"preferredMimeType": "image/png",
|
793 |
+
"maxSizeInMB": 5,
|
794 |
+
"maxWidth": 2000,
|
795 |
+
"maxHeight": 1000,
|
796 |
+
}
|
797 |
+
}
|
798 |
+
}]
|
799 |
+
},
|
800 |
+
]`
|
801 |
+
|
802 |
+
```
|
803 |
+
|
804 |
+
##### LangServe
|
805 |
+
|
806 |
+
LangChain applications that are deployed using LangServe can be called with the following config:
|
807 |
+
|
808 |
+
```
|
809 |
+
MODELS=`[
|
810 |
+
//...
|
811 |
+
{
|
812 |
+
"name": "summarization-chain", //model-name
|
813 |
+
"endpoints" : [{
|
814 |
+
"type": "langserve",
|
815 |
+
"url" : "http://127.0.0.1:8100",
|
816 |
+
}]
|
817 |
+
},
|
818 |
+
]`
|
819 |
+
|
820 |
+
```
|
821 |
+
|
822 |
+
### Custom endpoint authorization
|
823 |
+
|
824 |
+
#### Basic and Bearer
|
825 |
+
|
826 |
+
Custom endpoints may require authorization, depending on how you configure them. Authentication will usually be set either with `Basic` or `Bearer`.
|
827 |
+
|
828 |
+
For `Basic` we will need to generate a base64 encoding of the username and password.
|
829 |
+
|
830 |
+
`echo -n "USER:PASS" | base64`
|
831 |
+
|
832 |
+
> VVNFUjpQQVNT
|
833 |
+
|
834 |
+
For `Bearer` you can use a token, which can be grabbed from [here](https://huggingface.co/settings/tokens).
|
835 |
+
|
836 |
+
You can then add the generated information and the `authorization` parameter to your `.env.local`.
|
837 |
+
|
838 |
+
```env
|
839 |
+
"endpoints": [
|
840 |
+
{
|
841 |
+
"url": "https://HOST:PORT",
|
842 |
+
"authorization": "Basic VVNFUjpQQVNT",
|
843 |
+
}
|
844 |
+
]
|
845 |
+
```
|
846 |
+
|
847 |
+
Please note that if `HF_TOKEN` is also set or not empty, it will take precedence.
|
848 |
+
|
849 |
+
#### Models hosted on multiple custom endpoints
|
850 |
+
|
851 |
+
If the model being hosted will be available on multiple servers/instances add the `weight` parameter to your `.env.local`. The `weight` will be used to determine the probability of requesting a particular endpoint.
|
852 |
+
|
853 |
+
```env
|
854 |
+
"endpoints": [
|
855 |
+
{
|
856 |
+
"url": "https://HOST:PORT",
|
857 |
+
"weight": 1
|
858 |
+
},
|
859 |
+
{
|
860 |
+
"url": "https://HOST:PORT",
|
861 |
+
"weight": 2
|
862 |
+
}
|
863 |
+
...
|
864 |
+
]
|
865 |
+
```
|
866 |
+
|
867 |
+
#### Client Certificate Authentication (mTLS)
|
868 |
+
|
869 |
+
Custom endpoints may require client certificate authentication, depending on how you configure them. To enable mTLS between Chat UI and your custom endpoint, you will need to set the `USE_CLIENT_CERTIFICATE` to `true`, and add the `CERT_PATH` and `KEY_PATH` parameters to your `.env.local`. These parameters should point to the location of the certificate and key files on your local machine. The certificate and key files should be in PEM format. The key file can be encrypted with a passphrase, in which case you will also need to add the `CLIENT_KEY_PASSWORD` parameter to your `.env.local`.
|
870 |
+
|
871 |
+
If you're using a certificate signed by a private CA, you will also need to add the `CA_PATH` parameter to your `.env.local`. This parameter should point to the location of the CA certificate file on your local machine.
|
872 |
+
|
873 |
+
If you're using a self-signed certificate, e.g. for testing or development purposes, you can set the `REJECT_UNAUTHORIZED` parameter to `false` in your `.env.local`. This will disable certificate validation, and allow Chat UI to connect to your custom endpoint.
|
874 |
+
|
875 |
+
#### Specific Embedding Model
|
876 |
+
|
877 |
+
A model can use any of the embedding models defined in `.env.local`, (currently used when web searching),
|
878 |
+
by default it will use the first embedding model, but it can be changed with the field `embeddingModel`:
|
879 |
+
|
880 |
+
```env
|
881 |
+
TEXT_EMBEDDING_MODELS = `[
|
882 |
+
{
|
883 |
+
"name": "Xenova/gte-small",
|
884 |
+
"chunkCharLength": 512,
|
885 |
+
"endpoints": [
|
886 |
+
{"type": "transformersjs"}
|
887 |
+
]
|
888 |
+
},
|
889 |
+
{
|
890 |
+
"name": "intfloat/e5-base-v2",
|
891 |
+
"chunkCharLength": 768,
|
892 |
+
"endpoints": [
|
893 |
+
{"type": "tei", "url": "http://127.0.0.1:8080/", "authorization": "Basic VVNFUjpQQVNT"},
|
894 |
+
{"type": "tei", "url": "http://127.0.0.1:8081/"}
|
895 |
+
]
|
896 |
+
}
|
897 |
+
]`
|
898 |
+
|
899 |
+
MODELS=`[
|
900 |
+
{
|
901 |
+
"name": "Ollama Mistral",
|
902 |
+
"chatPromptTemplate": "...",
|
903 |
+
"embeddingModel": "intfloat/e5-base-v2"
|
904 |
+
"parameters": {
|
905 |
+
...
|
906 |
+
},
|
907 |
+
"endpoints": [
|
908 |
+
...
|
909 |
+
]
|
910 |
+
}
|
911 |
+
]`
|
912 |
+
```
|
913 |
+
|
914 |
+
## Common issues
|
915 |
+
|
916 |
+
### 403:You don't have access to this conversation
|
917 |
+
|
918 |
+
Most likely you are running chat-ui over HTTP. The recommended option is to setup something like NGINX to handle HTTPS and proxy the requests to chat-ui. If you really need to run over HTTP you can add `COOKIE_SECURE=false` and `COOKIE_SAMESITE=lax` to your `.env.local`.
|
919 |
+
|
920 |
+
Make sure to set your `PUBLIC_ORIGIN` in your `.env.local` to the correct URL as well.
|
921 |
+
|
922 |
+
## Deploying to a HF Space
|
923 |
+
|
924 |
+
Create a `DOTENV_LOCAL` secret to your HF space with the content of your .env.local, and they will be picked up automatically when you run.
|
925 |
+
|
926 |
+
## Building
|
927 |
+
|
928 |
+
To create a production version of your app:
|
929 |
+
|
930 |
+
```bash
|
931 |
+
npm run build
|
932 |
+
```
|
933 |
+
|
934 |
+
You can preview the production build with `npm run preview`.
|
935 |
+
|
936 |
+
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
937 |
+
|
938 |
+
## Config changes for HuggingChat
|
939 |
+
|
940 |
+
The config file for HuggingChat is stored in the `chart/env/prod.yaml` file. It is the source of truth for the environment variables used for our CI/CD pipeline. For HuggingChat, as we need to customize the app color, as well as the base path, we build a custom docker image. You can find the workflow here.
|
941 |
+
|
942 |
+
> [!TIP]
|
943 |
+
> If you want to make changes to the model config used in production for HuggingChat, you should do so against `chart/env/prod.yaml`.
|
944 |
+
|
945 |
+
### Running a copy of HuggingChat locally
|
946 |
+
|
947 |
+
If you want to run an exact copy of HuggingChat locally, you will need to do the following first:
|
948 |
+
|
949 |
+
1. Create an [OAuth App on the hub](https://huggingface.co/settings/applications/new) with `openid profile email` permissions. Make sure to set the callback URL to something like `http://localhost:5173/chat/login/callback` which matches the right path for your local instance.
|
950 |
+
2. Create a [HF Token](https://huggingface.co/settings/tokens) with your Hugging Face account. You will need a Pro account to be able to access some of the larger models available through HuggingChat.
|
951 |
+
3. Create a free account with [serper.dev](https://serper.dev/) (you will get 2500 free search queries)
|
952 |
+
4. Run an instance of mongoDB, however you want. (Local or remote)
|
953 |
+
|
954 |
+
You can then create a new `.env.SECRET_CONFIG` file with the following content
|
955 |
+
|
956 |
+
```env
|
957 |
+
MONGODB_URL=<link to your mongo DB from step 4>
|
958 |
+
HF_TOKEN=<your HF token from step 2>
|
959 |
+
OPENID_CONFIG=`{
|
960 |
+
PROVIDER_URL: "https://huggingface.co",
|
961 |
+
CLIENT_ID: "<your client ID from step 1>",
|
962 |
+
CLIENT_SECRET: "<your client secret from step 1>",
|
963 |
+
}`
|
964 |
+
SERPER_API_KEY=<your serper API key from step 3>
|
965 |
+
MESSAGES_BEFORE_LOGIN=<can be any numerical value, or set to 0 to require login>
|
966 |
+
```
|
967 |
+
|
968 |
+
You can then run `npm run updateLocalEnv` in the root of chat-ui. This will create a `.env.local` file which combines the `chart/env/prod.yaml` and the `.env.SECRET_CONFIG` file. You can then run `npm run dev` to start your local instance of HuggingChat.
|
969 |
+
|
970 |
+
### Populate database
|
971 |
+
|
972 |
+
> [!WARNING]
|
973 |
+
> The `MONGODB_URL` used for this script will be fetched from `.env.local`. Make sure it's correct! The command runs directly on the database.
|
974 |
+
|
975 |
+
You can populate the database using faker data using the `populate` script:
|
976 |
+
|
977 |
+
```bash
|
978 |
+
npm run populate <flags here>
|
979 |
+
```
|
980 |
+
|
981 |
+
At least one flag must be specified, the following flags are available:
|
982 |
+
|
983 |
+
- `reset` - resets the database
|
984 |
+
- `all` - populates all tables
|
985 |
+
- `users` - populates the users table
|
986 |
+
- `settings` - populates the settings table for existing users
|
987 |
+
- `assistants` - populates the assistants table for existing users
|
988 |
+
- `conversations` - populates the conversations table for existing users
|
989 |
+
|
990 |
+
For example, you could use it like so:
|
991 |
+
|
992 |
+
```bash
|
993 |
+
npm run populate reset
|
994 |
+
```
|
995 |
+
|
996 |
+
to clear out the database. Then login in the app to create your user and run the following command:
|
997 |
+
|
998 |
+
```bash
|
999 |
+
npm run populate users settings assistants conversations
|
1000 |
+
```
|
1001 |
+
|
1002 |
+
to populate the database with fake data, including fake conversations and assistants for your user.
|
1003 |
+
|
1004 |
+
### Building the docker images locally
|
1005 |
+
|
1006 |
+
You can build the docker images locally using the following commands:
|
1007 |
+
|
1008 |
+
```bash
|
1009 |
+
docker build -t chat-ui-db:latest --build-arg INCLUDE_DB=true .
|
1010 |
+
docker build -t chat-ui:latest --build-arg INCLUDE_DB=false .
|
1011 |
+
docker build -t huggingchat:latest --build-arg INCLUDE_DB=false --build-arg APP_BASE=/chat --build-arg PUBLIC_APP_COLOR=yellow .
|
1012 |
+
```
|
chat-ui-main/chart/Chart.yaml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
apiVersion: v2
|
2 |
+
name: chat-ui
|
3 |
+
version: 0.0.0-latest
|
4 |
+
type: application
|
5 |
+
icon: https://huggingface.co/front/assets/huggingface_logo-noborder.svg
|
chat-ui-main/chart/env/prod.yaml
ADDED
@@ -0,0 +1,587 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
image:
|
2 |
+
repository: huggingface
|
3 |
+
name: chat-ui
|
4 |
+
|
5 |
+
nodeSelector:
|
6 |
+
role-hub-utils: "true"
|
7 |
+
|
8 |
+
tolerations:
|
9 |
+
- key: CriticalAddonsOnly
|
10 |
+
operator: Equal
|
11 |
+
|
12 |
+
serviceAccount:
|
13 |
+
enabled: true
|
14 |
+
create: true
|
15 |
+
name: huggingchat-prod
|
16 |
+
|
17 |
+
networkPolicy:
|
18 |
+
enabled: true
|
19 |
+
allowedBlocks:
|
20 |
+
- 10.0.252.0/25
|
21 |
+
- 10.240.0.0/24
|
22 |
+
|
23 |
+
ingress:
|
24 |
+
path: "/chat"
|
25 |
+
annotations:
|
26 |
+
alb.ingress.kubernetes.io/healthcheck-path: "/healthcheck"
|
27 |
+
alb.ingress.kubernetes.io/listen-ports: "[{\"HTTP\": 80}, {\"HTTPS\": 443}]"
|
28 |
+
alb.ingress.kubernetes.io/group.name: "hub-prod"
|
29 |
+
alb.ingress.kubernetes.io/scheme: "internet-facing"
|
30 |
+
alb.ingress.kubernetes.io/ssl-redirect: "443"
|
31 |
+
alb.ingress.kubernetes.io/tags: "Env=prod,Project=hub,Terraform=true"
|
32 |
+
alb.ingress.kubernetes.io/target-node-labels: "role-hub-utils=true"
|
33 |
+
kubernetes.io/ingress.class: "alb"
|
34 |
+
|
35 |
+
envVars:
|
36 |
+
ADDRESS_HEADER: 'X-Forwarded-For'
|
37 |
+
ALTERNATIVE_REDIRECT_URLS: '["huggingchat://login/callback"]'
|
38 |
+
APP_BASE: "/chat"
|
39 |
+
ALLOW_IFRAME: "false"
|
40 |
+
COMMUNITY_TOOLS: "true"
|
41 |
+
COOKIE_SAMESITE: "lax"
|
42 |
+
COOKIE_SECURE: "true"
|
43 |
+
ENABLE_ASSISTANTS: "true"
|
44 |
+
ENABLE_ASSISTANTS_RAG: "true"
|
45 |
+
EXPOSE_API: "true"
|
46 |
+
METRICS_PORT: 5565
|
47 |
+
LOG_LEVEL: "debug"
|
48 |
+
METRICS_ENABLED: "true"
|
49 |
+
MODELS: >
|
50 |
+
[
|
51 |
+
{
|
52 |
+
"name": "Qwen/Qwen2.5-72B-Instruct",
|
53 |
+
"description": "The latest Qwen open model with improved role-playing, long text generation and structured data understanding.",
|
54 |
+
"modelUrl": "https://huggingface.co/Qwen/Qwen2.5-72B-Instruct",
|
55 |
+
"websiteUrl": "https://qwenlm.github.io/blog/qwen2.5/",
|
56 |
+
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/qwen-logo.png",
|
57 |
+
"preprompt": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
|
58 |
+
"parameters": {
|
59 |
+
"stop": ["<|endoftext|>", "<|im_end|>"],
|
60 |
+
"temperature": 0.6,
|
61 |
+
"truncate": 28672,
|
62 |
+
"max_new_tokens": 3072
|
63 |
+
},
|
64 |
+
"tools": true,
|
65 |
+
"promptExamples": [
|
66 |
+
{
|
67 |
+
"title": "Write an email from bullet list",
|
68 |
+
"prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"title": "Code a snake game",
|
72 |
+
"prompt": "Code a basic snake game in python, give explanations for each step."
|
73 |
+
},
|
74 |
+
{
|
75 |
+
"title": "Assist in a task",
|
76 |
+
"prompt": "How do I make a delicious lemon cheesecake?"
|
77 |
+
}
|
78 |
+
]
|
79 |
+
},
|
80 |
+
{
|
81 |
+
"name": "meta-llama/Llama-3.3-70B-Instruct",
|
82 |
+
"id": "meta-llama/Llama-3.3-70B-Instruct",
|
83 |
+
"description": "Ideal for everyday use. A fast and extremely capable model matching closed source models' capabilities. Now with the latest Llama 3.3 weights!",
|
84 |
+
"modelUrl": "https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct",
|
85 |
+
"websiteUrl": "https://llama.meta.com/",
|
86 |
+
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/meta-logo.png",
|
87 |
+
"tools": true,
|
88 |
+
"preprompt": "",
|
89 |
+
"parameters": {
|
90 |
+
"stop": ["<|endoftext|>", "<|eot_id|>"],
|
91 |
+
"temperature": 0.6,
|
92 |
+
"max_new_tokens": 1024,
|
93 |
+
"truncate": 7167
|
94 |
+
},
|
95 |
+
"promptExamples": [
|
96 |
+
{
|
97 |
+
"title": "Write an email from bullet list",
|
98 |
+
"prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
|
99 |
+
},
|
100 |
+
{
|
101 |
+
"title": "Code a snake game",
|
102 |
+
"prompt": "Code a basic snake game in python, give explanations for each step."
|
103 |
+
},
|
104 |
+
{
|
105 |
+
"title": "Assist in a task",
|
106 |
+
"prompt": "How do I make a delicious lemon cheesecake?"
|
107 |
+
}
|
108 |
+
]
|
109 |
+
},
|
110 |
+
{
|
111 |
+
"name": "CohereForAI/c4ai-command-r-plus-08-2024",
|
112 |
+
"description": "Cohere's largest language model, optimized for conversational interaction and tool use. Now with the 2024 update!",
|
113 |
+
"modelUrl": "https://huggingface.co/CohereForAI/c4ai-command-r-plus-08-2024",
|
114 |
+
"websiteUrl": "https://docs.cohere.com/docs/command-r-plus",
|
115 |
+
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/cohere-logo.png",
|
116 |
+
"tools": true,
|
117 |
+
"parameters": {
|
118 |
+
"stop": ["<|END_OF_TURN_TOKEN|>"],
|
119 |
+
"truncate": 28672,
|
120 |
+
"max_new_tokens": 2048,
|
121 |
+
"temperature": 0.3
|
122 |
+
},
|
123 |
+
"promptExamples": [
|
124 |
+
{
|
125 |
+
"title": "Generate a mouse portrait",
|
126 |
+
"prompt": "Generate the portrait of a scientific mouse in its laboratory."
|
127 |
+
},
|
128 |
+
{
|
129 |
+
"title": "Review a pull request",
|
130 |
+
"prompt": "Review this pull request: https://github.com/huggingface/chat-ui/pull/1131/files"
|
131 |
+
},
|
132 |
+
{
|
133 |
+
"title": "Code a snake game",
|
134 |
+
"prompt": "Code a basic snake game in python, give explanations for each step."
|
135 |
+
}
|
136 |
+
]
|
137 |
+
},
|
138 |
+
{
|
139 |
+
"name": "Qwen/QwQ-32B-Preview",
|
140 |
+
"preprompt": "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step.",
|
141 |
+
"modelUrl": "https://huggingface.co/Qwen/QwQ-32B-Preview",
|
142 |
+
"websiteUrl": "https://qwenlm.github.io/blog/qwq-32b-preview/",
|
143 |
+
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/qwen-logo.png",
|
144 |
+
"description": "QwQ is an experiment model from the Qwen Team with advanced reasoning capabilities.",
|
145 |
+
"reasoning": {
|
146 |
+
"type": "summarize"
|
147 |
+
},
|
148 |
+
"parameters": {
|
149 |
+
"stop": ["<|im_end|>"],
|
150 |
+
"truncate": 12288,
|
151 |
+
"max_new_tokens": 4096,
|
152 |
+
"temperature": 0.7,
|
153 |
+
"top_k": 20,
|
154 |
+
"top_p": 0.8,
|
155 |
+
"repetition_penalty": 1.05
|
156 |
+
},
|
157 |
+
"promptExamples": [
|
158 |
+
{
|
159 |
+
"title": "Rs in strawberry",
|
160 |
+
"prompt": "how many R in strawberry?"
|
161 |
+
},
|
162 |
+
{
|
163 |
+
"title": "Larger number",
|
164 |
+
"prompt": "9.11 or 9.9 which number is larger?"
|
165 |
+
},
|
166 |
+
{
|
167 |
+
"title": "Measuring 6 liters",
|
168 |
+
"prompt": "I have a 6- and a 12-liter jug. I want to measure exactly 6 liters."
|
169 |
+
}
|
170 |
+
]
|
171 |
+
},
|
172 |
+
{
|
173 |
+
"name": "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
|
174 |
+
"tokenizer": "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
|
175 |
+
"modelUrl": "https://huggingface.co/nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
|
176 |
+
"websiteUrl": "https://www.nvidia.com/",
|
177 |
+
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/nvidia-logo.png",
|
178 |
+
"description": "Nvidia's latest Llama fine-tune, topping alignment benchmarks and optimized for instruction following.",
|
179 |
+
"parameters": {
|
180 |
+
"stop": ["<|eot_id|>", "<|im_end|>"],
|
181 |
+
"temperature": 0.5,
|
182 |
+
"truncate": 28672,
|
183 |
+
"max_new_tokens": 2048
|
184 |
+
},
|
185 |
+
"promptExamples": [
|
186 |
+
{
|
187 |
+
"title": "Rs in strawberry",
|
188 |
+
"prompt": "how many R in strawberry?"
|
189 |
+
},
|
190 |
+
{
|
191 |
+
"title": "Larger number",
|
192 |
+
"prompt": "9.11 or 9.9 which number is larger?"
|
193 |
+
},
|
194 |
+
{
|
195 |
+
"title": "Measuring 6 liters",
|
196 |
+
"prompt": "I have a 6- and a 12-liter jug. I want to measure exactly 6 liters."
|
197 |
+
}
|
198 |
+
],
|
199 |
+
"endpoints": [{
|
200 |
+
"type": "openai",
|
201 |
+
"baseURL": "https://api-inference.huggingface.co/models/nvidia/Llama-3.1-Nemotron-70B-Instruct-HF/v1"
|
202 |
+
}]
|
203 |
+
},
|
204 |
+
{
|
205 |
+
"name": "Qwen/Qwen2.5-Coder-32B-Instruct",
|
206 |
+
"description": "Qwen's latest coding model, in its biggest size yet. SOTA on many coding benchmarks.",
|
207 |
+
"modelUrl": "https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct",
|
208 |
+
"websiteUrl": "https://qwenlm.github.io/blog/qwen2.5-coder-family/",
|
209 |
+
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/qwen-logo.png",
|
210 |
+
"preprompt": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
|
211 |
+
"parameters": {
|
212 |
+
"stop": ["<|im_end|>", "<|endoftext|>"],
|
213 |
+
"temperature": 0.6,
|
214 |
+
"truncate": 28672,
|
215 |
+
"max_new_tokens": 3072
|
216 |
+
},
|
217 |
+
"promptExamples": [
|
218 |
+
{
|
219 |
+
"title": "To-do list web app",
|
220 |
+
"prompt": "Create a simple to-do list application where users can:\n- Add new tasks.\n- Mark tasks as complete.\n- Delete completed tasks.\nThe tasks should persist in the browser's local storage so that they remain available even after a page reload.\n"
|
221 |
+
},
|
222 |
+
{
|
223 |
+
"title": "Create a REST API",
|
224 |
+
"prompt": "Build a simple REST API using Node.js, TypeScript and Express:\n- POST /items: Accepts a JSON body with name and quantity and adds a new item.\n- GET /items: Returns a list of all items.\n- PUT /items/:id: Updates the name or quantity of an item by its id.\n- DELETE /items/:id: Removes an item by its id.\nUse an in-memory array as the data store (no need for a database). Include basic error handling (e.g., item not found)."
|
225 |
+
},
|
226 |
+
{
|
227 |
+
"title": "Simple website",
|
228 |
+
"prompt": "Generate a snazzy static landing page for a local coffee shop using HTML and CSS. You can use tailwind using <script src='https://cdn.tailwindcss.com'></script>."
|
229 |
+
}
|
230 |
+
],
|
231 |
+
"endpoints": [{
|
232 |
+
"type": "openai",
|
233 |
+
"baseURL": "https://api-inference.huggingface.co/models/Qwen/Qwen2.5-Coder-32B-Instruct/v1"
|
234 |
+
}]
|
235 |
+
},
|
236 |
+
{
|
237 |
+
"name": "meta-llama/Llama-3.2-11B-Vision-Instruct",
|
238 |
+
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/meta-logo.png",
|
239 |
+
"description": "The latest multimodal model from Meta! Supports image inputs natively.",
|
240 |
+
"websiteUrl": "https://llama.com/",
|
241 |
+
"multimodal": true,
|
242 |
+
"parameters": {
|
243 |
+
"stop": ["<|eot_id|>", "<|im_end|>"],
|
244 |
+
"temperature": 0.6,
|
245 |
+
"truncate": 14336,
|
246 |
+
"max_new_tokens": 1536
|
247 |
+
},
|
248 |
+
"endpoints": [{
|
249 |
+
"type": "openai",
|
250 |
+
"baseURL": "https://api-inference.huggingface.co/models/meta-llama/Llama-3.2-11B-Vision-Instruct/v1",
|
251 |
+
"multimodal": {
|
252 |
+
"image": {
|
253 |
+
"maxSizeInMB": 10,
|
254 |
+
"maxWidth": 560,
|
255 |
+
"maxHeight": 560,
|
256 |
+
"supportedMimeTypes": ["image/png", "image/jpeg", "image/webp"],
|
257 |
+
"preferredMimeType": "image/webp"
|
258 |
+
}
|
259 |
+
}
|
260 |
+
}]
|
261 |
+
},
|
262 |
+
{
|
263 |
+
"name": "NousResearch/Hermes-3-Llama-3.1-8B",
|
264 |
+
"description": "Nous Research's latest Hermes 3 release in 8B size. Follows instruction closely.",
|
265 |
+
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/nous-logo.png",
|
266 |
+
"websiteUrl": "https://nousresearch.com/",
|
267 |
+
"modelUrl": "https://huggingface.co/NousResearch/Hermes-3-Llama-3.1-8B",
|
268 |
+
"tokenizer": "NousResearch/Hermes-3-Llama-3.1-8B",
|
269 |
+
"promptExamples": [
|
270 |
+
{
|
271 |
+
"title": "Write an email from bullet list",
|
272 |
+
"prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
|
273 |
+
},
|
274 |
+
{
|
275 |
+
"title": "Code a snake game",
|
276 |
+
"prompt": "Code a basic snake game in python, give explanations for each step."
|
277 |
+
},
|
278 |
+
{
|
279 |
+
"title": "Assist in a task",
|
280 |
+
"prompt": "How do I make a delicious lemon cheesecake?"
|
281 |
+
}
|
282 |
+
],
|
283 |
+
"parameters": {
|
284 |
+
"stop": ["<|im_end|>"],
|
285 |
+
"temperature": 0.6,
|
286 |
+
"truncate": 14336,
|
287 |
+
"max_new_tokens": 1536
|
288 |
+
}
|
289 |
+
},
|
290 |
+
{
|
291 |
+
"name": "mistralai/Mistral-Nemo-Instruct-2407",
|
292 |
+
"tokenizer": "mistralai/Mistral-Nemo-Instruct-2407",
|
293 |
+
"displayName": "mistralai/Mistral-Nemo-Instruct-2407",
|
294 |
+
"description": "A small model with good capabilities in language understanding and commonsense reasoning.",
|
295 |
+
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/mistral-logo.png",
|
296 |
+
"websiteUrl": "https://mistral.ai/news/mistral-nemo/",
|
297 |
+
"modelUrl": "https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407",
|
298 |
+
"preprompt": "",
|
299 |
+
"parameters": {
|
300 |
+
"stop": ["</s>"],
|
301 |
+
"temperature": 0.6,
|
302 |
+
"truncate": 14336,
|
303 |
+
"max_new_tokens": 1536
|
304 |
+
},
|
305 |
+
"promptExamples": [
|
306 |
+
{
|
307 |
+
"title": "Write an email from bullet list",
|
308 |
+
"prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
|
309 |
+
},
|
310 |
+
{
|
311 |
+
"title": "Code a snake game",
|
312 |
+
"prompt": "Code a basic snake game in python, give explanations for each step."
|
313 |
+
},
|
314 |
+
{
|
315 |
+
"title": "Assist in a task",
|
316 |
+
"prompt": "How do I make a delicious lemon cheesecake?"
|
317 |
+
}
|
318 |
+
]
|
319 |
+
},
|
320 |
+
{
|
321 |
+
"name": "microsoft/Phi-3.5-mini-instruct",
|
322 |
+
"tokenizer": "microsoft/Phi-3.5-mini-instruct",
|
323 |
+
"description": "One of the best small models (3.8B parameters), super fast for simple tasks.",
|
324 |
+
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/microsoft-logo.png",
|
325 |
+
"modelUrl": "https://huggingface.co/microsoft/Phi-3.5-mini-instruct",
|
326 |
+
"websiteUrl": "https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/discover-the-new-multi-lingual-high-quality-phi-3-5-slms/ba-p/4225280/",
|
327 |
+
"preprompt": "",
|
328 |
+
"parameters": {
|
329 |
+
"stop": ["<|end|>", "<|endoftext|>", "<|assistant|>"],
|
330 |
+
"temperature": 0.6,
|
331 |
+
"truncate": 28672,
|
332 |
+
"max_new_tokens": 3072
|
333 |
+
},
|
334 |
+
"promptExamples": [
|
335 |
+
{
|
336 |
+
"title": "Write an email from bullet list",
|
337 |
+
"prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
|
338 |
+
},
|
339 |
+
{
|
340 |
+
"title": "Code a snake game",
|
341 |
+
"prompt": "Code a basic snake game in python, give explanations for each step."
|
342 |
+
},
|
343 |
+
{
|
344 |
+
"title": "Assist in a task",
|
345 |
+
"prompt": "How do I make a delicious lemon cheesecake?"
|
346 |
+
}
|
347 |
+
]
|
348 |
+
},
|
349 |
+
{
|
350 |
+
"name": "llhf/Meta-Llama-3.1-8B-Instruct",
|
351 |
+
"parameters": {
|
352 |
+
"temperature": 0.6,
|
353 |
+
"stop": ["<|endoftext|>", "<|eot_id|>"]
|
354 |
+
},
|
355 |
+
"unlisted": true
|
356 |
+
}
|
357 |
+
]
|
358 |
+
|
359 |
+
NODE_ENV: "prod"
|
360 |
+
NODE_LOG_STRUCTURED_DATA: true
|
361 |
+
OLD_MODELS: >
|
362 |
+
[
|
363 |
+
{ "name": "bigcode/starcoder" },
|
364 |
+
{ "name": "OpenAssistant/oasst-sft-6-llama-30b-xor" },
|
365 |
+
{ "name": "HuggingFaceH4/zephyr-7b-alpha" },
|
366 |
+
{ "name": "openchat/openchat_3.5" },
|
367 |
+
{ "name": "openchat/openchat-3.5-1210" },
|
368 |
+
{ "name": "tiiuae/falcon-180B-chat" },
|
369 |
+
{ "name": "codellama/CodeLlama-34b-Instruct-hf" },
|
370 |
+
{ "name": "google/gemma-7b-it" },
|
371 |
+
{ "name": "meta-llama/Llama-2-70b-chat-hf" },
|
372 |
+
{ "name": "codellama/CodeLlama-70b-Instruct-hf" },
|
373 |
+
{ "name": "openchat/openchat-3.5-0106" },
|
374 |
+
{ "name": "meta-llama/Meta-Llama-3-70B-Instruct" },
|
375 |
+
{ "name": "meta-llama/Meta-Llama-3.1-405B-Instruct-FP8" },
|
376 |
+
{
|
377 |
+
"name": "CohereForAI/c4ai-command-r-plus",
|
378 |
+
"transferTo": "CohereForAI/c4ai-command-r-plus-08-2024"
|
379 |
+
},
|
380 |
+
{
|
381 |
+
"name": "01-ai/Yi-1.5-34B-Chat",
|
382 |
+
"transferTo": "CohereForAI/c4ai-command-r-plus-08-2024"
|
383 |
+
},
|
384 |
+
{
|
385 |
+
"name": "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
386 |
+
"transferTo": "mistralai/Mistral-Nemo-Instruct-2407"
|
387 |
+
},
|
388 |
+
{
|
389 |
+
"name": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
|
390 |
+
"transferTo": "NousResearch/Hermes-3-Llama-3.1-8B"
|
391 |
+
},
|
392 |
+
{
|
393 |
+
"name": "mistralai/Mistral-7B-Instruct-v0.3",
|
394 |
+
"transferTo": "mistralai/Mistral-Nemo-Instruct-2407"
|
395 |
+
},
|
396 |
+
{
|
397 |
+
"name": "microsoft/Phi-3-mini-4k-instruct",
|
398 |
+
"transferTo": "microsoft/Phi-3.5-mini-instruct"
|
399 |
+
},
|
400 |
+
{
|
401 |
+
"name": "meta-llama/Meta-Llama-3.1-70B-Instruct",
|
402 |
+
"transferTo": "meta-llama/Llama-3.3-70B-Instruct"
|
403 |
+
}
|
404 |
+
]
|
405 |
+
PUBLIC_ORIGIN: "https://huggingface.co"
|
406 |
+
PUBLIC_SHARE_PREFIX: "https://hf.co/chat"
|
407 |
+
PUBLIC_ANNOUNCEMENT_BANNERS: >
|
408 |
+
[
|
409 |
+
{
|
410 |
+
"title": "Llama 3.3 70B is now available!",
|
411 |
+
"linkTitle": "Try it out!",
|
412 |
+
"linkHref": "https://huggingface.co/chat/models/meta-llama/Llama-3.3-70B-Instruct"
|
413 |
+
}
|
414 |
+
]
|
415 |
+
PUBLIC_APP_NAME: "HuggingChat"
|
416 |
+
PUBLIC_APP_ASSETS: "huggingchat"
|
417 |
+
PUBLIC_APP_COLOR: "yellow"
|
418 |
+
PUBLIC_APP_DESCRIPTION: "Making the community's best AI chat models available to everyone."
|
419 |
+
PUBLIC_APP_DISCLAIMER_MESSAGE: "Disclaimer: AI is an area of active research with known problems such as biased generation and misinformation. Do not use this application for high-stakes decisions or advice."
|
420 |
+
PUBLIC_APP_GUEST_MESSAGE: "You have reached the guest message limit, Sign In with a free Hugging Face account to continue using HuggingChat."
|
421 |
+
PUBLIC_APP_DATA_SHARING: 0
|
422 |
+
PUBLIC_APP_DISCLAIMER: 1
|
423 |
+
PUBLIC_PLAUSIBLE_SCRIPT_URL: "/js/script.js"
|
424 |
+
REQUIRE_FEATURED_ASSISTANTS: "true"
|
425 |
+
TASK_MODEL: "llhf/Meta-Llama-3.1-8B-Instruct"
|
426 |
+
TEXT_EMBEDDING_MODELS: >
|
427 |
+
[{
|
428 |
+
"name": "bge-base-en-v1-5-sxa",
|
429 |
+
"displayName": "bge-base-en-v1-5-sxa",
|
430 |
+
"chunkCharLength": 512,
|
431 |
+
"endpoints": [{
|
432 |
+
"type": "tei",
|
433 |
+
"url": "https://huggingchat-tei.hf.space/"
|
434 |
+
}]
|
435 |
+
}]
|
436 |
+
WEBSEARCH_BLOCKLIST: '["youtube.com", "twitter.com"]'
|
437 |
+
XFF_DEPTH: '2'
|
438 |
+
TOOLS: >
|
439 |
+
[
|
440 |
+
{
|
441 |
+
"_id": "000000000000000000000001",
|
442 |
+
"displayName": "Image Generation",
|
443 |
+
"description": "Use this tool to generate images based on a prompt.",
|
444 |
+
"color": "yellow",
|
445 |
+
"icon": "camera",
|
446 |
+
"baseUrl": "black-forest-labs/FLUX.1-schnell",
|
447 |
+
"name": "image_generation",
|
448 |
+
"endpoint": "/infer",
|
449 |
+
"inputs": [
|
450 |
+
{
|
451 |
+
"name": "prompt",
|
452 |
+
"description": "A prompt to generate an image from",
|
453 |
+
"paramType": "required",
|
454 |
+
"type": "str"
|
455 |
+
},
|
456 |
+
{ "name": "seed", "paramType": "fixed", "value": "0", "type": "float" },
|
457 |
+
{
|
458 |
+
"name": "randomize_seed",
|
459 |
+
"paramType": "fixed",
|
460 |
+
"value": "true",
|
461 |
+
"type": "bool"
|
462 |
+
},
|
463 |
+
{
|
464 |
+
"name": "width",
|
465 |
+
"description": "numeric value between 256 and 2048",
|
466 |
+
"paramType": "optional",
|
467 |
+
"default": 1024,
|
468 |
+
"type": "float"
|
469 |
+
},
|
470 |
+
{
|
471 |
+
"name": "height",
|
472 |
+
"description": "numeric value between 256 and 2048",
|
473 |
+
"paramType": "optional",
|
474 |
+
"default": 1024,
|
475 |
+
"type": "float"
|
476 |
+
},
|
477 |
+
{
|
478 |
+
"name": "num_inference_steps",
|
479 |
+
"paramType": "fixed",
|
480 |
+
"value": "4",
|
481 |
+
"type": "float"
|
482 |
+
}
|
483 |
+
],
|
484 |
+
"outputComponent": "image",
|
485 |
+
"outputComponentIdx": 0,
|
486 |
+
"showOutput": true
|
487 |
+
},
|
488 |
+
{
|
489 |
+
"_id": "000000000000000000000002",
|
490 |
+
"displayName": "Document Parser",
|
491 |
+
"description": "Use this tool to parse any document and get its content in markdown format.",
|
492 |
+
"color": "yellow",
|
493 |
+
"icon": "cloud",
|
494 |
+
"baseUrl": "huggingchat/document-parser",
|
495 |
+
"name": "document_parser",
|
496 |
+
"endpoint": "/predict",
|
497 |
+
"inputs": [
|
498 |
+
{
|
499 |
+
"name": "document",
|
500 |
+
"description": "Filename of the document to parse",
|
501 |
+
"paramType": "required",
|
502 |
+
"type": "file",
|
503 |
+
"mimeTypes": 'application/*'
|
504 |
+
},
|
505 |
+
{
|
506 |
+
"name": "filename",
|
507 |
+
"paramType": "fixed",
|
508 |
+
"value": "document.pdf",
|
509 |
+
"type": "str"
|
510 |
+
}
|
511 |
+
],
|
512 |
+
"outputComponent": "textbox",
|
513 |
+
"outputComponentIdx": 0,
|
514 |
+
"showOutput": false,
|
515 |
+
"isHidden": true
|
516 |
+
},
|
517 |
+
{
|
518 |
+
"_id": "000000000000000000000003",
|
519 |
+
"name": "edit_image",
|
520 |
+
"baseUrl": "multimodalart/cosxl",
|
521 |
+
"endpoint": "/run_edit",
|
522 |
+
"inputs": [
|
523 |
+
{
|
524 |
+
"name": "image",
|
525 |
+
"description": "The image path to be edited",
|
526 |
+
"paramType": "required",
|
527 |
+
"type": "file",
|
528 |
+
"mimeTypes": 'image/*'
|
529 |
+
},
|
530 |
+
{
|
531 |
+
"name": "prompt",
|
532 |
+
"description": "The prompt with which to edit the image",
|
533 |
+
"paramType": "required",
|
534 |
+
"type": "str"
|
535 |
+
},
|
536 |
+
{
|
537 |
+
"name": "negative_prompt",
|
538 |
+
"paramType": "fixed",
|
539 |
+
"value": "",
|
540 |
+
"type": "str"
|
541 |
+
},
|
542 |
+
{
|
543 |
+
"name": "guidance_scale",
|
544 |
+
"paramType": "fixed",
|
545 |
+
"value": 6.5,
|
546 |
+
"type": "float"
|
547 |
+
},
|
548 |
+
{
|
549 |
+
"name": "steps",
|
550 |
+
"paramType": "fixed",
|
551 |
+
"value": 30,
|
552 |
+
"type": "float"
|
553 |
+
}
|
554 |
+
],
|
555 |
+
"outputComponent": "image",
|
556 |
+
"showOutput": true,
|
557 |
+
"displayName": "Image Editor",
|
558 |
+
"color": "green",
|
559 |
+
"icon": "camera",
|
560 |
+
"description": "This tool lets you edit images",
|
561 |
+
"outputComponentIdx": 0
|
562 |
+
}
|
563 |
+
]
|
564 |
+
HF_ORG_ADMIN: '644171cfbd0c97265298aa99'
|
565 |
+
HF_ORG_EARLY_ACCESS: '5e67bd5b1009063689407478'
|
566 |
+
|
567 |
+
infisical:
|
568 |
+
enabled: true
|
569 |
+
env: "prod-us-east-1"
|
570 |
+
|
571 |
+
autoscaling:
|
572 |
+
enabled: true
|
573 |
+
minReplicas: 12
|
574 |
+
maxReplicas: 30
|
575 |
+
targetMemoryUtilizationPercentage: "50"
|
576 |
+
targetCPUUtilizationPercentage: "50"
|
577 |
+
|
578 |
+
resources:
|
579 |
+
requests:
|
580 |
+
cpu: 2
|
581 |
+
memory: 4Gi
|
582 |
+
limits:
|
583 |
+
cpu: 4
|
584 |
+
memory: 8Gi
|
585 |
+
|
586 |
+
monitoring:
|
587 |
+
enabled: true
|
chat-ui-main/chart/templates/_helpers.tpl
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{- define "name" -}}
|
2 |
+
{{- default $.Release.Name | trunc 63 | trimSuffix "-" -}}
|
3 |
+
{{- end -}}
|
4 |
+
|
5 |
+
{{- define "app.name" -}}
|
6 |
+
chat-ui
|
7 |
+
{{- end -}}
|
8 |
+
|
9 |
+
{{- define "labels.standard" -}}
|
10 |
+
release: {{ $.Release.Name | quote }}
|
11 |
+
heritage: {{ $.Release.Service | quote }}
|
12 |
+
chart: "{{ include "name" . }}"
|
13 |
+
app: "{{ include "app.name" . }}"
|
14 |
+
{{- end -}}
|
15 |
+
|
16 |
+
{{- define "labels.resolver" -}}
|
17 |
+
release: {{ $.Release.Name | quote }}
|
18 |
+
heritage: {{ $.Release.Service | quote }}
|
19 |
+
chart: "{{ include "name" . }}"
|
20 |
+
app: "{{ include "app.name" . }}-resolver"
|
21 |
+
{{- end -}}
|
22 |
+
|
chat-ui-main/chart/templates/config.yaml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
apiVersion: v1
|
2 |
+
kind: ConfigMap
|
3 |
+
metadata:
|
4 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
5 |
+
name: {{ include "name" . }}
|
6 |
+
namespace: {{ .Release.Namespace }}
|
7 |
+
data:
|
8 |
+
{{- range $key, $value := $.Values.envVars }}
|
9 |
+
{{ $key }}: {{ $value | quote }}
|
10 |
+
{{- end }}
|
chat-ui-main/chart/templates/deployment.yaml
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
apiVersion: apps/v1
|
2 |
+
kind: Deployment
|
3 |
+
metadata:
|
4 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
5 |
+
name: {{ include "name" . }}
|
6 |
+
namespace: {{ .Release.Namespace }}
|
7 |
+
{{- if .Values.infisical.enabled }}
|
8 |
+
annotations:
|
9 |
+
secrets.infisical.com/auto-reload: "true"
|
10 |
+
{{- end }}
|
11 |
+
spec:
|
12 |
+
progressDeadlineSeconds: 600
|
13 |
+
{{- if not $.Values.autoscaling.enabled }}
|
14 |
+
replicas: {{ .Values.replicas }}
|
15 |
+
{{- end }}
|
16 |
+
revisionHistoryLimit: 10
|
17 |
+
selector:
|
18 |
+
matchLabels: {{ include "labels.standard" . | nindent 6 }}
|
19 |
+
strategy:
|
20 |
+
rollingUpdate:
|
21 |
+
maxSurge: 25%
|
22 |
+
maxUnavailable: 25%
|
23 |
+
type: RollingUpdate
|
24 |
+
template:
|
25 |
+
metadata:
|
26 |
+
labels: {{ include "labels.standard" . | nindent 8 }}
|
27 |
+
{{- if $.Values.envVars.NODE_LOG_STRUCTURED_DATA }}
|
28 |
+
annotations:
|
29 |
+
co.elastic.logs/json.expand_keys: "true"
|
30 |
+
{{- end }}
|
31 |
+
spec:
|
32 |
+
{{- if .Values.serviceAccount.enabled }}
|
33 |
+
serviceAccountName: "{{ .Values.serviceAccount.name | default (include "name" .) }}"
|
34 |
+
{{- end }}
|
35 |
+
containers:
|
36 |
+
- name: chat-ui
|
37 |
+
image: "{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag }}"
|
38 |
+
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
39 |
+
readinessProbe:
|
40 |
+
failureThreshold: 30
|
41 |
+
periodSeconds: 10
|
42 |
+
httpGet:
|
43 |
+
path: {{ $.Values.envVars.APP_BASE | default "" }}/healthcheck
|
44 |
+
port: {{ $.Values.envVars.APP_PORT | default 3000 | int }}
|
45 |
+
livenessProbe:
|
46 |
+
failureThreshold: 30
|
47 |
+
periodSeconds: 10
|
48 |
+
httpGet:
|
49 |
+
path: {{ $.Values.envVars.APP_BASE | default "" }}/healthcheck
|
50 |
+
port: {{ $.Values.envVars.APP_PORT | default 3000 | int }}
|
51 |
+
ports:
|
52 |
+
- containerPort: {{ $.Values.envVars.APP_PORT | default 3000 | int }}
|
53 |
+
name: http
|
54 |
+
protocol: TCP
|
55 |
+
{{- if $.Values.monitoring.enabled }}
|
56 |
+
- containerPort: {{ $.Values.envVars.METRICS_PORT | default 5565 | int }}
|
57 |
+
name: metrics
|
58 |
+
protocol: TCP
|
59 |
+
{{- end }}
|
60 |
+
resources: {{ toYaml .Values.resources | nindent 12 }}
|
61 |
+
{{- with $.Values.extraEnv }}
|
62 |
+
env:
|
63 |
+
{{- toYaml . | nindent 14 }}
|
64 |
+
{{- end }}
|
65 |
+
envFrom:
|
66 |
+
- configMapRef:
|
67 |
+
name: {{ include "name" . }}
|
68 |
+
{{- if $.Values.infisical.enabled }}
|
69 |
+
- secretRef:
|
70 |
+
name: {{ include "name" $ }}-secs
|
71 |
+
{{- end }}
|
72 |
+
{{- with $.Values.extraEnvFrom }}
|
73 |
+
{{- toYaml . | nindent 14 }}
|
74 |
+
{{- end }}
|
75 |
+
nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
|
76 |
+
tolerations: {{ toYaml .Values.tolerations | nindent 8 }}
|
77 |
+
volumes:
|
78 |
+
- name: config
|
79 |
+
configMap:
|
80 |
+
name: {{ include "name" . }}
|
chat-ui-main/chart/templates/hpa.yaml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{- if $.Values.autoscaling.enabled }}
|
2 |
+
apiVersion: autoscaling/v2
|
3 |
+
kind: HorizontalPodAutoscaler
|
4 |
+
metadata:
|
5 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
6 |
+
name: {{ include "name" . }}
|
7 |
+
namespace: {{ .Release.Namespace }}
|
8 |
+
spec:
|
9 |
+
scaleTargetRef:
|
10 |
+
apiVersion: apps/v1
|
11 |
+
kind: Deployment
|
12 |
+
name: {{ include "name" . }}
|
13 |
+
minReplicas: {{ $.Values.autoscaling.minReplicas }}
|
14 |
+
maxReplicas: {{ $.Values.autoscaling.maxReplicas }}
|
15 |
+
metrics:
|
16 |
+
{{- if ne "" $.Values.autoscaling.targetMemoryUtilizationPercentage }}
|
17 |
+
- type: Resource
|
18 |
+
resource:
|
19 |
+
name: memory
|
20 |
+
target:
|
21 |
+
type: Utilization
|
22 |
+
averageUtilization: {{ $.Values.autoscaling.targetMemoryUtilizationPercentage | int }}
|
23 |
+
{{- end }}
|
24 |
+
{{- if ne "" $.Values.autoscaling.targetCPUUtilizationPercentage }}
|
25 |
+
- type: Resource
|
26 |
+
resource:
|
27 |
+
name: cpu
|
28 |
+
target:
|
29 |
+
type: Utilization
|
30 |
+
averageUtilization: {{ $.Values.autoscaling.targetCPUUtilizationPercentage | int }}
|
31 |
+
{{- end }}
|
32 |
+
behavior:
|
33 |
+
scaleDown:
|
34 |
+
stabilizationWindowSeconds: 600
|
35 |
+
policies:
|
36 |
+
- type: Percent
|
37 |
+
value: 10
|
38 |
+
periodSeconds: 60
|
39 |
+
scaleUp:
|
40 |
+
stabilizationWindowSeconds: 0
|
41 |
+
policies:
|
42 |
+
- type: Pods
|
43 |
+
value: 1
|
44 |
+
periodSeconds: 30
|
45 |
+
{{- end }}
|
chat-ui-main/chart/templates/infisical.yaml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{- if .Values.infisical.enabled }}
|
2 |
+
apiVersion: secrets.infisical.com/v1alpha1
|
3 |
+
kind: InfisicalSecret
|
4 |
+
metadata:
|
5 |
+
name: {{ include "name" $ }}-infisical-secret
|
6 |
+
namespace: {{ $.Release.Namespace }}
|
7 |
+
spec:
|
8 |
+
authentication:
|
9 |
+
universalAuth:
|
10 |
+
credentialsRef:
|
11 |
+
secretName: {{ .Values.infisical.operatorSecretName | quote }}
|
12 |
+
secretNamespace: {{ .Values.infisical.operatorSecretNamespace | quote }}
|
13 |
+
secretsScope:
|
14 |
+
envSlug: {{ .Values.infisical.env | quote }}
|
15 |
+
projectSlug: {{ .Values.infisical.project | quote }}
|
16 |
+
secretsPath: /
|
17 |
+
hostAPI: {{ .Values.infisical.url | quote }}
|
18 |
+
managedSecretReference:
|
19 |
+
creationPolicy: Owner
|
20 |
+
secretName: {{ include "name" $ }}-secs
|
21 |
+
secretNamespace: {{ .Release.Namespace | quote }}
|
22 |
+
secretType: Opaque
|
23 |
+
resyncInterval: {{ .Values.infisical.resyncInterval }}
|
24 |
+
{{- end }}
|
chat-ui-main/chart/templates/ingress.yaml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{- if $.Values.ingress.enabled }}
|
2 |
+
apiVersion: networking.k8s.io/v1
|
3 |
+
kind: Ingress
|
4 |
+
metadata:
|
5 |
+
annotations: {{ toYaml .Values.ingress.annotations | nindent 4 }}
|
6 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
7 |
+
name: {{ include "name" . }}
|
8 |
+
namespace: {{ .Release.Namespace }}
|
9 |
+
spec:
|
10 |
+
{{ if $.Values.ingress.className }}
|
11 |
+
ingressClassName: {{ .Values.ingress.className }}
|
12 |
+
{{ end }}
|
13 |
+
{{- with .Values.ingress.tls }}
|
14 |
+
tls:
|
15 |
+
- hosts:
|
16 |
+
- {{ $.Values.domain | quote }}
|
17 |
+
{{- with .secretName }}
|
18 |
+
secretName: {{ . }}
|
19 |
+
{{- end }}
|
20 |
+
{{- end }}
|
21 |
+
rules:
|
22 |
+
- host: {{ .Values.domain }}
|
23 |
+
http:
|
24 |
+
paths:
|
25 |
+
- backend:
|
26 |
+
service:
|
27 |
+
name: {{ include "name" . }}
|
28 |
+
port:
|
29 |
+
name: http
|
30 |
+
path: {{ $.Values.ingress.path | default "/" }}
|
31 |
+
pathType: Prefix
|
32 |
+
{{- end }}
|
chat-ui-main/chart/templates/network-policy.yaml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{- if $.Values.networkPolicy.enabled }}
|
2 |
+
apiVersion: networking.k8s.io/v1
|
3 |
+
kind: NetworkPolicy
|
4 |
+
metadata:
|
5 |
+
name: {{ include "name" . }}
|
6 |
+
namespace: {{ .Release.Namespace }}
|
7 |
+
spec:
|
8 |
+
egress:
|
9 |
+
- ports:
|
10 |
+
- port: 53
|
11 |
+
protocol: UDP
|
12 |
+
to:
|
13 |
+
- namespaceSelector:
|
14 |
+
matchLabels:
|
15 |
+
kubernetes.io/metadata.name: kube-system
|
16 |
+
podSelector:
|
17 |
+
matchLabels:
|
18 |
+
k8s-app: kube-dns
|
19 |
+
- to:
|
20 |
+
{{- range $ip := .Values.networkPolicy.allowedBlocks }}
|
21 |
+
- ipBlock:
|
22 |
+
cidr: {{ $ip | quote }}
|
23 |
+
{{- end }}
|
24 |
+
- to:
|
25 |
+
- ipBlock:
|
26 |
+
cidr: 0.0.0.0/0
|
27 |
+
except:
|
28 |
+
- 10.0.0.0/8
|
29 |
+
- 172.16.0.0/12
|
30 |
+
- 192.168.0.0/16
|
31 |
+
- 169.254.169.254/32
|
32 |
+
podSelector:
|
33 |
+
matchLabels: {{ include "labels.standard" . | nindent 6 }}
|
34 |
+
policyTypes:
|
35 |
+
- Egress
|
36 |
+
{{- end }}
|
chat-ui-main/chart/templates/service-account.yaml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{- if and .Values.serviceAccount.enabled .Values.serviceAccount.create }}
|
2 |
+
apiVersion: v1
|
3 |
+
kind: ServiceAccount
|
4 |
+
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
|
5 |
+
metadata:
|
6 |
+
name: "{{ .Values.serviceAccount.name | default (include "name" .) }}"
|
7 |
+
namespace: {{ .Release.Namespace }}
|
8 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
9 |
+
{{- with .Values.serviceAccount.annotations }}
|
10 |
+
annotations:
|
11 |
+
{{- toYaml . | nindent 4 }}
|
12 |
+
{{- end }}
|
13 |
+
{{- end }}
|
chat-ui-main/chart/templates/service-monitor.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{- if $.Values.monitoring.enabled }}
|
2 |
+
apiVersion: monitoring.coreos.com/v1
|
3 |
+
kind: ServiceMonitor
|
4 |
+
metadata:
|
5 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
6 |
+
name: {{ include "name" . }}
|
7 |
+
namespace: {{ .Release.Namespace }}
|
8 |
+
spec:
|
9 |
+
selector:
|
10 |
+
matchLabels: {{ include "labels.standard" . | nindent 6 }}
|
11 |
+
endpoints:
|
12 |
+
- port: metrics
|
13 |
+
path: /metrics
|
14 |
+
interval: 15s
|
15 |
+
{{- end }}
|
chat-ui-main/chart/templates/service.yaml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
apiVersion: v1
|
2 |
+
kind: Service
|
3 |
+
metadata:
|
4 |
+
name: "{{ include "name" . }}"
|
5 |
+
annotations: {{ toYaml .Values.service.annotations | nindent 4 }}
|
6 |
+
namespace: {{ .Release.Namespace }}
|
7 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
8 |
+
spec:
|
9 |
+
ports:
|
10 |
+
- name: http
|
11 |
+
port: 80
|
12 |
+
protocol: TCP
|
13 |
+
targetPort: http
|
14 |
+
{{- if $.Values.monitoring.enabled }}
|
15 |
+
- name: metrics
|
16 |
+
port: 5565
|
17 |
+
protocol: TCP
|
18 |
+
targetPort: metrics
|
19 |
+
{{- end }}
|
20 |
+
selector: {{ include "labels.standard" . | nindent 4 }}
|
21 |
+
type: {{.Values.service.type}}
|
chat-ui-main/chart/values.yaml
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
image:
|
2 |
+
repository: ghcr.io/huggingface
|
3 |
+
name: chat-ui
|
4 |
+
tag: 0.0.0-latest
|
5 |
+
pullPolicy: IfNotPresent
|
6 |
+
|
7 |
+
replicas: 3
|
8 |
+
|
9 |
+
domain: huggingface.co
|
10 |
+
|
11 |
+
networkPolicy:
|
12 |
+
enabled: false
|
13 |
+
allowedBlocks: []
|
14 |
+
|
15 |
+
service:
|
16 |
+
type: NodePort
|
17 |
+
annotations: { }
|
18 |
+
|
19 |
+
serviceAccount:
|
20 |
+
enabled: false
|
21 |
+
create: false
|
22 |
+
name: ""
|
23 |
+
automountServiceAccountToken: true
|
24 |
+
annotations: { }
|
25 |
+
|
26 |
+
ingress:
|
27 |
+
enabled: true
|
28 |
+
path: "/"
|
29 |
+
annotations: { }
|
30 |
+
# className: "nginx"
|
31 |
+
tls: { }
|
32 |
+
# secretName: XXX
|
33 |
+
|
34 |
+
resources:
|
35 |
+
requests:
|
36 |
+
cpu: 2
|
37 |
+
memory: 4Gi
|
38 |
+
limits:
|
39 |
+
cpu: 2
|
40 |
+
memory: 4Gi
|
41 |
+
nodeSelector: {}
|
42 |
+
tolerations: []
|
43 |
+
|
44 |
+
envVars: { }
|
45 |
+
|
46 |
+
infisical:
|
47 |
+
enabled: false
|
48 |
+
env: ""
|
49 |
+
project: "huggingchat-v2-a1"
|
50 |
+
url: ""
|
51 |
+
resyncInterval: 60
|
52 |
+
operatorSecretName: "huggingchat-operator-secrets"
|
53 |
+
operatorSecretNamespace: "hub-utils"
|
54 |
+
|
55 |
+
# Allow to environment injections on top or instead of infisical
|
56 |
+
extraEnvFrom: []
|
57 |
+
extraEnv: []
|
58 |
+
|
59 |
+
autoscaling:
|
60 |
+
enabled: false
|
61 |
+
minReplicas: 1
|
62 |
+
maxReplicas: 2
|
63 |
+
targetMemoryUtilizationPercentage: ""
|
64 |
+
targetCPUUtilizationPercentage: ""
|
65 |
+
|
66 |
+
monitoring:
|
67 |
+
enabled: false
|
chat-ui-main/docs/source/_toctree.yml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
- local: index
|
2 |
+
title: 🤗 Chat UI
|
3 |
+
- title: Installation
|
4 |
+
sections:
|
5 |
+
- local: installation/local
|
6 |
+
title: Local
|
7 |
+
- local: installation/spaces
|
8 |
+
title: Spaces
|
9 |
+
- local: installation/docker
|
10 |
+
title: Docker
|
11 |
+
- local: installation/helm
|
12 |
+
title: Helm
|
13 |
+
- title: Configuration
|
14 |
+
sections:
|
15 |
+
- local: configuration/overview
|
16 |
+
title: Overview
|
17 |
+
- local: configuration/theming
|
18 |
+
title: Theming
|
19 |
+
- local: configuration/open-id
|
20 |
+
title: OpenID
|
21 |
+
- local: configuration/web-search
|
22 |
+
title: Web Search
|
23 |
+
- local: configuration/metrics
|
24 |
+
title: Metrics
|
25 |
+
- local: configuration/embeddings
|
26 |
+
title: Text Embedding Models
|
27 |
+
- title: Models
|
28 |
+
sections:
|
29 |
+
- local: configuration/models/overview
|
30 |
+
title: Overview
|
31 |
+
- local: configuration/models/multimodal
|
32 |
+
title: Multimodal
|
33 |
+
- local: configuration/models/tools
|
34 |
+
title: Tools
|
35 |
+
- title: Providers
|
36 |
+
sections:
|
37 |
+
- local: configuration/models/providers/anthropic
|
38 |
+
title: Anthropic
|
39 |
+
- local: configuration/models/providers/aws
|
40 |
+
title: AWS
|
41 |
+
- local: configuration/models/providers/cloudflare
|
42 |
+
title: Cloudflare
|
43 |
+
- local: configuration/models/providers/cohere
|
44 |
+
title: Cohere
|
45 |
+
- local: configuration/models/providers/google
|
46 |
+
title: Google
|
47 |
+
- local: configuration/models/providers/langserve
|
48 |
+
title: Langserve
|
49 |
+
- local: configuration/models/providers/llamacpp
|
50 |
+
title: Llama.cpp
|
51 |
+
- local: configuration/models/providers/ollama
|
52 |
+
title: Ollama
|
53 |
+
- local: configuration/models/providers/openai
|
54 |
+
title: OpenAI
|
55 |
+
- local: configuration/models/providers/tgi
|
56 |
+
title: TGI
|
57 |
+
- local: configuration/common-issues
|
58 |
+
title: Common Issues
|
59 |
+
- title: Developing
|
60 |
+
sections:
|
61 |
+
- local: developing/architecture
|
62 |
+
title: Architecture
|
63 |
+
- local: developing/copy-huggingchat
|
64 |
+
title: Copy HuggingChat
|
chat-ui-main/docs/source/configuration/common-issues.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Common Issues
|
2 |
+
|
3 |
+
## 403:You don't have access to this conversation
|
4 |
+
|
5 |
+
Most likely you are running chat-ui over HTTP. The recommended option is to setup something like NGINX to handle HTTPS and proxy the requests to chat-ui. If you really need to run over HTTP you can add `ALLOW_INSECURE_COOKIES=true` to your `.env.local`.
|
6 |
+
|
7 |
+
Make sure to set your `PUBLIC_ORIGIN` in your `.env.local` to the correct URL as well.
|
chat-ui-main/docs/source/configuration/embeddings.md
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Text Embedding Models
|
2 |
+
|
3 |
+
By default (for backward compatibility), when `TEXT_EMBEDDING_MODELS` environment variable is not defined, [transformers.js](https://huggingface.co/docs/transformers.js) embedding models will be used for embedding tasks, specifically, the [Xenova/gte-small](https://huggingface.co/Xenova/gte-small) model.
|
4 |
+
|
5 |
+
You can customize the embedding model by setting `TEXT_EMBEDDING_MODELS` in your `.env.local` file where the required fields are `name`, `chunkCharLength` and `endpoints`.
|
6 |
+
|
7 |
+
Supported text embedding backends are: [`transformers.js`](https://huggingface.co/docs/transformers.js), [`TEI`](https://github.com/huggingface/text-embeddings-inference) and [`OpenAI`](https://platform.openai.com/docs/guides/embeddings). `transformers.js` models run locally as part of `chat-ui`, whereas `TEI` models run in a different environment & accessed through an API endpoint. `openai` models are accessed through the [OpenAI API](https://platform.openai.com/docs/guides/embeddings).
|
8 |
+
|
9 |
+
When more than one embedding models are supplied in `.env.local` file, the first will be used by default, and the others will only be used on LLM's which configured `embeddingModel` to the name of the model.
|
10 |
+
|
11 |
+
## Transformers.js
|
12 |
+
|
13 |
+
The Transformers.js backend uses local CPU for the embedding which can be quite slow. If possible, consider using TEI or OpenAI embeddings instead if you use web search frequently, as performance will improve significantly.
|
14 |
+
|
15 |
+
```ini
|
16 |
+
TEXT_EMBEDDING_MODELS = `[
|
17 |
+
{
|
18 |
+
"name": "Xenova/gte-small",
|
19 |
+
"displayName": "Xenova/gte-small",
|
20 |
+
"description": "locally running embedding",
|
21 |
+
"chunkCharLength": 512,
|
22 |
+
"endpoints": [
|
23 |
+
{ "type": "transformersjs" }
|
24 |
+
]
|
25 |
+
}
|
26 |
+
]`
|
27 |
+
```
|
28 |
+
|
29 |
+
## Text Embeddings Inference (TEI)
|
30 |
+
|
31 |
+
> Text Embeddings Inference (TEI) is a comprehensive toolkit designed for efficient deployment and serving of open source text embeddings models. It enables high-performance extraction for the most popular models, including FlagEmbedding, Ember, GTE, and E5.
|
32 |
+
|
33 |
+
Some recommended models at the time of writing (May 2024) are `Snowflake/snowflake-arctic-embed-m` and `BAAI/bge-large-en-v1.5`. You may run TEI locally with GPU support via Docker:
|
34 |
+
|
35 |
+
`docker run --gpus all -p 8080:80 -v tei-data:/data --name tei ghcr.io/huggingface/text-embeddings-inference:1.2 --model-id YOUR/HF_MODEL`
|
36 |
+
|
37 |
+
You can then hook this up to your Chat UI instance with the following configuration.
|
38 |
+
|
39 |
+
```ini
|
40 |
+
TEXT_EMBEDDING_MODELS=`[
|
41 |
+
{
|
42 |
+
"name": "YOUR/HF_MODEL",
|
43 |
+
"displayName": "YOUR/HF_MODEL",
|
44 |
+
"preQuery": "Check the model documentation for the preQuery. Not all models have one",
|
45 |
+
"prePassage": "Check the model documentation for the prePassage. Not all models have one",
|
46 |
+
"chunkCharLength": 512,
|
47 |
+
"endpoints": [{
|
48 |
+
"type": "tei",
|
49 |
+
"url": "http://127.0.0.1:8080/"
|
50 |
+
}]
|
51 |
+
}
|
52 |
+
]`
|
53 |
+
```
|
54 |
+
|
55 |
+
Examples for `Snowflake/snowflake-arctic-embed-m` and `BAAI/bge-large-en-v1.5`:
|
56 |
+
|
57 |
+
```ini
|
58 |
+
TEXT_EMBEDDING_MODELS=`[
|
59 |
+
{
|
60 |
+
"name": "Snowflake/snowflake-arctic-embed-m",
|
61 |
+
"displayName": "Snowflake/snowflake-arctic-embed-m",
|
62 |
+
"preQuery": "Represent this sentence for searching relevant passages: ",
|
63 |
+
"chunkCharLength": 512,
|
64 |
+
"endpoints": [{
|
65 |
+
"type": "tei",
|
66 |
+
"url": "http://127.0.0.1:8080/"
|
67 |
+
}]
|
68 |
+
},{
|
69 |
+
"name": "BAAI/bge-large-en-v1.5",
|
70 |
+
"displayName": "BAAI/bge-large-en-v1.5",
|
71 |
+
"chunkCharLength": 512,
|
72 |
+
"endpoints": [{
|
73 |
+
"type": "tei",
|
74 |
+
"url": "http://127.0.0.1:8080/"
|
75 |
+
}]
|
76 |
+
}
|
77 |
+
]`
|
78 |
+
```
|
79 |
+
|
80 |
+
## OpenAI
|
81 |
+
|
82 |
+
It's also possible to host your own OpenAI API compatible embedding models. [`Infinity`](https://github.com/michaelfeil/infinity) is one example. You may run it locally with Docker:
|
83 |
+
|
84 |
+
`docker run -it --gpus all -v infinity-data:/app/.cache -p 7997:7997 michaelf34/infinity:latest v2 --model-id nomic-ai/nomic-embed-text-v1 --port 7997`
|
85 |
+
|
86 |
+
You can then hook this up to your Chat UI instance with the following configuration.
|
87 |
+
|
88 |
+
```ini
|
89 |
+
TEXT_EMBEDDING_MODELS=`[
|
90 |
+
{
|
91 |
+
"name": "nomic-ai/nomic-embed-text-v1",
|
92 |
+
"displayName": "nomic-ai/nomic-embed-text-v1",
|
93 |
+
"chunkCharLength": 512,
|
94 |
+
"model": {
|
95 |
+
"name": "nomic-ai/nomic-embed-text-v1"
|
96 |
+
},
|
97 |
+
"endpoints": [
|
98 |
+
{
|
99 |
+
"type": "openai",
|
100 |
+
"url": "https://127.0.0.1:7997/embeddings"
|
101 |
+
}
|
102 |
+
]
|
103 |
+
}
|
104 |
+
]`
|
105 |
+
```
|
chat-ui-main/docs/source/configuration/metrics.md
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Metrics
|
2 |
+
|
3 |
+
The server can expose prometheus metrics on port `5565` but is off by default. You may enable the metrics server with `METRICS_ENABLED=true` and change the port with `METRICS_PORT=1234`.
|
4 |
+
|
5 |
+
<Tip>
|
6 |
+
|
7 |
+
In development with `npm run dev`, the metrics server does not shutdown gracefully due to Sveltekit not providing hooks for restart. It's recommended to disable the metrics server in this case.
|
8 |
+
|
9 |
+
</Tip>
|
chat-ui-main/docs/source/configuration/models/multimodal.md
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Multimodal
|
2 |
+
|
3 |
+
We currently support [IDEFICS](https://huggingface.co/blog/idefics) (hosted on [TGI](./providers/tgi)), OpenAI and Anthropic Claude 3 as multimodal models. You can enable it by setting `multimodal: true` in your `MODELS` configuration. For IDEFICS, you must have a [PRO HF Api token](https://huggingface.co/settings/tokens). For OpenAI, see the [OpenAI section](./providers/openai). For Anthropic, see the [Anthropic section](./providers/anthropic).
|
4 |
+
|
5 |
+
```ini
|
6 |
+
MODELS=`[
|
7 |
+
{
|
8 |
+
"name": "HuggingFaceM4/idefics-80b-instruct",
|
9 |
+
"multimodal" : true,
|
10 |
+
"description": "IDEFICS is the new multimodal model by Hugging Face.",
|
11 |
+
"preprompt": "",
|
12 |
+
"chatPromptTemplate" : "{{#each messages}}{{#ifUser}}User: {{content}}{{/ifUser}}<end_of_utterance>\nAssistant: {{#ifAssistant}}{{content}}\n{{/ifAssistant}}{{/each}}",
|
13 |
+
"parameters": {
|
14 |
+
"temperature": 0.1,
|
15 |
+
"top_p": 0.95,
|
16 |
+
"repetition_penalty": 1.2,
|
17 |
+
"top_k": 12,
|
18 |
+
"truncate": 1000,
|
19 |
+
"max_new_tokens": 1024,
|
20 |
+
"stop": ["<end_of_utterance>", "User:", "\nUser:"]
|
21 |
+
}
|
22 |
+
}
|
23 |
+
]`
|
24 |
+
```
|
chat-ui-main/docs/source/configuration/models/overview.md
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Models Overview
|
2 |
+
|
3 |
+
You can customize the parameters passed to the model or even use a new model by updating the `MODELS` variable in your `.env.local`. The default one can be found in `.env` and looks like this :
|
4 |
+
|
5 |
+
```ini
|
6 |
+
MODELS=`[
|
7 |
+
{
|
8 |
+
"name": "mistralai/Mistral-7B-Instruct-v0.2",
|
9 |
+
"displayName": "mistralai/Mistral-7B-Instruct-v0.2",
|
10 |
+
"description": "Mistral 7B is a new Apache 2.0 model, released by Mistral AI that outperforms Llama2 13B in benchmarks.",
|
11 |
+
"websiteUrl": "https://mistral.ai/news/announcing-mistral-7b/",
|
12 |
+
"preprompt": "",
|
13 |
+
"chatPromptTemplate" : "<s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s>{{/ifAssistant}}{{/each}}",
|
14 |
+
"parameters": {
|
15 |
+
"temperature": 0.3,
|
16 |
+
"top_p": 0.95,
|
17 |
+
"repetition_penalty": 1.2,
|
18 |
+
"top_k": 50,
|
19 |
+
"truncate": 3072,
|
20 |
+
"max_new_tokens": 1024,
|
21 |
+
"stop": ["</s>"]
|
22 |
+
},
|
23 |
+
"promptExamples": [
|
24 |
+
{
|
25 |
+
"title": "Write an email from bullet list",
|
26 |
+
"prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
|
27 |
+
}, {
|
28 |
+
"title": "Code a snake game",
|
29 |
+
"prompt": "Code a basic snake game in python, give explanations for each step."
|
30 |
+
}, {
|
31 |
+
"title": "Assist in a task",
|
32 |
+
"prompt": "How do I make a delicious lemon cheesecake?"
|
33 |
+
}
|
34 |
+
]
|
35 |
+
}
|
36 |
+
]`
|
37 |
+
|
38 |
+
```
|
39 |
+
|
40 |
+
You can change things like the parameters, or customize the preprompt to better suit your needs. You can also add more models by adding more objects to the array, with different preprompts for example.
|
41 |
+
|
42 |
+
## Chat Prompt Template
|
43 |
+
|
44 |
+
When querying the model for a chat response, the `chatPromptTemplate` template is used. `messages` is an array of chat messages, it has the format `[{ content: string }, ...]`. To identify if a message is a user message or an assistant message the `ifUser` and `ifAssistant` block helpers can be used.
|
45 |
+
|
46 |
+
The following is the default `chatPromptTemplate`, although newlines and indentiation have been added for readability. You can find the prompts used in production for HuggingChat [here](https://github.com/huggingface/chat-ui/blob/main/PROMPTS.md). The templating language used is [Handlebars](https://www.npmjs.com/package/handlebars).
|
47 |
+
|
48 |
+
```handlebars
|
49 |
+
{{preprompt}}
|
50 |
+
{{#each messages}}
|
51 |
+
{{#ifUser}}{{@root.userMessageToken}}{{content}}{{@root.userMessageEndToken}}{{/ifUser}}
|
52 |
+
{{#ifAssistant
|
53 |
+
}}{{@root.assistantMessageToken}}{{content}}{{@root.assistantMessageEndToken}}{{/ifAssistant}}
|
54 |
+
{{/each}}
|
55 |
+
{{assistantMessageToken}}
|
56 |
+
```
|
57 |
+
|
58 |
+
## Custom endpoint authorization
|
59 |
+
|
60 |
+
### Basic and Bearer
|
61 |
+
|
62 |
+
Custom endpoints may require authorization, depending on how you configure them. Authentication will usually be set either with `Basic` or `Bearer`.
|
63 |
+
|
64 |
+
For `Basic` we will need to generate a base64 encoding of the username and password.
|
65 |
+
|
66 |
+
`echo -n "USER:PASS" | base64`
|
67 |
+
|
68 |
+
> VVNFUjpQQVNT
|
69 |
+
|
70 |
+
For `Bearer` you can use a token, which can be grabbed from [here](https://huggingface.co/settings/tokens).
|
71 |
+
|
72 |
+
You can then add the generated information and the `authorization` parameter to your `.env.local`.
|
73 |
+
|
74 |
+
```ini
|
75 |
+
"endpoints": [
|
76 |
+
{
|
77 |
+
"url": "https://HOST:PORT",
|
78 |
+
"authorization": "Basic VVNFUjpQQVNT",
|
79 |
+
}
|
80 |
+
]
|
81 |
+
```
|
82 |
+
|
83 |
+
Please note that if `HF_TOKEN` is also set or not empty, it will take precedence.
|
84 |
+
|
85 |
+
## Models hosted on multiple custom endpoints
|
86 |
+
|
87 |
+
If the model being hosted will be available on multiple servers/instances add the `weight` parameter to your `.env.local`. The `weight` will be used to determine the probability of requesting a particular endpoint.
|
88 |
+
|
89 |
+
```ini
|
90 |
+
"endpoints": [
|
91 |
+
{
|
92 |
+
"url": "https://HOST:PORT",
|
93 |
+
"weight": 1
|
94 |
+
},
|
95 |
+
{
|
96 |
+
"url": "https://HOST:PORT",
|
97 |
+
"weight": 2
|
98 |
+
}
|
99 |
+
...
|
100 |
+
]
|
101 |
+
```
|
102 |
+
|
103 |
+
## Client Certificate Authentication (mTLS)
|
104 |
+
|
105 |
+
Custom endpoints may require client certificate authentication, depending on how you configure them. To enable mTLS between Chat UI and your custom endpoint, you will need to set the `USE_CLIENT_CERTIFICATE` to `true`, and add the `CERT_PATH` and `KEY_PATH` parameters to your `.env.local`. These parameters should point to the location of the certificate and key files on your local machine. The certificate and key files should be in PEM format. The key file can be encrypted with a passphrase, in which case you will also need to add the `CLIENT_KEY_PASSWORD` parameter to your `.env.local`.
|
106 |
+
|
107 |
+
If you're using a certificate signed by a private CA, you will also need to add the `CA_PATH` parameter to your `.env.local`. This parameter should point to the location of the CA certificate file on your local machine.
|
108 |
+
|
109 |
+
If you're using a self-signed certificate, e.g. for testing or development purposes, you can set the `REJECT_UNAUTHORIZED` parameter to `false` in your `.env.local`. This will disable certificate validation, and allow Chat UI to connect to your custom endpoint.
|
110 |
+
|
111 |
+
## Specific Embedding Model
|
112 |
+
|
113 |
+
A model can use any of the embedding models defined under `TEXT_EMBEDDING_MODELS`, (currently used when web searching). By default it will use the first embedding model, but it can be changed with the field `embeddingModel`:
|
114 |
+
|
115 |
+
```ini
|
116 |
+
TEXT_EMBEDDING_MODELS = `[
|
117 |
+
{
|
118 |
+
"name": "Xenova/gte-small",
|
119 |
+
"chunkCharLength": 512,
|
120 |
+
"endpoints": [
|
121 |
+
{"type": "transformersjs"}
|
122 |
+
]
|
123 |
+
},
|
124 |
+
{
|
125 |
+
"name": "intfloat/e5-base-v2",
|
126 |
+
"chunkCharLength": 768,
|
127 |
+
"endpoints": [
|
128 |
+
{"type": "tei", "url": "http://127.0.0.1:8080/", "authorization": "Basic VVNFUjpQQVNT"},
|
129 |
+
{"type": "tei", "url": "http://127.0.0.1:8081/"}
|
130 |
+
]
|
131 |
+
}
|
132 |
+
]`
|
133 |
+
|
134 |
+
MODELS=`[
|
135 |
+
{
|
136 |
+
"name": "Ollama Mistral",
|
137 |
+
"chatPromptTemplate": "...",
|
138 |
+
"embeddingModel": "intfloat/e5-base-v2"
|
139 |
+
"parameters": {
|
140 |
+
...
|
141 |
+
},
|
142 |
+
"endpoints": [
|
143 |
+
...
|
144 |
+
]
|
145 |
+
}
|
146 |
+
]`
|
147 |
+
```
|