index
int64
0
0
repo_id
stringclasses
351 values
file_path
stringlengths
26
186
content
stringlengths
1
990k
0
hf_public_repos
hf_public_repos/chat-ui/Dockerfile
# syntax=docker/dockerfile:1 ARG INCLUDE_DB=false FROM node:20-slim AS base ENV PLAYWRIGHT_SKIP_BROWSER_GC=1 # install dotenv-cli RUN npm install -g dotenv-cli # switch to a user that works for spaces RUN userdel -r node RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH ...
0
hf_public_repos
hf_public_repos/chat-ui/.dockerignore
Dockerfile .vscode/ .idea .gitignore LICENSE README.md node_modules/ .svelte-kit/ .env* !.env .env.local
0
hf_public_repos
hf_public_repos/chat-ui/tailwind.config.cjs
const defaultTheme = require("tailwindcss/defaultTheme"); const colors = require("tailwindcss/colors"); /** @type {import('tailwindcss').Config} */ export default { darkMode: "class", mode: "jit", content: ["./src/**/*.{html,js,svelte,ts}"], theme: { extend: { colors: { primary: colors[process.env.PUBLIC_...
0
hf_public_repos
hf_public_repos/chat-ui/svelte.config.js
import adapter from "@sveltejs/adapter-node"; import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"; import dotenv from "dotenv"; import { execSync } from "child_process"; dotenv.config({ path: "./.env.local" }); dotenv.config({ path: "./.env" }); function getCurrentCommitSHA() { try { return execSync("git...
0
hf_public_repos
hf_public_repos/chat-ui/package-lock.json
{ "name": "chat-ui", "version": "0.9.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "chat-ui", "version": "0.9.4", "dependencies": { "@aws-sdk/credential-providers": "^3.592.0", "@cliqz/adblocker-playwright": "^1.27.2", "@gradio/client": "^1.1.1", "@huggingface/h...
0
hf_public_repos
hf_public_repos/chat-ui/tsconfig.json
{ "extends": "./.svelte-kit/tsconfig.json", "compilerOptions": { "allowJs": true, "checkJs": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "skipLibCheck": true, "sourceMap": true, "strict": true, "target": "ES2018" }, "exclude": ["vite.config.t...
0
hf_public_repos
hf_public_repos/chat-ui/LICENSE
Copyright 2018- The Hugging Face team. All rights reserved. Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" ...
0
hf_public_repos
hf_public_repos/chat-ui/PRIVACY.md
## Privacy > Last updated: April 15, 2024 Users of HuggingChat are authenticated through their HF user account. 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....
0
hf_public_repos
hf_public_repos/chat-ui/.npmrc
engine-strict=true
0
hf_public_repos
hf_public_repos/chat-ui/.eslintignore
.DS_Store node_modules /build /.svelte-kit /package .env .env.* !.env.example # Ignore files for PNPM, NPM and YARN pnpm-lock.yaml package-lock.json yarn.lock
0
hf_public_repos
hf_public_repos/chat-ui/README.md
# Chat UI **Find the docs at [hf.co/docs/chat-ui](https://huggingface.co/docs/chat-ui/index).** ![Chat UI repository thumbnail](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/chatui-websearch.png) A chat interface using open source models, eg OpenAssistant or Llama. It is a SvelteKit a...
0
hf_public_repos
hf_public_repos/chat-ui/.env
# Use .env.local to change these variables # DO NOT EDIT THIS FILE WITH SENSITIVE DATA ### MongoDB ### MONGODB_URL=#your mongodb URL here, use chat-ui-db image if you don't want to set this MONGODB_DB_NAME=chat-ui MONGODB_DIRECT_CONNECTION=false ### Endpoints config ### HF_API_ROOT=https://api-inference.huggingface....
0
hf_public_repos
hf_public_repos/chat-ui/.eslintrc.cjs
module.exports = { root: true, parser: "@typescript-eslint/parser", extends: [ "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:svelte/recommended", "prettier", ], plugins: ["@typescript-eslint"], ignorePatterns: ["*.cjs"], overrides: [ { files: ["*.svelte"], parser: "svelte...
0
hf_public_repos
hf_public_repos/chat-ui/.prettierignore
.DS_Store node_modules /build /.svelte-kit /package /chart .env .env.* !.env.example # Ignore files for PNPM, NPM and YARN pnpm-lock.yaml package-lock.json yarn.lock
0
hf_public_repos
hf_public_repos/chat-ui/package.json
{ "name": "chat-ui", "version": "0.9.4", "private": true, "packageManager": "npm@9.5.0", "scripts": { "dev": "vite dev", "build": "vite build", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./ts...
0
hf_public_repos
hf_public_repos/chat-ui/postcss.config.js
export default { plugins: { tailwindcss: {}, autoprefixer: {}, }, };
0
hf_public_repos
hf_public_repos/chat-ui/entrypoint.sh
ENV_LOCAL_PATH=/app/.env.local if test -z "${DOTENV_LOCAL}" ; then if ! test -f "${ENV_LOCAL_PATH}" ; then echo "DOTENV_LOCAL was not found in the ENV variables and .env.local is not set using a bind volume. Make sure to set environment variables properly. " fi; else echo "DOTENV_LOCAL was found in...
0
hf_public_repos
hf_public_repos/chat-ui/PROMPTS.md
# Prompt templates 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). ## Llama 2 ```env <s>[INST] <<SYS>>\n{{preprompt}}\n<</SYS>>\n\n{{#each messages}}{{#ifUser}...
0
hf_public_repos
hf_public_repos/chat-ui/.prettierrc
{ "useTabs": true, "trailingComma": "es5", "printWidth": 100, "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], "pluginSearchDirs": ["."], "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] }
0
hf_public_repos
hf_public_repos/chat-ui/.env.ci
MONGODB_URL=mongodb://localhost:27017/
0
hf_public_repos
hf_public_repos/chat-ui/vite.config.ts
import { sveltekit } from "@sveltejs/kit/vite"; import Icons from "unplugin-icons/vite"; import { promises } from "fs"; import { defineConfig } from "vitest/config"; // used to load fonts server side for thumbnail generation function loadTTFAsArrayBuffer() { return { name: "load-ttf-as-array-buffer", async transf...
0
hf_public_repos/chat-ui
hf_public_repos/chat-ui/chart/values.yaml
image: repository: ghcr.io/huggingface name: chat-ui tag: 0.0.0-latest pullPolicy: IfNotPresent replicas: 3 domain: huggingface.co networkPolicy: enabled: false allowedBlocks: [] service: type: NodePort annotations: { } serviceAccount: enabled: false create: false name: "" automountServiceA...
0
hf_public_repos/chat-ui
hf_public_repos/chat-ui/chart/Chart.yaml
apiVersion: v2 name: chat-ui version: 0.0.0-latest type: application icon: https://huggingface.co/front/assets/huggingface_logo-noborder.svg
0
hf_public_repos/chat-ui/chart
hf_public_repos/chat-ui/chart/templates/network-policy.yaml
{{- if $.Values.networkPolicy.enabled }} apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: {{ include "name" . }} namespace: {{ .Release.Namespace }} spec: egress: - ports: - port: 53 protocol: UDP to: - namespaceSelector: matchLabels: ...
0
hf_public_repos/chat-ui/chart
hf_public_repos/chat-ui/chart/templates/config.yaml
apiVersion: v1 kind: ConfigMap metadata: labels: {{ include "labels.standard" . | nindent 4 }} name: {{ include "name" . }} namespace: {{ .Release.Namespace }} data: {{- range $key, $value := $.Values.envVars }} {{ $key }}: {{ $value | quote }} {{- end }}
0
hf_public_repos/chat-ui/chart
hf_public_repos/chat-ui/chart/templates/service-account.yaml
{{- if and .Values.serviceAccount.enabled .Values.serviceAccount.create }} apiVersion: v1 kind: ServiceAccount automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} metadata: name: "{{ .Values.serviceAccount.name | default (include "name" .) }}" namespace: {{ .Release.Namespace }} ...
0
hf_public_repos/chat-ui/chart
hf_public_repos/chat-ui/chart/templates/infisical.yaml
{{- if .Values.infisical.enabled }} apiVersion: secrets.infisical.com/v1alpha1 kind: InfisicalSecret metadata: name: {{ include "name" $ }}-infisical-secret namespace: {{ $.Release.Namespace }} spec: authentication: universalAuth: credentialsRef: secretName: {{ .Values.infisical.operatorSecretNa...
0
hf_public_repos/chat-ui/chart
hf_public_repos/chat-ui/chart/templates/deployment.yaml
apiVersion: apps/v1 kind: Deployment metadata: labels: {{ include "labels.standard" . | nindent 4 }} name: {{ include "name" . }} namespace: {{ .Release.Namespace }} {{- if .Values.infisical.enabled }} annotations: secrets.infisical.com/auto-reload: "true" {{- end }} spec: progressDeadlineSeconds: 600...
0
hf_public_repos/chat-ui/chart
hf_public_repos/chat-ui/chart/templates/service.yaml
apiVersion: v1 kind: Service metadata: name: "{{ include "name" . }}" annotations: {{ toYaml .Values.service.annotations | nindent 4 }} namespace: {{ .Release.Namespace }} labels: {{ include "labels.standard" . | nindent 4 }} spec: ports: - name: http port: 80 protocol: TCP targetPort: http {{...
0
hf_public_repos/chat-ui/chart
hf_public_repos/chat-ui/chart/templates/_helpers.tpl
{{- define "name" -}} {{- default $.Release.Name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- define "app.name" -}} chat-ui {{- end -}} {{- define "labels.standard" -}} release: {{ $.Release.Name | quote }} heritage: {{ $.Release.Service | quote }} chart: "{{ include "name" . }}" app: "{{ include "app.name" . }}" ...
0
hf_public_repos/chat-ui/chart
hf_public_repos/chat-ui/chart/templates/service-monitor.yaml
{{- if $.Values.monitoring.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: labels: {{ include "labels.standard" . | nindent 4 }} name: {{ include "name" . }} namespace: {{ .Release.Namespace }} spec: selector: matchLabels: {{ include "labels.standard" . | nindent 6 }} endpoi...
0
hf_public_repos/chat-ui/chart
hf_public_repos/chat-ui/chart/templates/hpa.yaml
{{- if $.Values.autoscaling.enabled }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: labels: {{ include "labels.standard" . | nindent 4 }} name: {{ include "name" . }} namespace: {{ .Release.Namespace }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: {{ include...
0
hf_public_repos/chat-ui/chart
hf_public_repos/chat-ui/chart/templates/ingress.yaml
{{- if $.Values.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: {{ toYaml .Values.ingress.annotations | nindent 4 }} labels: {{ include "labels.standard" . | nindent 4 }} name: {{ include "name" . }} namespace: {{ .Release.Namespace }} spec: {{ if $.Values.ingress.clas...
0
hf_public_repos/chat-ui/chart
hf_public_repos/chat-ui/chart/env/prod.yaml
image: repository: huggingface name: chat-ui nodeSelector: role-hub-utils: "true" tolerations: - key: CriticalAddonsOnly operator: Equal serviceAccount: enabled: true create: true name: huggingchat-prod networkPolicy: enabled: true allowedBlocks: - 10.0.252.0/25 - 10.240.0.0/24 ingres...
0
hf_public_repos/chat-ui/docs
hf_public_repos/chat-ui/docs/source/_toctree.yml
- local: index title: 🤗 Chat UI - title: Installation sections: - local: installation/local title: Local - local: installation/spaces title: Spaces - local: installation/docker title: Docker - local: installation/helm title: Helm - title: Configuration sections: - loca...
0
hf_public_repos/chat-ui/docs
hf_public_repos/chat-ui/docs/source/index.md
# 🤗 Chat UI Open source chat interface with support for tools, web search, multimodal and many API providers. The app uses MongoDB and SvelteKit behind the scenes. Try the live version of the app called [HuggingChat on hf.co/chat](https://huggingface.co/chat) or [setup your own instance](./installation/spaces). 🔧 *...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/configuration/open-id.md
# OpenID 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: ```ini OPENID_CONFIG=`{ PROVIDER_URL: "<your OIDC issuer>", CLIENT_ID: "<your OIDC client ID...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/configuration/common-issues.md
# Common Issues ## 403:You don't have access to this conversation 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`...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/configuration/overview.md
# Configuration Overview Chat UI handles configuration with environment variables. The default config for Chat UI is stored in the `.env` file, which you may use as a reference. You will need to override some values to get Chat UI to run locally. This can be done in `.env.local` or via your environment. The bare minim...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/configuration/web-search.md
# Web Search Chat UI features a powerful Web Search feature. A high level overview of how it works: 1. Generate an appropriate search query from the user prompt using the `TASK_MODEL` 2. Perform web search via an external provider (i.e. Serper) or via locally scrape Google results 3. Load each search result into play...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/configuration/theming.md
# Theming You can use a few environment variables to customize the look and feel of Chat UI. These are by default: ```ini PUBLIC_APP_NAME=ChatUI PUBLIC_APP_ASSETS=chatui PUBLIC_APP_COLOR=blue PUBLIC_APP_DESCRIPTION="Making the community's best AI chat models available to everyone." PUBLIC_APP_DATA_SHARING= PUBLIC_APP...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/configuration/metrics.md
# Metrics 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`. <Tip> In development with `npm run dev`, the metrics server does not shutdown gracefully due to Sveltekit not providing ...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/configuration/embeddings.md
# Text Embedding Models 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-sma...
0
hf_public_repos/chat-ui/docs/source/configuration
hf_public_repos/chat-ui/docs/source/configuration/models/multimodal.md
# Multimodal 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...
0
hf_public_repos/chat-ui/docs/source/configuration
hf_public_repos/chat-ui/docs/source/configuration/models/overview.md
# Models Overview 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 : ```ini MODELS=`[ { "name": "mistralai/Mistral-7B-Instruct-v0.2", "displayName": "mistralai/Mistr...
0
hf_public_repos/chat-ui/docs/source/configuration
hf_public_repos/chat-ui/docs/source/configuration/models/tools.md
# Tools Tool calling instructs the model to generate an output matching a user-defined schema, which may be parsed for invoking external tools. The model simply chooses the tools and their parameters. Currently, only `TGI` and `Cohere` with `Command R+` are supported. <div class="flex justify-center"> <img class="blo...
0
hf_public_repos/chat-ui/docs/source/configuration/models
hf_public_repos/chat-ui/docs/source/configuration/models/providers/cloudflare.md
# Cloudflare | Feature | Available | | --------------------------- | --------- | | [Tools](../tools) | No | | [Multimodal](../multimodal) | No | You may use Cloudflare Workers AI to run your own models with serverless inference. You will need to have a Cloudflare account, ...
0
hf_public_repos/chat-ui/docs/source/configuration/models
hf_public_repos/chat-ui/docs/source/configuration/models/providers/llamacpp.md
# Llama.cpp | Feature | Available | | --------------------------- | --------- | | [Tools](../tools) | No | | [Multimodal](../multimodal) | No | Chat UI supports the llama.cpp API server directly without the need for an adapter. You can do this using the `llamacpp` endpoint ...
0
hf_public_repos/chat-ui/docs/source/configuration/models
hf_public_repos/chat-ui/docs/source/configuration/models/providers/aws.md
# Amazon Web Services (AWS) | Feature | Available | | --------------------------- | --------- | | [Tools](../tools) | No | | [Multimodal](../multimodal) | No | You may specify your Amazon SageMaker instance as an endpoint for Chat UI: ```ini MODELS=`[{ "name": "your-mode...
0
hf_public_repos/chat-ui/docs/source/configuration/models
hf_public_repos/chat-ui/docs/source/configuration/models/providers/anthropic.md
# Anthropic | Feature | Available | | --------------------------- | --------- | | [Tools](../tools) | No | | [Multimodal](../multimodal) | Yes | We also support Anthropic models (including multimodal ones via `multmodal: true`) through the official SDK. You may provide your ...
0
hf_public_repos/chat-ui/docs/source/configuration/models
hf_public_repos/chat-ui/docs/source/configuration/models/providers/cohere.md
# Cohere | Feature | Available | | --------------------------- | --------- | | [Tools](../tools) | Yes | | [Multimodal](../multimodal) | No | You may use Cohere to run their models directly from Chat UI. You will need to have a Cohere account, then get your [API token](https...
0
hf_public_repos/chat-ui/docs/source/configuration/models
hf_public_repos/chat-ui/docs/source/configuration/models/providers/ollama.md
# Ollama | Feature | Available | | --------------------------- | --------- | | [Tools](../tools) | No | | [Multimodal](../multimodal) | No | We also support the Ollama inference server. Spin up a model with ```bash ollama run mistral ``` Then specify the endpoints like so...
0
hf_public_repos/chat-ui/docs/source/configuration/models
hf_public_repos/chat-ui/docs/source/configuration/models/providers/google.md
# Google | Feature | Available | | --------------------------- | --------- | | [Tools](../tools) | No | | [Multimodal](../multimodal) | No | Chat UI can connect to the google Vertex API endpoints ([List of supported models](https://cloud.google.com/vertex-ai/generative-ai/d...
0
hf_public_repos/chat-ui/docs/source/configuration/models
hf_public_repos/chat-ui/docs/source/configuration/models/providers/langserve.md
# LangServe | Feature | Available | | --------------------------- | --------- | | [Tools](../tools) | No | | [Multimodal](../multimodal) | No | LangChain applications that are deployed using LangServe can be called with the following config: ```ini MODELS=`[ { "name"...
0
hf_public_repos/chat-ui/docs/source/configuration/models
hf_public_repos/chat-ui/docs/source/configuration/models/providers/openai.md
# OpenAI | Feature | Available | | --------------------------- | --------- | | [Tools](../tools) | No | | [Multimodal](../multimodal) | No | Chat UI can be used with any API server that supports OpenAI API compatibility, for example [text-generation-webui](https://github.co...
0
hf_public_repos/chat-ui/docs/source/configuration/models
hf_public_repos/chat-ui/docs/source/configuration/models/providers/tgi.md
# Text Generation Inference (TGI) | Feature | Available | | --------------------------- | --------- | | [Tools](../tools) | Yes\* | | [Multimodal](../multimodal) | Yes\* | \* Tools are only supported with the Cohere Command R+ model with the Xenova tokenizers. Please see the [Too...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/developing/architecture.md
# Architecture This document discusses the high level overview of the Chat UI codebase. If you're looking to contribute or just want to understand how the codebase works, this is the place for you! ## Overview Chat UI provides a simple interface connecting LLMs to external information and tools. The project uses [Mo...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/developing/copy-huggingchat.md
# Copy HuggingChat 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 workflo...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/installation/local.md
# Running Locally You may start an instance locally for non-production use cases. For production use cases, please see the other installation options. ## Configuration 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. Start by creating a...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/installation/docker.md
# Running on Docker Pre-built docker images are provided with and without MongoDB built in. Refer to the [configuration section](../configuration/overview) for env variables that must be provided. We recommend using the `--env-file` option to avoid leaking secrets into your shell history. ```bash # Without built-in D...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/installation/spaces.md
# Running on Huggingface Spaces 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. You can deploy your own customized Chat UI instance with any supported [LLM](https://huggingface.co/models?pipeline_tag=text-generation) of your choice on ...
0
hf_public_repos/chat-ui/docs/source
hf_public_repos/chat-ui/docs/source/installation/helm.md
# Helm <Tip warning={true}> **We highly discourage using the chart**. The Helm chart is a work in progress and should be considered unstable. Breaking changes to the chart may be pushed without migration guides or notice. Contributions welcome! </Tip> For installation on Kubernetes, you may use the helm chart in `/...
0
hf_public_repos/chat-ui
hf_public_repos/chat-ui/.husky/pre-commit
set -e npx lint-staged --config ./.husky/lint-stage-config.js
0
hf_public_repos/chat-ui
hf_public_repos/chat-ui/.husky/lint-stage-config.js
export default { "*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix", "eslint"], "*.json": ["prettier --write"], };
0
hf_public_repos/chat-ui
hf_public_repos/chat-ui/src/ambient.d.ts
declare module "*.ttf" { const value: ArrayBuffer; export default value; }
0
hf_public_repos/chat-ui
hf_public_repos/chat-ui/src/app.d.ts
/// <reference types="@sveltejs/kit" /> /// <reference types="unplugin-icons/types/svelte" /> import type { User } from "$lib/types/User"; // See https://kit.svelte.dev/docs/types#app // for information about these interfaces declare global { namespace App { // interface Error {} interface Locals { sessionId:...
0
hf_public_repos/chat-ui
hf_public_repos/chat-ui/src/app.html
<!DOCTYPE html> <html lang="en" class="h-full"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="rgb(249, 250, 251)" /> <script> if ( localStorage.theme === "dark" || (!("theme" in localStorage) && window.matchMe...
0
hf_public_repos/chat-ui
hf_public_repos/chat-ui/src/hooks.server.ts
import { env } from "$env/dynamic/private"; import { env as envPublic } from "$env/dynamic/public"; import type { Handle, HandleServerError } from "@sveltejs/kit"; import { collections } from "$lib/server/database"; import { base } from "$app/paths"; import { findUser, refreshSessionCookie, requiresUser } from "$lib/se...
0
hf_public_repos/chat-ui/src
hf_public_repos/chat-ui/src/styles/highlight-js.css
@import "highlight.js/styles/atom-one-dark";
0
hf_public_repos/chat-ui/src
hf_public_repos/chat-ui/src/styles/main.css
@import "./highlight-js.css"; @tailwind base; @tailwind components; @tailwind utilities; @layer components { .btn { @apply inline-flex flex-shrink-0 cursor-pointer select-none items-center justify-center whitespace-nowrap outline-none transition-all focus:ring disabled:cursor-default; } } @layer utilities { .sc...
0
hf_public_repos/chat-ui/src
hf_public_repos/chat-ui/src/routes/+layout.svelte
<script lang="ts"> import "../styles/main.css"; import { onDestroy, onMount } from "svelte"; import { goto } from "$app/navigation"; import { base } from "$app/paths"; import { page } from "$app/stores"; import { env as envPublic } from "$env/dynamic/public"; import { error } from "$lib/stores/errors"; impor...
0
hf_public_repos/chat-ui/src
hf_public_repos/chat-ui/src/routes/+page.svelte
<script lang="ts"> import { goto } from "$app/navigation"; import { base } from "$app/paths"; import { page } from "$app/stores"; import { env as envPublic } from "$env/dynamic/public"; import ChatWindow from "$lib/components/chat/ChatWindow.svelte"; import { ERROR_MESSAGES, error } from "$lib/stores/errors"; im...
0
hf_public_repos/chat-ui/src
hf_public_repos/chat-ui/src/routes/+error.svelte
<script lang="ts"> import { page } from "$app/stores"; </script> <div class="flex items-center justify-center bg-gradient-to-t from-gray-200 text-gray-800 dark:from-gray-700 dark:text-gray-300" > <div class="align-center -mt-24 flex flex-col justify-center rounded-xl border bg-white px-8 pb-2 pt-4 text-center dar...
0
hf_public_repos/chat-ui/src
hf_public_repos/chat-ui/src/routes/+layout.server.ts
import type { LayoutServerLoad } from "./$types"; import { collections } from "$lib/server/database"; import type { Conversation } from "$lib/types/Conversation"; import { UrlDependency } from "$lib/types/UrlDependency"; import { defaultModel, models, oldModels, validateModel } from "$lib/server/models"; import { authC...
0
hf_public_repos/chat-ui/src/routes/r
hf_public_repos/chat-ui/src/routes/r/[id]/+page.ts
import { redirect, type LoadEvent } from "@sveltejs/kit"; export const load = async ({ params, url }: LoadEvent) => { const leafId = url.searchParams.get("leafId"); throw redirect(302, "../conversation/" + params.id + `?leafId=${leafId}`); };
0
hf_public_repos/chat-ui/src/routes/api
hf_public_repos/chat-ui/src/routes/api/assistants/+server.ts
import { collections } from "$lib/server/database"; import type { Assistant } from "$lib/types/Assistant"; import type { User } from "$lib/types/User"; import { generateQueryTokens } from "$lib/utils/searchTokens.js"; import type { Filter } from "mongodb"; import { env } from "$env/dynamic/private"; import { ReviewStat...
0
hf_public_repos/chat-ui/src/routes/api/assistant
hf_public_repos/chat-ui/src/routes/api/assistant/[id]/+server.ts
import { collections } from "$lib/server/database"; import { ObjectId } from "mongodb"; export async function GET({ params }) { const id = params.id; const assistantId = new ObjectId(id); const assistant = await collections.assistants.findOne({ _id: assistantId, }); if (assistant) { return Response.json(ass...
0
hf_public_repos/chat-ui/src/routes/api
hf_public_repos/chat-ui/src/routes/api/conversations/+server.ts
import { collections } from "$lib/server/database"; import { models } from "$lib/server/models"; import { authCondition } from "$lib/server/auth"; import type { Conversation } from "$lib/types/Conversation"; const NUM_PER_PAGE = 300; export async function GET({ locals, url }) { const p = parseInt(url.searchParams.ge...
0
hf_public_repos/chat-ui/src/routes/api/tools
hf_public_repos/chat-ui/src/routes/api/tools/[toolId]/+server.ts
import { env } from "$env/dynamic/private"; import { collections } from "$lib/server/database.js"; import { toolFromConfigs } from "$lib/server/tools/index.js"; import { ReviewStatus } from "$lib/types/Review"; import type { CommunityToolDB } from "$lib/types/Tool.js"; import { ObjectId } from "mongodb"; export async ...
0
hf_public_repos/chat-ui/src/routes/api/tools
hf_public_repos/chat-ui/src/routes/api/tools/search/+server.ts
import { env } from "$env/dynamic/private"; import { collections } from "$lib/server/database.js"; import { toolFromConfigs } from "$lib/server/tools/index.js"; import type { BaseTool, CommunityToolDB } from "$lib/types/Tool.js"; import { generateQueryTokens, generateSearchTokens } from "$lib/utils/searchTokens.js"; im...
0
hf_public_repos/chat-ui/src/routes/api
hf_public_repos/chat-ui/src/routes/api/spaces-config/+server.ts
import { env } from "$env/dynamic/private"; import { Client } from "@gradio/client"; export async function GET({ url }) { if (env.COMMUNITY_TOOLS !== "true") { return new Response("Community tools are not enabled", { status: 403 }); } const space = url.searchParams.get("space"); if (!space) { return new Resp...
0
hf_public_repos/chat-ui/src/routes/api
hf_public_repos/chat-ui/src/routes/api/models/+server.ts
import { models } from "$lib/server/models"; export async function GET() { const res = models .filter((m) => m.unlisted == false) .map((model) => ({ id: model.id, name: model.name, websiteUrl: model.websiteUrl ?? "https://huggingface.co", modelUrl: model.modelUrl ?? "https://huggingface.co", tokeni...
0
hf_public_repos/chat-ui/src/routes/api/conversation
hf_public_repos/chat-ui/src/routes/api/conversation/[id]/+server.ts
import { collections } from "$lib/server/database"; import { authCondition } from "$lib/server/auth"; import { z } from "zod"; import { models } from "$lib/server/models"; import { ObjectId } from "mongodb"; export async function GET({ locals, params }) { const id = z.string().parse(params.id); const convId = new Ob...
0
hf_public_repos/chat-ui/src/routes/api
hf_public_repos/chat-ui/src/routes/api/user/+server.ts
export async function GET({ locals }) { if (locals.user) { const res = { id: locals.user._id, username: locals.user.username, name: locals.user.name, email: locals.user.email, avatarUrl: locals.user.avatarUrl, hfUserId: locals.user.hfUserId, }; return Response.json(res); } return Response.js...
0
hf_public_repos/chat-ui/src/routes/api/user
hf_public_repos/chat-ui/src/routes/api/user/assistants/+server.ts
import { authCondition } from "$lib/server/auth"; import type { Conversation } from "$lib/types/Conversation"; import { collections } from "$lib/server/database"; import { ObjectId } from "mongodb"; export async function GET({ locals }) { if (locals.user?._id || locals.sessionId) { const settings = await collection...
0
hf_public_repos/chat-ui/src/routes
hf_public_repos/chat-ui/src/routes/assistants/+page.svelte
<script lang="ts"> import type { PageData } from "./$types"; import { env as envPublic } from "$env/dynamic/public"; import { isHuggingChat } from "$lib/utils/isHuggingChat"; import { goto } from "$app/navigation"; import { base } from "$app/paths"; import { page } from "$app/stores"; import CarbonAdd from "~...
0
hf_public_repos/chat-ui/src/routes
hf_public_repos/chat-ui/src/routes/assistants/+page.server.ts
import { base } from "$app/paths"; import { env } from "$env/dynamic/private"; import { Database, collections } from "$lib/server/database.js"; import { SortKey, type Assistant } from "$lib/types/Assistant"; import type { User } from "$lib/types/User"; import { generateQueryTokens } from "$lib/utils/searchTokens.js"; i...
0
hf_public_repos/chat-ui/src/routes/assistant
hf_public_repos/chat-ui/src/routes/assistant/[assistantId]/+page.svelte
<script lang="ts"> import { page } from "$app/stores"; import { base } from "$app/paths"; import { goto } from "$app/navigation"; import { onMount } from "svelte"; import { env as envPublic } from "$env/dynamic/public"; import ChatWindow from "$lib/components/chat/ChatWindow.svelte"; import { findCurrentModel } ...
0
hf_public_repos/chat-ui/src/routes/assistant
hf_public_repos/chat-ui/src/routes/assistant/[assistantId]/+page.server.ts
import { base } from "$app/paths"; import { collections } from "$lib/server/database"; import { redirect } from "@sveltejs/kit"; import { ObjectId } from "mongodb"; import { authCondition } from "$lib/server/auth.js"; export async function load({ params, locals }) { try { const assistant = await collections.assista...
0
hf_public_repos/chat-ui/src/routes/assistant/[assistantId]
hf_public_repos/chat-ui/src/routes/assistant/[assistantId]/thumbnail.png/+server.ts
import ChatThumbnail from "./ChatThumbnail.svelte"; import { collections } from "$lib/server/database"; import { error, type RequestHandler } from "@sveltejs/kit"; import { ObjectId } from "mongodb"; import type { SvelteComponent } from "svelte"; import { Resvg } from "@resvg/resvg-js"; import satori from "satori"; im...
0
hf_public_repos/chat-ui/src/routes/assistant/[assistantId]
hf_public_repos/chat-ui/src/routes/assistant/[assistantId]/thumbnail.png/ChatThumbnail.svelte
<script lang="ts"> export let name: string; export let description: string = ""; export let createdByName: string | undefined; export let avatar: string | undefined; import logo from "../../../../../static/huggingchat/logo.svg?raw"; </script> <div class="flex h-full w-full flex-col items-center justify-center bg...
0
hf_public_repos/chat-ui/src/routes
hf_public_repos/chat-ui/src/routes/settings/+layout.svelte
<script lang="ts"> import { base } from "$app/paths"; import { clickOutside } from "$lib/actions/clickOutside"; import { afterNavigate, goto } from "$app/navigation"; import { useSettingsStore } from "$lib/stores/settings"; import CarbonCheckmark from "~icons/carbon/checkmark"; import { fade, fly } from "svelte/...
0
hf_public_repos/chat-ui/src/routes
hf_public_repos/chat-ui/src/routes/settings/+layout.server.ts
import { collections } from "$lib/server/database"; import type { LayoutServerLoad } from "./$types"; import type { Report } from "$lib/types/Report"; export const load = (async ({ locals, parent }) => { const { assistants } = await parent(); let reportsByUser: string[] = []; const createdBy = locals.user?._id ?? ...
0
hf_public_repos/chat-ui/src/routes/settings
hf_public_repos/chat-ui/src/routes/settings/(nav)/+server.ts
import { collections } from "$lib/server/database"; import { z } from "zod"; import { authCondition } from "$lib/server/auth"; import { DEFAULT_SETTINGS, type SettingsEditable } from "$lib/types/Settings"; import { toolFromConfigs } from "$lib/server/tools/index.js"; import { ObjectId } from "mongodb"; export async fu...
0
hf_public_repos/chat-ui/src/routes/settings
hf_public_repos/chat-ui/src/routes/settings/(nav)/+layout.svelte
<script lang="ts"> import { onMount } from "svelte"; import { base } from "$app/paths"; import { afterNavigate, goto } from "$app/navigation"; import { page } from "$app/stores"; import { useSettingsStore } from "$lib/stores/settings"; import CarbonClose from "~icons/carbon/close"; import CarbonArrowUpRight from...
0
hf_public_repos/chat-ui/src/routes/settings
hf_public_repos/chat-ui/src/routes/settings/(nav)/+page.svelte
<script lang="ts"> import Modal from "$lib/components/Modal.svelte"; import CarbonClose from "~icons/carbon/close"; import CarbonTrashCan from "~icons/carbon/trash-can"; import CarbonArrowUpRight from "~icons/carbon/arrow-up-right"; import { enhance } from "$app/forms"; import { base } from "$app/paths"; impor...
0
hf_public_repos/chat-ui/src/routes/settings/(nav)/assistants
hf_public_repos/chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/+page.ts
import { base } from "$app/paths"; import { redirect } from "@sveltejs/kit"; export async function load({ parent, params }) { const data = await parent(); const assistant = data.settings.assistants.find((id) => id === params.assistantId); if (!assistant) { redirect(302, `${base}/assistant/${params.assistantId}`...
0
hf_public_repos/chat-ui/src/routes/settings/(nav)/assistants
hf_public_repos/chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/+page.svelte
<script lang="ts"> import { enhance } from "$app/forms"; import { base } from "$app/paths"; import { page } from "$app/stores"; import { goto } from "$app/navigation"; import { env as envPublic } from "$env/dynamic/public"; import { useSettingsStore } from "$lib/stores/settings"; import type { PageData } from "....
0
hf_public_repos/chat-ui/src/routes/settings/(nav)/assistants
hf_public_repos/chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/+page.server.ts
import { collections } from "$lib/server/database"; import { type Actions, fail, redirect } from "@sveltejs/kit"; import { ObjectId } from "mongodb"; import { authCondition } from "$lib/server/auth"; import { base } from "$app/paths"; import { env as envPublic } from "$env/dynamic/public"; import { env } from "$env/dyn...
0
hf_public_repos/chat-ui/src/routes/settings/(nav)/assistants
hf_public_repos/chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/ReportModal.svelte
<script lang="ts"> import { applyAction, enhance } from "$app/forms"; import { invalidateAll } from "$app/navigation"; import Modal from "$lib/components/Modal.svelte"; import { createEventDispatcher } from "svelte"; const dispatch = createEventDispatcher<{ close: void }>(); let reason = ""; </script> <Modal o...