[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-71279":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":35,"readmeContent":36,"aiSummary":37,"trendingCount":16,"starSnapshotCount":16,"syncStatus":38,"lastSyncTime":39,"discoverSource":40},71279,"chat-ui","huggingface\u002Fchat-ui","huggingface","The open source codebase powering HuggingChat","https:\u002F\u002Fhuggingface.co\u002Fchat",null,"TypeScript",10753,1651,98,176,0,7,19,47,21,44.65,"Apache License 2.0",false,"main",true,[27,28,7,29,30,31,32,33,34],"chatgpt","hacktoberfest","llm","svelte","svelte-kit","sveltekit","tailwindcss","typescript","2026-06-12 02:02:50","# Chat UI\n\n![Chat UI repository thumbnail](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fhuggingface\u002Fdocumentation-images\u002Fresolve\u002Fmain\u002Fchat-ui\u002Fchat-ui-2026.png)\n\nA chat interface for LLMs. It is a SvelteKit app and it powers the [HuggingChat app on hf.co\u002Fchat](https:\u002F\u002Fhuggingface.co\u002Fchat).\n\n0. [Quickstart](#quickstart)\n1. [Database Options](#database-options)\n2. [Launch](#launch)\n3. [Optional Docker Image](#optional-docker-image)\n4. [Extra parameters](#extra-parameters)\n5. [Building](#building)\n\n> [!NOTE]\n> Chat UI only supports OpenAI-compatible APIs via `OPENAI_BASE_URL` and the `\u002Fmodels` endpoint. Provider-specific integrations (legacy `MODELS` env var, GGUF discovery, embeddings, web-search helpers, etc.) are removed, but any service that speaks the OpenAI protocol (llama.cpp server, Ollama, OpenRouter, etc. will work by default).\n\n> [!NOTE]\n> The old version is still available on the [legacy branch](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fchat-ui\u002Ftree\u002Flegacy)\n\n## Quickstart\n\nChat UI speaks to OpenAI-compatible APIs only. The fastest way to get running is with the Hugging Face Inference Providers router plus your personal Hugging Face access token.\n\n**Step 1 – Create `.env.local`:**\n\n```env\nOPENAI_BASE_URL=https:\u002F\u002Frouter.huggingface.co\u002Fv1\nOPENAI_API_KEY=hf_************************\n```\n\n`OPENAI_API_KEY` can come from any OpenAI-compatible endpoint you plan to call. Pick the combo that matches your setup and drop the values into `.env.local`:\n\n| Provider                                      | Example `OPENAI_BASE_URL`          | Example key env                                                         |\n| --------------------------------------------- | ---------------------------------- | ----------------------------------------------------------------------- |\n| Hugging Face Inference Providers router       | `https:\u002F\u002Frouter.huggingface.co\u002Fv1` | `OPENAI_API_KEY=hf_xxx` (or `HF_TOKEN` legacy alias)                    |\n| llama.cpp server (`llama.cpp --server --api`) | `http:\u002F\u002F127.0.0.1:8080\u002Fv1`         | `OPENAI_API_KEY=sk-local-demo` (any string works; llama.cpp ignores it) |\n| Ollama (with OpenAI-compatible bridge)        | `http:\u002F\u002F127.0.0.1:11434\u002Fv1`        | `OPENAI_API_KEY=ollama`                                                 |\n| OpenRouter                                    | `https:\u002F\u002Fopenrouter.ai\u002Fapi\u002Fv1`     | `OPENAI_API_KEY=sk-or-v1-...`                                           |\n| Poe                                           | `https:\u002F\u002Fapi.poe.com\u002Fv1`           | `OPENAI_API_KEY=pk_...`                                                 |\n\nCheck the root [`.env` template](.\u002F.env) for the full list of optional variables you can override.\n\n**Step 2 – Install and launch the dev server:**\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fchat-ui\ncd chat-ui\nnpm install\nnpm run dev -- --open\n```\n\nYou now have Chat UI running locally. Open the browser and start chatting.\n\n## Database Options\n\nChat history, users, settings, files, and stats all live in MongoDB. You can point Chat UI at any MongoDB 6\u002F7 deployment.\n\n> [!TIP]\n> For quick local development, you can skip this section. When `MONGODB_URL` is not set, Chat UI falls back to an embedded MongoDB that persists to `.\u002Fdb`.\n\n### MongoDB Atlas (managed)\n\n1. Create a free cluster at [mongodb.com](https:\u002F\u002Fwww.mongodb.com\u002Fpricing).\n2. Add your IP (or `0.0.0.0\u002F0` for development) to the network access list.\n3. Create a database user and copy the connection string.\n4. Paste that string into `MONGODB_URL` in `.env.local`. Keep the default `MONGODB_DB_NAME=chat-ui` or change it per environment.\n\nAtlas keeps MongoDB off your laptop, which is ideal for teams or cloud deployments.\n\n### Local MongoDB (container)\n\nIf you prefer to run MongoDB in a container:\n\n```bash\ndocker run -d -p 27017:27017 --name mongo-chatui mongo:latest\n```\n\nThen set `MONGODB_URL=mongodb:\u002F\u002Flocalhost:27017` in `.env.local`.\n\n## Launch\n\nAfter configuring your environment variables, start Chat UI with:\n\n```bash\nnpm install\nnpm run dev\n```\n\nThe dev server listens on `http:\u002F\u002Flocalhost:5173` by default. Use `npm run build` \u002F `npm run preview` for production builds.\n\n## Optional Docker Image\n\nThe `chat-ui-db` image bundles MongoDB inside the container:\n\n```bash\ndocker run \\\n  -p 3000:3000 \\\n  -e OPENAI_BASE_URL=https:\u002F\u002Frouter.huggingface.co\u002Fv1 \\\n  -e OPENAI_API_KEY=hf_*** \\\n  -v chat-ui-data:\u002Fdata \\\n  ghcr.io\u002Fhuggingface\u002Fchat-ui-db:latest\n```\n\nAll environment variables accepted in `.env.local` can be provided as `-e` flags.\n\n## Extra parameters\n\n### Theming\n\nYou can use a few environment variables to customize the look and feel of chat-ui. These are by default:\n\n```env\nPUBLIC_APP_NAME=ChatUI\nPUBLIC_APP_ASSETS=chatui\nPUBLIC_APP_DESCRIPTION=\"Making the community's best AI chat models available to everyone.\"\nPUBLIC_APP_DATA_SHARING=\n```\n\n- `PUBLIC_APP_NAME` The name used as a title throughout the app.\n- `PUBLIC_APP_ASSETS` Is used to find logos & favicons in `static\u002F$PUBLIC_APP_ASSETS`, current options are `chatui` and `huggingchat`.\n- `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.\n\n### Models\n\nModels are discovered from `${OPENAI_BASE_URL}\u002Fmodels`, and you can optionally override their metadata via the `MODELS` env var (JSON5). Legacy provider‑specific integrations and GGUF discovery are removed. Authorization uses `OPENAI_API_KEY` (preferred). `HF_TOKEN` remains a legacy alias.\n\n### LLM Router (Optional)\n\nChat UI can perform server-side smart routing using [katanemo\u002FArch-Router-1.5B](https:\u002F\u002Fhuggingface.co\u002Fkatanemo\u002FArch-Router-1.5B) as the routing model without running a separate router service. The UI exposes a virtual model alias called \"Omni\" (configurable) that, when selected, chooses the best route\u002Fmodel for each message.\n\n- Provide a routes policy JSON via `LLM_ROUTER_ROUTES_PATH`. No sample file ships with this branch, so you must point the variable to a JSON array you create yourself (for example, commit one in your project like `config\u002Froutes.chat.json`). Each route entry needs `name`, `description`, `primary_model`, and optional `fallback_models`.\n- Configure the Arch router selection endpoint with `LLM_ROUTER_ARCH_BASE_URL` (OpenAI-compatible `\u002Fchat\u002Fcompletions`) and `LLM_ROUTER_ARCH_MODEL` (e.g. `router\u002Fomni`). The Arch call reuses `OPENAI_API_KEY` for auth.\n- Map `other` to a concrete route via `LLM_ROUTER_OTHER_ROUTE` (default: `casual_conversation`). If Arch selection fails, calls fall back to `LLM_ROUTER_FALLBACK_MODEL`.\n- Selection timeout can be tuned via `LLM_ROUTER_ARCH_TIMEOUT_MS` (default 10000).\n- Omni alias configuration: `PUBLIC_LLM_ROUTER_ALIAS_ID` (default `omni`), `PUBLIC_LLM_ROUTER_DISPLAY_NAME` (default `Omni`), and optional `PUBLIC_LLM_ROUTER_LOGO_URL`.\n\nWhen you select Omni in the UI, Chat UI will:\n\n- Call the Arch endpoint once (non-streaming) to pick the best route for the last turns.\n- Emit RouterMetadata immediately (route and actual model used) so the UI can display it.\n- Stream from the selected model via your configured `OPENAI_BASE_URL`. On errors, it tries route fallbacks.\n\nTool and multimodal shortcuts:\n\n- Multimodal: If `LLM_ROUTER_ENABLE_MULTIMODAL=true` and the user sends an image, the router bypasses Arch and uses the model specified in `LLM_ROUTER_MULTIMODAL_MODEL`. Route name: `multimodal`.\n- Tools: If `LLM_ROUTER_ENABLE_TOOLS=true` and the user has at least one MCP server enabled, the router bypasses Arch and uses `LLM_ROUTER_TOOLS_MODEL`. If that model is missing or misconfigured, it falls back to Arch routing. Route name: `agentic`.\n\n### MCP Tools (Optional)\n\nChat UI can call tools exposed by Model Context Protocol (MCP) servers and feed results back to the model using OpenAI function calling. You can preconfigure trusted servers via env, let users add their own, and optionally have the Omni router auto‑select a tools‑capable model.\n\nConfigure servers (base list for all users):\n\n```env\n# JSON array of servers: name, url, optional headers\nMCP_SERVERS=[\n  {\"name\": \"Web Search (Exa)\", \"url\": \"https:\u002F\u002Fmcp.exa.ai\u002Fmcp\"},\n  {\"name\": \"Hugging Face MCP Login\", \"url\": \"https:\u002F\u002Fhf.co\u002Fmcp?login\"}\n]\n\n# Forward the signed-in user's Hugging Face token to the official HF MCP login endpoint\n# when no Authorization header is set on that server entry.\nMCP_FORWARD_HF_USER_TOKEN=true\n```\n\nEnable router tool path (Omni):\n\n- Set `LLM_ROUTER_ENABLE_TOOLS=true` and choose a tools‑capable target with `LLM_ROUTER_TOOLS_MODEL=\u003Cmodel id or name>`.\n- The target must support OpenAI tools\u002Ffunction calling. Chat UI surfaces a “tools” badge on models that advertise this; you can also force‑enable it per‑model in settings (see below).\n\nUse tools in the UI:\n\n- Open “MCP Servers” from the top‑right menu or from the `+` menu in the chat input to add servers, toggle them on, and run Health Check. The server card lists available tools.\n- When a model calls a tool, the message shows a compact “tool” block with parameters, a progress bar while running, and the result (or error). Results are also provided back to the model for follow‑up.\n\nPer‑model overrides:\n\n- In Settings → Model, you can toggle “Tool calling (functions)” and “Multimodal input” per model. These overrides apply even if the provider metadata doesn’t advertise the capability.\n\n## Building\n\nTo create a production version of your app:\n\n```bash\nnpm run build\n```\n\nYou can preview the production build with `npm run preview`.\n\n> To deploy your app, you may need to install an [adapter](https:\u002F\u002Fkit.svelte.dev\u002Fdocs\u002Fadapters) for your target environment.\n","huggingface\u002Fchat-ui 是一个为大型语言模型（LLMs）设计的聊天界面，它基于 SvelteKit 框架构建，并支持 HuggingChat 应用。该项目使用 TypeScript 编写，集成了 TailwindCSS 和 Svelte 等现代前端技术，提供了一个响应迅速且用户友好的界面。核心功能包括通过 OpenAI 兼容 API 与多种后端服务交互的能力，如 Hugging Face Inference Providers、llama.cpp 服务器等。适用于需要快速搭建自定义聊天应用或集成现有 LLMs 的开发者，特别适合那些希望在研究或生产环境中利用先进 AI 技术进行对话式交互的应用场景。",2,"2026-06-11 03:36:56","high_star"]