├── .babelrc ├── .github ├── FUNDING.yml └── workflows │ └── node.js.yml ├── .gitignore ├── .vscode ├── extensions.json └── launch.json ├── LICENSE ├── README.md ├── app ├── background.js ├── background.js.map ├── globals.css ├── img │ ├── notification.png │ ├── taskbar.png │ └── tray.png ├── preload.js └── preload.js.map ├── astro.config.mjs ├── bin └── Release │ ├── ggml.dll │ ├── llama-baby-llama.exe │ ├── llama-batched-bench.exe │ ├── llama-batched.exe │ ├── llama-bench.exe │ ├── llama-cli.exe │ ├── llama-convert-llama2c-to-ggml.exe │ ├── llama-cvector-generator.exe │ ├── llama-embedding.exe │ ├── llama-eval-callback.exe │ ├── llama-export-lora.exe │ ├── llama-gbnf-validator.exe │ ├── llama-gguf-hash.exe │ ├── llama-gguf-split.exe │ ├── llama-gguf.exe │ ├── llama-gritlm.exe │ ├── llama-imatrix.exe │ ├── llama-infill.exe │ ├── llama-llava-cli.exe │ ├── llama-lookahead.exe │ ├── llama-lookup-create.exe │ ├── llama-lookup-merge.exe │ ├── llama-lookup-stats.exe │ ├── llama-lookup.exe │ ├── llama-minicpmv-cli.exe │ ├── llama-parallel.exe │ ├── llama-passkey.exe │ ├── llama-perplexity.exe │ ├── llama-quantize-stats.exe │ ├── llama-quantize.exe │ ├── llama-retrieval.exe │ ├── llama-save-load-state.exe │ ├── llama-server.exe │ ├── llama-simple.exe │ ├── llama-speculative.exe │ ├── llama-tokenize.exe │ ├── llama.dll │ └── llava_shared.dll ├── build ├── start.js ├── webpack.main.config.js └── webpack.preload.config.js ├── components.json ├── components.json.old ├── package-lock.json ├── package.json ├── public └── favicon.svg ├── src ├── background.js ├── components │ ├── BenchmarkUI.jsx │ ├── ExternalLink.jsx │ ├── Home.jsx │ ├── HoverInfo.jsx │ ├── PageHeader.jsx │ ├── PerplexityUI.jsx │ └── ui │ │ ├── accordion.jsx │ │ ├── alert-dialog.jsx │ │ ├── alert.jsx │ │ ├── aspect-ratio.jsx │ │ ├── avatar.jsx │ │ ├── badge.jsx │ │ ├── breadcrumb.jsx │ │ ├── button.jsx │ │ ├── calendar.jsx │ │ ├── card.jsx │ │ ├── carousel.jsx │ │ ├── chart.jsx │ │ ├── checkbox.jsx │ │ ├── collapsible.jsx │ │ ├── command.jsx │ │ ├── context-menu.jsx │ │ ├── datetime-picker.jsx │ │ ├── dialog.jsx │ │ ├── drawer.jsx │ │ ├── dropdown-menu.jsx │ │ ├── form.jsx │ │ ├── hover-card.jsx │ │ ├── input-otp.jsx │ │ ├── input.jsx │ │ ├── label.jsx │ │ ├── menubar.jsx │ │ ├── navigation-menu.jsx │ │ ├── pagination.jsx │ │ ├── popover.jsx │ │ ├── progress.jsx │ │ ├── radio-group.jsx │ │ ├── resizable.jsx │ │ ├── scroll-area.jsx │ │ ├── select.jsx │ │ ├── separator.jsx │ │ ├── sheet.jsx │ │ ├── sidebar.jsx │ │ ├── skeleton.jsx │ │ ├── slider.jsx │ │ ├── sonner.jsx │ │ ├── switch.jsx │ │ ├── table.jsx │ │ ├── tabs.jsx │ │ ├── textarea.jsx │ │ ├── toast.jsx │ │ ├── toaster.jsx │ │ ├── toggle-group.jsx │ │ ├── toggle.jsx │ │ ├── tooltip.jsx │ │ └── use-toast.js ├── data │ └── locales │ │ ├── da │ │ ├── Benchmark.json │ │ ├── InstructionModel.json │ │ ├── PageHeader.json │ │ └── Perplexity.json │ │ ├── de │ │ ├── Benchmark.json │ │ ├── InstructionModel.json │ │ ├── PageHeader.json │ │ └── Perplexity.json │ │ ├── en │ │ ├── Benchmark.json │ │ ├── InstructionModel.json │ │ ├── PageHeader.json │ │ └── Perplexity.json │ │ ├── es │ │ ├── Benchmark.json │ │ ├── InstructionModel.json │ │ ├── PageHeader.json │ │ └── Perplexity.json │ │ ├── fr │ │ ├── Benchmark.json │ │ ├── InstructionModel.json │ │ ├── PageHeader.json │ │ └── Perplexity.json │ │ ├── it │ │ ├── Benchmark.json │ │ ├── InstructionModel.json │ │ ├── PageHeader.json │ │ └── Perplexity.json │ │ ├── ja │ │ ├── Benchmark.json │ │ ├── InstructionModel.json │ │ ├── PageHeader.json │ │ └── Perplexity.json │ │ ├── ko │ │ ├── Benchmark.json │ │ ├── InstructionModel.json │ │ ├── PageHeader.json │ │ └── Perplexity.json │ │ ├── pt │ │ ├── Benchmark.json │ │ ├── InstructionModel.json │ │ ├── PageHeader.json │ │ └── Perplexity.json │ │ ├── th │ │ ├── Benchmark.json │ │ ├── InstructionModel.json │ │ ├── PageHeader.json │ │ └── Perplexity.json │ │ └── tw │ │ ├── Benchmark.json │ │ ├── InstructionModel.json │ │ ├── PageHeader.json │ │ └── Perplexity.json ├── env.d.ts ├── hooks │ ├── use-mobile.jsx │ ├── use-mobile.tsx │ └── use-toast.ts ├── layouts │ └── Layout.astro ├── lib │ ├── applicationMenu.js │ ├── i18n.js │ ├── utils.js │ └── utils.ts ├── pages │ ├── benchmark.astro │ ├── index.astro │ └── perplexity.astro ├── preload.js └── styles │ └── globals.css ├── tailwind.config.cjs ├── tailwind.config.js └── tsconfig.json /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-env"], 4 | "plugins": [ 5 | "@babel/plugin-transform-runtime" 6 | ] 7 | } -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [grctest] 4 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | name: Build/release 2 | 3 | permissions: 4 | contents: write 5 | 6 | on: 7 | push: 8 | tags: 9 | - "v*.*.*" 10 | 11 | jobs: 12 | create_release: 13 | name: Create Release 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Create Release 17 | id: create_release 18 | uses: BTS-CM/action-gh-release@cd28b0f5ee8571b76cfdaa62a30d51d752317477 19 | env: 20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token 21 | with: 22 | name: ${{ github.ref_name }} 23 | draft: true 24 | prerelease: endsWith(github.ref_name, 'rc1') || endsWith(github.ref_name, 'rc2') || endsWith(github.ref_name, 'rc3') 25 | generate_release_notes: false 26 | 27 | build: 28 | name: build_release 29 | needs: create_release 30 | strategy: 31 | matrix: 32 | os: [windows-latest] # windows only 33 | include: 34 | - os: windows-latest 35 | release_suffix: windows 36 | release_format: exe 37 | runs-on: ${{ matrix.os }} 38 | 39 | steps: 40 | - name: Checkout code 41 | uses: actions/checkout@v4 42 | 43 | - name: Use Node.js 44 | uses: actions/setup-node@v4 45 | with: 46 | node-version: 'node' 47 | cache: 'npm' 48 | 49 | - uses: oven-sh/setup-bun@v2 50 | with: 51 | bun-version: 'latest' 52 | 53 | - run: npm install 54 | 55 | - run: npm run-script build:astro 56 | 57 | - run: npm run-script dist:${{ matrix.os }} 58 | 59 | - name: Upload .${{ matrix.release_format }} file 60 | uses: actions/upload-artifact@v4 61 | with: 62 | name: ElectronBitnet.${{ matrix.release_format }} 63 | path: dist/ElectronBitnet.${{ matrix.release_format }} 64 | 65 | - name: Upload .exe.blockmap 66 | if: matrix.release_format == 'exe' 67 | uses: actions/upload-artifact@v4 68 | with: 69 | name: ElectronBitnet.exe.blockmap 70 | path: dist/ElectronBitnet.exe.blockmap 71 | 72 | - name: Upload latest.yml file 73 | if: matrix.release_format == 'exe' 74 | uses: actions/upload-artifact@v4 75 | with: 76 | name: latest.yml 77 | path: dist/latest.yml 78 | 79 | - run: ls dist 80 | 81 | generate: 82 | name: generate files 83 | needs: build 84 | runs-on: ubuntu-latest 85 | steps: 86 | - name: reqs 87 | run: sudo apt-get install unzip 88 | - name: Download VT 89 | run: wget https://github.com/VirusTotal/vt-cli/releases/download/1.0.0/Linux64.zip 90 | - name: Unzip VT 91 | run: unzip Linux64.zip 92 | - name: Prepare 93 | run: chmod +x vt 94 | - name: Download exe 95 | uses: actions/download-artifact@v4 96 | with: 97 | name: ElectronBitnet.exe 98 | path: ~/ 99 | - name: Download exe blockmap 100 | uses: actions/download-artifact@v4 101 | with: 102 | name: ElectronBitnet.exe.blockmap 103 | path: ~/ 104 | - name: Download latest yml 105 | uses: actions/download-artifact@v4 106 | with: 107 | name: latest.yml 108 | path: ~/ 109 | - name: scan 110 | id: scan 111 | run: | 112 | echo "::set-output name=exeVT::$(./vt scan file /home/runner/ElectronBitnet.exe -k ${{ secrets.VT_API_KEY }}|cut -d' ' -f2)" 113 | echo "::set-output name=exeMapVT::$(./vt scan file /home/runner/ElectronBitnet.exe.blockmap -k ${{ secrets.VT_API_KEY }}|cut -d' ' -f2)" 114 | echo "::set-output name=ymlVT::$(./vt scan file /home/runner/latest.yml -k ${{ secrets.VT_API_KEY }}|cut -d' ' -f2)" 115 | - name: Calculate hashes 116 | id: calc_hash 117 | run: | 118 | echo "::set-output name=blockmaphash::$(sha256sum /home/runner/ElectronBitnet.exe.blockmap|cut -c-64)" 119 | echo "::set-output name=ymlhash::$(sha256sum /home/runner/latest.yml|cut -c-64)" 120 | echo "::set-output name=exehash::$(sha256sum /home/runner/ElectronBitnet.exe|cut -c-64)" 121 | - name: Perform release 122 | uses: BTS-CM/action-gh-release@cd28b0f5ee8571b76cfdaa62a30d51d752317477 123 | with: 124 | files: | 125 | /home/runner/ElectronBitnet.exe 126 | /home/runner/ElectronBitnet.dmg 127 | /home/runner/ElectronBitnet.deb 128 | tag_name: ${{ needs.create_release.outputs.tag-name }} 129 | body: | 130 | Release Notes 131 | _________________________________ 132 | Binaries for download 133 | -------- 134 | | Platform | SHA256 Checksum | VirusTotal Analyses | 135 | |---|---|---| 136 | |[Microsoft Windows](https://github.com/grctest/Electron-BitNet/releases/download/${{ github.ref_name }}/ElectronBitnet.exe)|`${{steps.calc_hash.outputs.exehash}}`|[exe](https://www.virustotal.com/gui/file-analysis/${{steps.scan.outputs.exeVT}})| 137 | |[EXE blockmap](https://github.com/grctest/Electron-BitNet/releases/download/${{ github.ref_name }}/ElectronBitnet.exe.blockmap)|`${{steps.calc_hash.outputs.blockmaphash}}`|[blockmap](https://www.virustotal.com/gui/file-analysis/${{steps.scan.outputs.exeMapVT}})| 138 | |[Latest.yml](https://github.com/grctest/Electron-BitNet/releases/download/${{ github.ref_name }}/latest.yml)|`${{steps.calc_hash.outputs.ymlhash}}`|[yml](https://www.virustotal.com/gui/file-analysis/${{steps.scan.outputs.ymlVT}})| 139 | env: 140 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # build output 2 | dist/ 3 | 4 | # generated types 5 | .astro/ 6 | 7 | # dependencies 8 | node_modules/ 9 | 10 | # logs 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # environment variables 17 | .env 18 | .env.production 19 | 20 | # macOS-specific files 21 | .DS_Store 22 | 23 | # jetbrains setting folder 24 | .idea/ 25 | 26 | astroDist 27 | dist 28 | # models/ggml-model-i2_s.gguf 29 | models/ggml-model-i2_s.gguf 30 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["astro-build.astro-vscode"], 3 | "unwantedRecommendations": [] 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "command": "./node_modules/.bin/astro dev", 6 | "name": "Development server", 7 | "request": "launch", 8 | "type": "node-terminal" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 R 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Electron-BitNet 2 | 3 | Running [Microsoft's BitNet](https://github.com/microsoft/BitNet) via [Astro](https://astro.build/), [React](https://react.dev/) & [Electron](https://www.electronjs.org/)! 4 | 5 | ![image](https://github.com/user-attachments/assets/d8af4105-7ca6-49b6-9b6c-5ead7f332b11) 6 | 7 | ## Functionality 8 | 9 | * Run Microsoft's official BitNet model in chat mode 10 | * Benchmark BitNet models 11 | * Calculate BitNet model perplexity 12 | * Switch between multiple languages 13 | 14 | ## How to setup this application 15 | 16 | - Use python to prepare 1-bit models 17 | - Follow [Microsoft's instructions](https://github.com/microsoft/BitNet?tab=readme-ov-file#installation), installing visual studio 2022 (including c++ desktop build tools & clang build tools) and preparing Microsoft's [Official BitNet model](https://huggingface.co/microsoft/bitnet-b1.58-2B-4T) for use. 18 | - OR: Download Microsoft's official BitNet model directly: https://huggingface.co/microsoft/bitnet-b1.58-2B-4T-gguf 19 | - Supports generated gguf models. 20 | - Run the commands below to build and run the app 21 | 22 | | Command | Action | 23 | | :------------------------------------- | :----------------------------------------------- | 24 | | `npm install` | Installs dependencies | 25 | | `npm run restart` | Starts local dev server at `localhost:4321` | 26 | | `npm run build:astro` | Builds the production site at `./dist/` | 27 | | `npm run build:astro \| npm run start` | Builds then runs the electorn app in dev mode. | 28 | | `npm run dist:windows-latest` | Builds the windows application. | 29 | 30 | Reference project: https://github.com/microsoft/BitNet 31 | 32 | --- 33 | 34 | Note: At the moment only Windows is supported, Linux support may come in the future. 35 | 36 | --- 37 | 38 | Prefer to use an installer? Check out the [latest windows releases](https://github.com/grctest/Electron-BitNet/releases)! 39 | -------------------------------------------------------------------------------- /app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | 6 | @layer base { 7 | :root { 8 | --foreground: 222.2 84% 4.9%; 9 | --card: 0 0% 100%; 10 | --card-foreground: 222.2 84% 4.9%; 11 | --popover: 0 0% 100%; 12 | --popover-foreground: 222.2 84% 4.9%; 13 | --primary: 222.2 47.4% 11.2%; 14 | --primary-foreground: 210 40% 98%; 15 | --secondary: 210 40% 96.1%; 16 | --secondary-foreground: 222.2 47.4% 11.2%; 17 | --muted: 210 40% 96.1%; 18 | --muted-foreground: 215.4 16.3% 46.9%; 19 | --destructive: 0 84.2% 60.2%; 20 | --destructive-foreground: 210 40% 98%; 21 | --border: 214.3 31.8% 91.4%; 22 | --input: 214.3 31.8% 91.4%; 23 | --ring: 222.2 84% 4.9%; 24 | --radius: 0.5rem; 25 | --chart-1: 12 76% 61%; 26 | --chart-2: 173 58% 39%; 27 | --chart-3: 197 37% 24%; 28 | --chart-4: 43 74% 66%; 29 | --chart-5: 27 87% 67%; 30 | --background: 0 0% 100%; 31 | --accent: 210 40% 96.1%; 32 | --accent-foreground: 222.2 47.4% 11.2%; 33 | } 34 | 35 | .dark { 36 | --foreground: 210 40% 98%; 37 | --card: 222.2 84% 4.9%; 38 | --card-foreground: 210 40% 98%; 39 | --popover: 222.2 84% 4.9%; 40 | --popover-foreground: 210 40% 98%; 41 | --primary: 210 40% 98%; 42 | --primary-foreground: 222.2 47.4% 11.2%; 43 | --secondary: 217.2 32.6% 17.5%; 44 | --secondary-foreground: 210 40% 98%; 45 | --muted: 217.2 32.6% 17.5%; 46 | --muted-foreground: 215 20.2% 65.1%; 47 | --destructive: 0 62.8% 30.6%; 48 | --destructive-foreground: 210 40% 98%; 49 | --border: 217.2 32.6% 17.5%; 50 | --input: 217.2 32.6% 17.5%; 51 | --ring: 212.7 26.8% 83.9%; 52 | --chart-1: 220 70% 50%; 53 | --chart-2: 160 60% 45%; 54 | --chart-3: 30 80% 55%; 55 | --chart-4: 280 65% 60%; 56 | --chart-5: 340 75% 55%; 57 | --background: 222.2 84% 4.9%; 58 | --accent: 217.2 32.6% 17.5%; 59 | --accent-foreground: 210 40% 98%; 60 | } 61 | } 62 | 63 | 64 | @layer base { 65 | * { 66 | @apply border-border; 67 | } 68 | body { 69 | @apply bg-background text-foreground; 70 | } 71 | } -------------------------------------------------------------------------------- /app/img/notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/app/img/notification.png -------------------------------------------------------------------------------- /app/img/taskbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/app/img/taskbar.png -------------------------------------------------------------------------------- /app/img/tray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/app/img/tray.png -------------------------------------------------------------------------------- /astro.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "astro/config"; 2 | import react from "@astrojs/react"; 3 | import tailwind from "@astrojs/tailwind"; 4 | 5 | export default defineConfig({ 6 | outDir: "./astroDist", 7 | publicDir: "./src/data", 8 | integrations: [ 9 | react(), 10 | tailwind({ 11 | applyBaseStyles: false, 12 | }), 13 | ], 14 | }); 15 | -------------------------------------------------------------------------------- /bin/Release/ggml.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/ggml.dll -------------------------------------------------------------------------------- /bin/Release/llama-baby-llama.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-baby-llama.exe -------------------------------------------------------------------------------- /bin/Release/llama-batched-bench.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-batched-bench.exe -------------------------------------------------------------------------------- /bin/Release/llama-batched.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-batched.exe -------------------------------------------------------------------------------- /bin/Release/llama-bench.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-bench.exe -------------------------------------------------------------------------------- /bin/Release/llama-cli.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-cli.exe -------------------------------------------------------------------------------- /bin/Release/llama-convert-llama2c-to-ggml.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-convert-llama2c-to-ggml.exe -------------------------------------------------------------------------------- /bin/Release/llama-cvector-generator.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-cvector-generator.exe -------------------------------------------------------------------------------- /bin/Release/llama-embedding.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-embedding.exe -------------------------------------------------------------------------------- /bin/Release/llama-eval-callback.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-eval-callback.exe -------------------------------------------------------------------------------- /bin/Release/llama-export-lora.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-export-lora.exe -------------------------------------------------------------------------------- /bin/Release/llama-gbnf-validator.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-gbnf-validator.exe -------------------------------------------------------------------------------- /bin/Release/llama-gguf-hash.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-gguf-hash.exe -------------------------------------------------------------------------------- /bin/Release/llama-gguf-split.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-gguf-split.exe -------------------------------------------------------------------------------- /bin/Release/llama-gguf.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-gguf.exe -------------------------------------------------------------------------------- /bin/Release/llama-gritlm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-gritlm.exe -------------------------------------------------------------------------------- /bin/Release/llama-imatrix.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-imatrix.exe -------------------------------------------------------------------------------- /bin/Release/llama-infill.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-infill.exe -------------------------------------------------------------------------------- /bin/Release/llama-llava-cli.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-llava-cli.exe -------------------------------------------------------------------------------- /bin/Release/llama-lookahead.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-lookahead.exe -------------------------------------------------------------------------------- /bin/Release/llama-lookup-create.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-lookup-create.exe -------------------------------------------------------------------------------- /bin/Release/llama-lookup-merge.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-lookup-merge.exe -------------------------------------------------------------------------------- /bin/Release/llama-lookup-stats.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-lookup-stats.exe -------------------------------------------------------------------------------- /bin/Release/llama-lookup.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-lookup.exe -------------------------------------------------------------------------------- /bin/Release/llama-minicpmv-cli.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-minicpmv-cli.exe -------------------------------------------------------------------------------- /bin/Release/llama-parallel.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-parallel.exe -------------------------------------------------------------------------------- /bin/Release/llama-passkey.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-passkey.exe -------------------------------------------------------------------------------- /bin/Release/llama-perplexity.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-perplexity.exe -------------------------------------------------------------------------------- /bin/Release/llama-quantize-stats.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-quantize-stats.exe -------------------------------------------------------------------------------- /bin/Release/llama-quantize.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-quantize.exe -------------------------------------------------------------------------------- /bin/Release/llama-retrieval.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-retrieval.exe -------------------------------------------------------------------------------- /bin/Release/llama-save-load-state.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-save-load-state.exe -------------------------------------------------------------------------------- /bin/Release/llama-server.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-server.exe -------------------------------------------------------------------------------- /bin/Release/llama-simple.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-simple.exe -------------------------------------------------------------------------------- /bin/Release/llama-speculative.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-speculative.exe -------------------------------------------------------------------------------- /bin/Release/llama-tokenize.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama-tokenize.exe -------------------------------------------------------------------------------- /bin/Release/llama.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llama.dll -------------------------------------------------------------------------------- /bin/Release/llava_shared.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grctest/Electron-BitNet/64c675d12966b9e72b0ca25f037f5dff4847b2c0/bin/Release/llava_shared.dll -------------------------------------------------------------------------------- /build/start.js: -------------------------------------------------------------------------------- 1 | const childProcess = require('child_process'); 2 | const electron = require('electron'); 3 | const webpack = require('webpack'); 4 | const mainConfig = require('./webpack.main.config.js'); 5 | const preloadConfig = require('./webpack.preload.config.js'); 6 | 7 | const env = "development"; 8 | const mainCompiler = webpack(mainConfig(env)); 9 | const preloadCompiler = webpack(preloadConfig(env)); 10 | 11 | let electronStarted = false; 12 | let mainDone = false; 13 | let preloadDone = false; 14 | 15 | const startElectron = () => { 16 | if (!electronStarted && mainDone && preloadDone) { 17 | electronStarted = true; 18 | 19 | childProcess 20 | .spawn(electron, ["."], { stdio: "inherit" }) 21 | .on("close", () => { 22 | mainWatching.close(); 23 | preloadWatching.close(); 24 | }); 25 | } 26 | }; 27 | 28 | const mainWatching = mainCompiler.watch({}, (err, stats) => { 29 | if (!err && !stats.hasErrors()) { 30 | mainDone = true; 31 | startElectron(); 32 | } 33 | }); 34 | 35 | const preloadWatching = preloadCompiler.watch({}, (err, stats) => { 36 | if (!err && !stats.hasErrors()) { 37 | preloadDone = true; 38 | startElectron(); 39 | } 40 | }); -------------------------------------------------------------------------------- /build/webpack.main.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const nodeExternals = require('webpack-node-externals'); 3 | const FriendlyErrorsWebpackPlugin = require('@soda/friendly-errors-webpack-plugin'); 4 | 5 | module.exports = function(env) { 6 | return { 7 | target: 'electron-main', 8 | entry: { 9 | background: "./src/background.js", 10 | }, 11 | output: { 12 | filename: "[name].js", 13 | path: path.resolve(__dirname, "../app"), 14 | }, 15 | mode: env && env.length ? env : "production", 16 | node: { 17 | __dirname: false, 18 | __filename: false 19 | }, 20 | 21 | externals: [nodeExternals({ 22 | allowlist: [ 23 | '@babel/runtime' 24 | ] 25 | })], 26 | 27 | resolve: { 28 | extensions: ['.js', '.json'], 29 | mainFields: ["main"], 30 | alias: { 31 | env: path.resolve(__dirname, `../config/env_${env}.json`), 32 | '~': path.resolve(__dirname, '../src/'), 33 | } 34 | }, 35 | 36 | devtool: "source-map", 37 | 38 | module: { 39 | rules: [] 40 | }, 41 | 42 | plugins: [ 43 | new FriendlyErrorsWebpackPlugin({ 44 | clearConsole: env === "development", 45 | onErrors: function (severity, errors) { 46 | console.log({severity, errors}) 47 | }, 48 | }) 49 | ] 50 | }; 51 | }; 52 | -------------------------------------------------------------------------------- /build/webpack.preload.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const FriendlyErrorsWebpackPlugin = require('@soda/friendly-errors-webpack-plugin'); 3 | 4 | module.exports = function(env) { 5 | return { 6 | entry: { 7 | preload: "./src/preload.js" 8 | }, 9 | output: { 10 | filename: "[name].js", 11 | path: path.resolve(__dirname, "../app"), 12 | }, 13 | target: 'electron-preload', 14 | mode: env && env.length ? env : "production", 15 | 16 | node: { 17 | __dirname: false, 18 | __filename: false 19 | }, 20 | 21 | externals: [], 22 | 23 | resolve: { 24 | extensions: ['.*', '.js'], 25 | mainFields: ["preload"], 26 | alias: { 27 | env: path.resolve(__dirname, `../config/env_${env}.json`), 28 | '~': path.resolve(__dirname, '../src/') 29 | } 30 | }, 31 | 32 | devtool: "source-map", 33 | 34 | plugins: [ 35 | new FriendlyErrorsWebpackPlugin({ 36 | clearConsole: env === "development", 37 | onErrors: function (severity, errors) { 38 | console.log({severity, errors}) 39 | }, 40 | }) 41 | ] 42 | }; 43 | }; 44 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": false, 5 | "tsx": false, 6 | "tailwind": { 7 | "config": "tailwind.config.cjs", 8 | "css": "app/globals.css", 9 | "baseColor": "slate", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | } 20 | } -------------------------------------------------------------------------------- /components.json.old: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": false, 5 | "tsx": false, 6 | "tailwind": { 7 | "config": "tailwind.config.js", 8 | "css": "app/globals.css", 9 | "baseColor": "slate", 10 | "cssVariables": true 11 | }, 12 | "aliases": { 13 | "components": "@/components", 14 | "utils": "@/lib/utils" 15 | } 16 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-bitnet", 3 | "main": "app/background.js", 4 | "homepage": "https://github.com/grctest/Electron-BitNet", 5 | "repository": "github:grctest/Electron-BitNet", 6 | "author": "grctest", 7 | "description": "Electron Bitnet is a desktop client for Microsoft's Bitnet LLM AI Inference engine.", 8 | "license": "MIT", 9 | "version": "0.0.1", 10 | "browser": { 11 | "app": "app/app.js" 12 | }, 13 | "build": { 14 | "appId": "ElectronBitnet", 15 | "productName": "ElectronBitnet", 16 | "artifactName": "ElectronBitnet.${ext}", 17 | "asar": false, 18 | "npmRebuild": false, 19 | "buildDependenciesFromSource": false, 20 | "includeSubNodeModules": true, 21 | "files": [ 22 | "app/**/*", 23 | "bin/**/*", 24 | "node_modules/**/*", 25 | "package.json" 26 | ], 27 | "extraResources": [ 28 | { 29 | "from": "./astroDist", 30 | "to": "astroDist" 31 | }, 32 | { 33 | "from": "./bin", 34 | "to": "bin" 35 | } 36 | ], 37 | "directories": { 38 | "buildResources": "resources", 39 | "output": "dist" 40 | }, 41 | "nsis": { 42 | "oneClick": false, 43 | "allowToChangeInstallationDirectory": true 44 | }, 45 | "win": { 46 | "target": "nsis" 47 | } 48 | }, 49 | "dependencies": { 50 | "@astrojs/node": "^9.1.3", 51 | "@astrojs/react": "^4.2.1", 52 | "@astrojs/tailwind": "^6.0.1", 53 | "@babel/runtime": "^7.27.0", 54 | "@hookform/resolvers": "^4.1.3", 55 | "@nanostores/persistent": "^0.10.2", 56 | "@nanostores/react": "^0.8.4", 57 | "@radix-ui/react-accordion": "^1.2.3", 58 | "@radix-ui/react-alert-dialog": "^1.1.6", 59 | "@radix-ui/react-aspect-ratio": "^1.1.2", 60 | "@radix-ui/react-avatar": "^1.1.3", 61 | "@radix-ui/react-checkbox": "^1.1.4", 62 | "@radix-ui/react-collapsible": "^1.1.3", 63 | "@radix-ui/react-context-menu": "^2.2.6", 64 | "@radix-ui/react-dialog": "^1.1.6", 65 | "@radix-ui/react-dropdown-menu": "^2.1.6", 66 | "@radix-ui/react-hover-card": "^1.1.6", 67 | "@radix-ui/react-icons": "^1.3.2", 68 | "@radix-ui/react-label": "^2.1.2", 69 | "@radix-ui/react-menubar": "^1.1.6", 70 | "@radix-ui/react-navigation-menu": "^1.2.5", 71 | "@radix-ui/react-popover": "^1.1.6", 72 | "@radix-ui/react-progress": "^1.1.2", 73 | "@radix-ui/react-radio-group": "^1.2.3", 74 | "@radix-ui/react-scroll-area": "^1.2.3", 75 | "@radix-ui/react-select": "^2.1.6", 76 | "@radix-ui/react-separator": "^1.1.2", 77 | "@radix-ui/react-slider": "^1.2.3", 78 | "@radix-ui/react-slot": "^1.1.2", 79 | "@radix-ui/react-switch": "^1.1.3", 80 | "@radix-ui/react-tabs": "^1.1.3", 81 | "@radix-ui/react-toast": "^1.2.6", 82 | "@radix-ui/react-toggle": "^1.1.2", 83 | "@radix-ui/react-toggle-group": "^1.1.2", 84 | "@radix-ui/react-tooltip": "^1.1.8", 85 | "@types/react": "^18.3.12", 86 | "@types/react-dom": "^18.3.1", 87 | "astro": "^5.5.4", 88 | "class-variance-authority": "^0.7.1", 89 | "clsx": "^2.1.1", 90 | "cmdk": "^1.1.1", 91 | "date-fns": "^3.6.0", 92 | "embla-carousel-react": "^8.5.2", 93 | "input-otp": "^1.4.2", 94 | "lucide-react": "^0.453.0", 95 | "mime-types": "^2.1.35", 96 | "nanostores": "^0.11.4", 97 | "next-themes": "^0.3.0", 98 | "react": "^18.3.1", 99 | "react-day-picker": "^8.10.1", 100 | "react-dom": "^18.3.1", 101 | "react-hook-form": "^7.54.2", 102 | "react-i18next": "^15.4.1", 103 | "react-markdown": "^10.1.0", 104 | "react-resizable-panels": "^2.1.7", 105 | "react-syntax-highlighter": "^15.6.1", 106 | "react-window": "^1.8.11", 107 | "recharts": "^2.15.1", 108 | "sonner": "^1.7.4", 109 | "tailwind-merge": "^2.5.4", 110 | "tailwindcss": "^3.4.14", 111 | "tailwindcss-animate": "^1.0.7", 112 | "vaul": "^1.1.2", 113 | "zod": "^3.24.2" 114 | }, 115 | "devDependencies": { 116 | "@babel/core": "^7.26.10", 117 | "@babel/plugin-proposal-object-rest-spread": "^7.20.7", 118 | "@babel/plugin-transform-runtime": "^7.26.10", 119 | "@babel/preset-env": "^7.26.9", 120 | "@soda/friendly-errors-webpack-plugin": "^1.8.1", 121 | "@types/dompurify": "^3.0.5", 122 | "babel-loader": "^10.0.0", 123 | "dompurify": "^3.2.5", 124 | "electron": "^35.0.3", 125 | "electron-builder": "^25.1.8", 126 | "webpack": "^5.98.0", 127 | "webpack-cli": "^6.0.1", 128 | "webpack-merge": "^6.0.1", 129 | "webpack-node-externals": "^3.0.0" 130 | }, 131 | "scripts": { 132 | "dev": "astro dev", 133 | "build:astro": "astro build", 134 | "start": "node build/start.js", 135 | "restart": "npm run-script build:astro && npm run-script start", 136 | "compile": "webpack --config=build/webpack.main.config.js --config=build/webpack.preload.config.js --env=production", 137 | "dist:windows-latest": "npm run-script compile && electron-builder -w --publish never" 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /public/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /src/components/ExternalLink.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | 3 | import { 4 | Dialog, 5 | DialogContent, 6 | DialogDescription, 7 | DialogHeader, 8 | DialogTitle, 9 | } from "@/components/ui/dialog"; 10 | 11 | import { Button } from "@/components/ui/button"; 12 | 13 | const _gradient = { 14 | backgroundImage: "var(--accent-gradient)", 15 | WebkitBackgroundClip: "text", 16 | WebkitTextFillColor: "transparent", 17 | backgroundSize: "400%", 18 | backgroundPosition: "0%", 19 | }; 20 | 21 | const allowedDomains = [ 22 | "https://github.com", 23 | "https://react.dev/", 24 | "https://astro.build/", 25 | "https://www.electronjs.org/" 26 | ]; 27 | 28 | /** 29 | * Launches a dialog prompt, prompting the user to verify their intent to launch a new tab to an external web resource 30 | */ 31 | export default function ExternalLink(properties) { 32 | const { hyperlink, type, text, variant, classnamecontents, gradient } = properties; 33 | 34 | const [open, setOpen] = useState(false); 35 | 36 | if (!allowedDomains.some((domain) => hyperlink.startsWith(domain))) { 37 | console.log("Invalid external link"); 38 | return null; 39 | } 40 | 41 | return ( 42 | <> 43 | {type === "text" ? ( 44 | { 46 | setOpen(true); 47 | event.preventDefault(); 48 | }} 49 | className={classnamecontents} 50 | style={gradient ? _gradient : null} 51 | > 52 | {text} 53 | 54 | ) : ( 55 | 65 | )} 66 | { 69 | setOpen(open); 70 | }} 71 | > 72 | 73 | 74 | ⚠️ You are about to leave this app!" 75 | 76 | You are about to navigate to an external website. 77 | 78 | 79 |

80 | Do you want to proceed to the following URL? 81 |

82 | 83 | {hyperlink} 84 | 85 |

86 | Just checking - are you sure you want to leave? 87 |

88 | 89 |
90 | { 91 | window.electron 92 | ? 95 | : 96 | 99 | 100 | } 101 |
102 |
103 |
104 | 105 | ); 106 | } 107 | -------------------------------------------------------------------------------- /src/components/HoverInfo.jsx: -------------------------------------------------------------------------------- 1 | import { InfoCircledIcon } from "@radix-ui/react-icons"; 2 | 3 | import { useTranslation } from "react-i18next"; 4 | import { i18n as i18nInstance, locale } from "@/lib/i18n.js"; 5 | 6 | import { HoverCard, HoverCardContent, HoverCardTrigger } from "@/components/ui/hover-card"; 7 | import { Label } from "@/components/ui/label"; 8 | 9 | export default function HoverInfo({ header, content, type }) { 10 | const { t, i18n } = useTranslation(locale.get(), { i18n: i18nInstance }); 11 | return ( 12 | 13 | 14 | 15 | 16 | {!type ? ( 17 | 18 | ) : ( 19 | 20 | )} 21 | 22 | {!type ? ( 23 | 24 | 27 | 28 | ) : null} 29 | 30 | 31 | 32 |

33 |
34 | {t("PageHeader:about")}: 35 | {header} 36 |
37 |

38 |

{content}

39 |
40 |
41 | ); 42 | } 43 | -------------------------------------------------------------------------------- /src/components/ui/accordion.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as AccordionPrimitive from "@radix-ui/react-accordion" 3 | import { cn } from "@/lib/utils" 4 | import { ChevronDownIcon } from "@radix-ui/react-icons" 5 | 6 | const Accordion = AccordionPrimitive.Root 7 | 8 | const AccordionItem = React.forwardRef(({ className, ...props }, ref) => ( 9 | 10 | )) 11 | AccordionItem.displayName = "AccordionItem" 12 | 13 | const AccordionTrigger = React.forwardRef(({ className, children, ...props }, ref) => ( 14 | 15 | svg]:rotate-180", 19 | className 20 | )} 21 | {...props}> 22 | {children} 23 | 25 | 26 | 27 | )) 28 | AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName 29 | 30 | const AccordionContent = React.forwardRef(({ className, children, ...props }, ref) => ( 31 | 35 |
{children}
36 |
37 | )) 38 | AccordionContent.displayName = AccordionPrimitive.Content.displayName 39 | 40 | export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } 41 | -------------------------------------------------------------------------------- /src/components/ui/alert-dialog.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" 3 | 4 | import { cn } from "@/lib/utils" 5 | import { buttonVariants } from "@/components/ui/button" 6 | 7 | const AlertDialog = AlertDialogPrimitive.Root 8 | 9 | const AlertDialogTrigger = AlertDialogPrimitive.Trigger 10 | 11 | const AlertDialogPortal = AlertDialogPrimitive.Portal 12 | 13 | const AlertDialogOverlay = React.forwardRef(({ className, ...props }, ref) => ( 14 | 21 | )) 22 | AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName 23 | 24 | const AlertDialogContent = React.forwardRef(({ className, ...props }, ref) => ( 25 | 26 | 27 | 34 | 35 | )) 36 | AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName 37 | 38 | const AlertDialogHeader = ({ 39 | className, 40 | ...props 41 | }) => ( 42 |
45 | ) 46 | AlertDialogHeader.displayName = "AlertDialogHeader" 47 | 48 | const AlertDialogFooter = ({ 49 | className, 50 | ...props 51 | }) => ( 52 |
55 | ) 56 | AlertDialogFooter.displayName = "AlertDialogFooter" 57 | 58 | const AlertDialogTitle = React.forwardRef(({ className, ...props }, ref) => ( 59 | 60 | )) 61 | AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName 62 | 63 | const AlertDialogDescription = React.forwardRef(({ className, ...props }, ref) => ( 64 | 68 | )) 69 | AlertDialogDescription.displayName = 70 | AlertDialogPrimitive.Description.displayName 71 | 72 | const AlertDialogAction = React.forwardRef(({ className, ...props }, ref) => ( 73 | 74 | )) 75 | AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName 76 | 77 | const AlertDialogCancel = React.forwardRef(({ className, ...props }, ref) => ( 78 | 82 | )) 83 | AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName 84 | 85 | export { 86 | AlertDialog, 87 | AlertDialogPortal, 88 | AlertDialogOverlay, 89 | AlertDialogTrigger, 90 | AlertDialogContent, 91 | AlertDialogHeader, 92 | AlertDialogFooter, 93 | AlertDialogTitle, 94 | AlertDialogDescription, 95 | AlertDialogAction, 96 | AlertDialogCancel, 97 | } 98 | -------------------------------------------------------------------------------- /src/components/ui/alert.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { cva } from "class-variance-authority"; 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const alertVariants = cva( 7 | "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7", 8 | { 9 | variants: { 10 | variant: { 11 | default: "bg-background text-foreground", 12 | destructive: 13 | "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", 14 | }, 15 | }, 16 | defaultVariants: { 17 | variant: "default", 18 | }, 19 | } 20 | ) 21 | 22 | const Alert = React.forwardRef(({ className, variant, ...props }, ref) => ( 23 |
28 | )) 29 | Alert.displayName = "Alert" 30 | 31 | const AlertTitle = React.forwardRef(({ className, ...props }, ref) => ( 32 |
36 | )) 37 | AlertTitle.displayName = "AlertTitle" 38 | 39 | const AlertDescription = React.forwardRef(({ className, ...props }, ref) => ( 40 |
44 | )) 45 | AlertDescription.displayName = "AlertDescription" 46 | 47 | export { Alert, AlertTitle, AlertDescription } 48 | -------------------------------------------------------------------------------- /src/components/ui/aspect-ratio.jsx: -------------------------------------------------------------------------------- 1 | import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" 2 | 3 | const AspectRatio = AspectRatioPrimitive.Root 4 | 5 | export { AspectRatio } 6 | -------------------------------------------------------------------------------- /src/components/ui/avatar.jsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import * as AvatarPrimitive from "@radix-ui/react-avatar" 5 | 6 | import { cn } from "@/lib/utils" 7 | 8 | const Avatar = React.forwardRef(({ className, ...props }, ref) => ( 9 | 13 | )) 14 | Avatar.displayName = AvatarPrimitive.Root.displayName 15 | 16 | const AvatarImage = React.forwardRef(({ className, ...props }, ref) => ( 17 | 21 | )) 22 | AvatarImage.displayName = AvatarPrimitive.Image.displayName 23 | 24 | const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => ( 25 | 32 | )) 33 | AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName 34 | 35 | export { Avatar, AvatarImage, AvatarFallback } 36 | -------------------------------------------------------------------------------- /src/components/ui/badge.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { cva } from "class-variance-authority"; 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const badgeVariants = cva( 7 | "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", 8 | { 9 | variants: { 10 | variant: { 11 | default: 12 | "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80", 13 | secondary: 14 | "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", 15 | destructive: 16 | "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80", 17 | outline: "text-foreground", 18 | }, 19 | }, 20 | defaultVariants: { 21 | variant: "default", 22 | }, 23 | } 24 | ) 25 | 26 | function Badge({ 27 | className, 28 | variant, 29 | ...props 30 | }) { 31 | return (
); 32 | } 33 | 34 | export { Badge, badgeVariants } 35 | -------------------------------------------------------------------------------- /src/components/ui/breadcrumb.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { Slot } from "@radix-ui/react-slot" 3 | import { cn } from "@/lib/utils" 4 | import { ChevronRightIcon, DotsHorizontalIcon } from "@radix-ui/react-icons" 5 | 6 | const Breadcrumb = React.forwardRef( 7 | ({ ...props }, ref) =>