text
stringlengths
3
8.33k
repo
stringclasses
52 values
path
stringlengths
6
141
language
stringclasses
35 values
sha
stringlengths
64
64
chunk_index
int32
0
273
n_tokens
int32
1
896
"data leak", "audited", "admin", "verification", "unverified", "uncertified", "warning", "emergency", "attention", "urgent", "alarm", "crest", "bravery", "strength", "tough", "attacked", "damaged", "injured", "hi...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
93490741aef77499c1b119da3a439b3d6964916e210bca772fc40e2c763e7706
87
896
", "…" ], "categories": ["account", "security", "development", "gaming"] }, { "source": "shield-half.json", "name": "ShieldHalf", "title": "Shield Half", "tags": [ "cybersecurity", "secure", "safety", "protection", "guardian", "armored", "armou...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
132663db29f423686c406683862c9a07b403241fd2b8f80492b5ad6c64de2980
88
896
"tough", "invincible", "invincibility", "invulnerable", "undamaged", "extra", "added", "professional", "enterprise", "full", "maximum", "upgraded", "ultra", "activate", "enable", "audit", "admin", "verification", ...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
a1b8ee1f59f1c279dcf9f904560bbae1f08925dc652342d6a935eacfedbf9138
89
896
", "army", "cadet", "scout" ], "categories": ["account", "security", "development", "gaming", "shapes"] }, { "source": "ship-wheel.json", "name": "ShipWheel", "title": "Ship Wheel", "tags": [ "steering", "rudder", "boat", "knots", "nautical mil...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
c278cd113c383c666b33e7facb0ecfb05c1688de4772a002ca05a2667b55f146
90
896
music", "random", "reorder"], "categories": ["multimedia", "arrows"] }, { "source": "sigma-square.json", "name": "SigmaSquare", "title": "Sigma Square", "tags": [ "sum", "calculate", "formula", "maths", "enumeration", "enumerate" ], "categories": ["tex...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
06f6d916a5a46588aefc3f5b69f74721d5e15ce7b2ba3c5ea0b0466cdf2681a3
91
896
"bone"], "categories": ["gaming"] }, { "source": "slack.json", "name": "Slack", "title": "Slack", "tags": ["logo"], "categories": [ "account", "social", "communication", "brands", "development" ] }, { "source": "slash.json", "name": "Slash", ...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
3f240a7e024aa28948664cf7407fdd6b33bcf3bc1510ca587594b6029ed99bc7
92
896
"name": "Sofa", "title": "Sofa", "tags": ["armchair", "furniture", "leisure", "lounge", "loveseat", "couch"], "categories": ["furniture"] }, { "source": "soup.json", "name": "Soup", "title": "Soup", "tags": ["food", "dish", "restaurant", "course", "meal", "bowl", "starter"], "categor...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
73bd95ce0a510477711b6bd3fcf7a8a86ddbc508a1812efbe7fefd3e5b66f88b
93
896
] }, { "source": "split-square-vertical.json", "name": "SplitSquareVertical", "title": "Split Square Vertical", "tags": ["split", "divide"], "categories": ["layout"] }, { "source": "split.json", "name": "Split", "title": "Split", "tags": ["break", "disband", "divide", "separa...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
4c6870bd9d70021913f3ee39a2810149bb47b526dfe1411cf11dc9a03251c828
94
896
["shapes", "development", "maths"] }, { "source": "square-stack.json", "name": "SquareStack", "title": "Square Stack", "tags": [ "versions", "clone", "copy", "duplicate", "multiple", "revisions", "version control", "backup", "history" ], ...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
71427238675ba012eb08ca837edbf13810b0eecf621934725159948eb4bb0394
95
896
source": "sticky-note.json", "name": "StickyNote", "title": "Sticky Note", "tags": ["note", "comment", "reaction", "memo"], "categories": ["communication", "social"] }, { "source": "stop-circle.json", "name": "StopCircle", "title": "Stop Circle", "tags": ["media", "music"], "cate...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
8d3ed592509935fd372eb7ea4dcebbf6fc8750eb96bb1b93d873e8c0cbb6e612
96
896
seasons"] }, { "source": "sunrise.json", "name": "Sunrise", "title": "Sunrise", "tags": ["weather", "time", "morning", "day"], "categories": ["arrows", "weather", "time"] }, { "source": "sunset.json", "name": "Sunset", "title": "Sunset", "tags": ["weather", "time", "evening",...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
2ebdd47e1546a6d437c159f9f0c8de8e2305b80decbf503f7f9c04f52f252391
97
896
"Tablet", "tags": ["device"], "categories": ["devices"] }, { "source": "tablets.json", "name": "Tablets", "title": "Tablets", "tags": [ "medicine", "medication", "drug", "prescription", "pills", "pharmacy" ], "categories": ["medical"] }, { ...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
0a36ca78a8ae53b731ea14f922302322ae2371d001e0384a6ee21643f06669f9
98
896
: ["nature"] }, { "source": "terminal-square.json", "name": "TerminalSquare", "title": "Terminal Square", "tags": ["code", "command line", "prompt", "shell"], "categories": ["development", "shapes"] }, { "source": "terminal.json", "name": "Terminal", "title": "Terminal", "tag...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
2c109903cb6b98dcb938c53dd1da23abbfa93d1a38d6173ce8c79775f3913aa3
99
896
temperature", "celsius", "fahrenheit", "weather", "cold", "freeze", "freezing" ], "categories": ["weather"] }, { "source": "thermometer-sun.json", "name": "ThermometerSun", "title": "Thermometer Sun", "tags": ["temperature", "celsius", "fahrenheit", "weath...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
b7ec5f9c5ff9ffa076326b2999fa56968a8ceb00febae9294687a8b53669d3b7
100
896
cursor"], "categories": ["devices"] }, { "source": "tower-control.json", "name": "TowerControl", "title": "Tower Control", "tags": ["airport", "travel", "tower", "transportation", "lighthouse"], "categories": ["travel", "transportation"] }, { "source": "toy-brick.json", "name": "...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
ea2d422b0075dec6cd9227145fe4bbdb132cf23844178904a2453616ca7a4d6e
101
896
tags": ["tree", "pine", "forest", "park", "nature"], "categories": ["nature"] }, { "source": "trees.json", "name": "Trees", "title": "Trees", "tags": ["tree", "forest", "park", "nature"], "categories": ["nature"] }, { "source": "trello.json", "name": "Trello", "title": "Trell...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
62804190cfc9b4215d8ce55304862105f53eaad182a78a6163a46d6ffe8b6d50
102
896
"entertainment", "showtime", "channels", "terrestrial", "satellite", "cable", "broadcast", "live", "frequency", "tune", "scan", "aerial", "receiver", "transmission", "signal", "connection", "connectivity" ], "categor...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
726fc1c60a2fa665271908453cc0e263329fd9205583dc4bc227703c6e4421ed
103
896
"tags": ["url", "unchain"], "categories": ["text"] }, { "source": "unlink.json", "name": "Unlink", "title": "Unlink", "tags": ["url", "unchain"], "categories": ["text"] }, { "source": "unlock.json", "name": "Unlock", "title": "Unlock", "tags": ["security"], "categorie...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
bc355031d601a907874327afdd659dd5c9af5cf5d4c8d2f010cf5cfdc28b89ce
104
896
"], "categories": ["account"] }, { "source": "user-minus-2.json", "name": "UserMinus2", "title": "User Minus 2", "tags": ["delete", "remove", "unfollow", "unsubscribe"], "categories": ["account"] }, { "source": "user-minus.json", "name": "UserMinus", "title": "User Minus", ...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
afd995f39c28b453c8f42fb8374a995e6cb17a1d9eaaa9939b9e4f1990ed64fb
105
896
", "meal", "cutlery", "breakfast", "dinner", "supper" ], "categories": ["food-beverage", "travel", "maps"] }, { "source": "utility-pole.json", "name": "UtilityPole", "title": "Utility Pole", "tags": [ "electricity", "energy", "transmission line...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
c400b21d1d65a5ded8ab6a662205ac7b9b386a4720d923a0004617d1716b6194
106
896
, "name": "Voicemail", "title": "Voicemail", "tags": ["phone", "cassette", "tape", "reel", "recording", "audio"], "categories": ["connectivity", "devices", "social"] }, { "source": "volume-1.json", "name": "Volume1", "title": "Volume 1", "tags": ["music", "sound", "speaker"], "ca...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
804cbb5452adbc6fcb4c902d5b9e56e0a736f58b6da4dff4f470aa4014c9d2eb
107
896
"Warehouse", "tags": ["storage", "logistics", "building"], "categories": ["buildings", "maps"] }, { "source": "watch.json", "name": "Watch", "title": "Watch", "tags": ["clock", "time"], "categories": ["time"] }, { "source": "waves.json", "name": "Waves", "title": "Waves",...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
aede2d86b49409d7f9f51104fd01a5711756daf82249b4dac6fe83ec7f3247dc
108
896
"food-beverage"] }, { "source": "workflow.json", "name": "Workflow", "title": "Workflow", "tags": [ "action", "continuous integration", "ci", "automation", "devops", "network", "node", "connection" ], "categories": ["development"] }, { ...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
9ae02f96694fa272590a23352c89ac259807d17c0b1de7b249a7737d99be75b4
109
896
", "tags": ["magnifying glass", "plus"], "categories": ["accessibility", "layout", "design", "text", "photography"] }, { "source": "zoom-out.json", "name": "ZoomOut", "title": "Zoom Out", "tags": ["magnifying glass", "plus"], "categories": ["accessibility", "layout", "design", "text", "p...
synth-ui
public/assets/content/external/icons/lucide/dump.json
JSON
2f5d3680f05f63c4139525143628ae0fee2daa77188a2940a7d4b611cd66dbca
110
116
@tailwind base; @tailwind components; @tailwind utilities; @layer base { :root { --background: 0 0% 100%; --muted: 0 0% 98%; --background-subtle: 0 0% 98%; --foreground: 240 10% 15%; --muted-foreground: 240 3.8% 46.1%; --card: 0 0% 100%; --card-foreground: 240 10% 3.9%; --popover: 0 0...
synth-ui
styles/globals.css
CSS
f314c21e166edf15e011df6ae7e3f7bd787a4dd930f5cc9da49b1b3623061d1c
0
813
# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these file...
synth-ui-training
.gitignore
Git Ignore
5e2c671ddc9e301dafc241ad1a7c07aa85a91fef560a17721b41977b9eddba17
0
711
# SynthUI Dataset & Training ## This repo contains all business logic for the following pipelines - Scraping raw code from GitHub - Filtering out irrelevant code - Preperation for HuggingFace Dataset (Tokenization, Dedupe, etc.) - Generation of QA pairs - Pushing to HuggingFace Dataset ## Dataset Generation ### Res...
synth-ui-training
README.md
Markdown
d77475daa61649f26e97eabd50f2989bb8cfc72f0fb9bad93237c51b47c19dd2
0
896
the potential of fine-tuning instruction models with synthetic data. For the scope of this project the synthetic data was scraped from GitHub. However, the approach can be easily replicated with other data sources. The resulting model was used for code generation in the [WebApp of Synth UI](https://www.synthui.design/...
synth-ui-training
README.md
Markdown
85c5a7c4bf23999269f149f41e026165421598f39a6ee4231fa59367ab85d4ec
1
68
git+https://github.com/huggingface/transformers git+https://github.com/huggingface/accelerate git+https://github.com/huggingface/peft trl huggingface-hub bitsandbytes evaluate datasets einops wandb tiktoken deepspeed tqdm safetensors
synth-ui-training
requirements.txt
Text
9c55a3b081cd4d5eb6e30248a45e431edbf4e1a80c6f423bfaa2df4ca6f75369
0
52
git+https://github.com/huggingface/transformers git+https://github.com/huggingface/accelerate git+https://github.com/huggingface/peft git+https://github.com/huggingface/trl huggingface-hub bitsandbytes evaluate datasets einops wandb tiktoken
synth-ui-training
requirements_colab.txt
Text
843e314526635f8c9cdd5d8e7a89e347fcdafa0a65363b7f629377470ff04884
0
61
buckets filtered_data logs remove_ids signatures synth_ui_data synth_source_repos pipeline_output qa_pairs.json
synth-ui-training
dataset_creation/.gitignore
Git Ignore
22a31afbd7545cc24c1c67ae2ba1e62815142dc33ebaa4c057d589346edffcf4
0
11
# coding=utf-8 import os import subprocess from multiprocessing import Pool from github import Github ICON_REPOS = [ "lucide-icons/lucide" # ISC ] UI_REPOS = [ "shadcn-ui/ui", # MIT "DarkInventor/easy-ui" # MIT ...
synth-ui-training
dataset_creation/clone_repos.py
Python
78450f8cb251b9eec542dd859063525a59a558cb285a9405a84689ec30045f1a
0
385
# coding=utf-8 # Copyright 2024 Sourab Mangrulkar. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
synth-ui-training
dataset_creation/filter.py
Python
0b67a2fb9bdd9e783af39c86763ef4d157214651d27946e01c7fee7997314e64
0
452
# coding=utf-8 # NOTE: The logger will throw encoding errors. This does not affect the pipeline execution. from datatrove.executor.base import PipelineExecutor from datatrove.executor.local import LocalPipelineExecutor from datatrove.pipeline.dedup import MinhashDedupSignature from datatrove.pipeline.dedup.minhash im...
synth-ui-training
dataset_creation/pipeline.py
Python
2c379a2d19746397e77b1077725763983cc2b58d50205aeda44f78bb1c47bf03
0
644
# coding=utf-8 # Copyright 2024 Sourab Mangrulkar. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
synth-ui-training
dataset_creation/prepare_hf_dataset.py
Python
f320e78ce558262af850c4765ca5ab11dfe5f933c46801b5bbdc6bb820178df4
0
367
import pandas as pd from prepare_hf_dataset import push_hf_dataset df = pd.read_csv("train_format/reformatted_dataset.csv") push_hf_dataset(df, "JulianAT/SynthUI-Code-Chat-Assistant-v1")
synth-ui-training
dataset_creation/push_formatted_dataset.py
Python
1d08f721a02072178a761b99c493477f43b7fa7cba7efd239c9bd2616755f390
0
40
import pandas as pd from prepare_hf_dataset import push_hf_dataset df = pd.read_json("qa_pairs.json") push_hf_dataset(df, "JulianAT/SynthUI-Code-Instruct-2k-v1")
synth-ui-training
dataset_creation/push_qa_pairs.py
Python
8855e5c1d46dfe4cfb74502af4a656d1168c00b9edcfee454f86a5a1073eec9b
0
39
import re import unicodedata from typing import Callable from datatrove.pipeline.readers.base import BaseDiskReader from datatrove.io import DataFolderLike # Block the following formats. IMAGE = ["png", "jpg", "jpeg", "gif"] VIDEO = ["mp4", "jfif"] DOC = ["key", "PDF", "pdf", "docx", "xlsx", "pptx", "csv", "tsv", "tx...
synth-ui-training
dataset_creation/reader.py
Python
04a959170fe7e38307db17543ead0dce63eb87a17bdbaff39bff7e8999e6f43d
0
771
--- dataset_info: features: - name: text dtype: string - name: id dtype: string - name: metadata struct: - name: file_path dtype: string - name: repo_id dtype: string - name: token_count dtype: int64 - name: __index_level_0__ ...
synth-ui-training
dataset_creation/README.md
Markdown
15cf61344406a66db8a6512160f180636b30074fe9967227dcf41b21983620d8
0
619
from datasets import load_dataset import pandas as pd ds = load_dataset("JulianAT/SynthUI-Code-Instruct-2k-v1", split="train") def reformat(row): instruction = row["instruction"] output = row["output"] formatted_row = (f"<|system|> You are a helpful, respectful and honest assistant. " ...
synth-ui-training
dataset_creation/train_format/format.py
Python
b20ea9d3f3112ffe033ebb9d2439b37f0f7dafa95d6b2de61a44ce1e56c8d8ba
0
289
# coding=utf-8 # Copyright 2024 Sourab Mangrulkar. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
synth-ui-training
training/fim.py
Python
a02b1ebf36e035f15b90209283decb43b7ef1383282f559bc93631ea044669b2
0
896
2 from FIM paper) new_sample = np.concatenate( [ prefix_special_tokens, suffix, [middle_tok_id], prefix, middle, ] ) else: prefix_special_tokens...
synth-ui-training
training/fim.py
Python
7e48fcc3f6569443a55f3fd72af9a6d1b9685487e250a1ca135c1e902265f36c
1
84
CUDA_VISIBLE_DEVICES=0 WANDB_PROJECT=synthui-code-completions python train.py \ --model_name_or_path "bigcode/starcoder" \ --dataset_name "JulianAT/SynthUI-Code-2k-v1" \ --splits "train" \ --max_seq_len 2048 \ --max_steps 2000 \ --save_steps 500 \ --eval_steps 100 \ --logging_steps 5 \ --log_level "info" \ --logging_st...
synth-ui-training
training/run_peft.sh
Shell
e1f956a5d540a21f216dcd5c9b8f2d417ec41c8dc10109b799ee4d733f1bba51
0
263
# coding=utf-8 # Copyright 2024 Sourab Mangrulkar. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
synth-ui-training
training/train.py
Python
367ca783f5acff1d5c4977e1a6a9fcba0e41ec1075b5a0ac8803f0c8c35b82bc
0
896
= field(default=4096) test_size: Optional[float] = field(default=0.1) fim_rate: Optional[float] = field(default=0.5) fim_spm_rate: Optional[float] = field(default=0.5) splits: Optional[str] = field( default="train", metadata={"help": "Comma separate list of the splits to use from the dat...
synth-ui-training
training/train.py
Python
6afbbe447e6b7937e97765a56ce4c55bf68d87ef8aef6c038399915553faa851
1
896
tokenizer, args, seed): dataset = load_dataset(args.dataset_name, split=args.splits) dataset = dataset.train_test_split( test_size=args.test_size, seed=seed, shuffle=True ) train_data = dataset["train"] valid_data = dataset["test"] print( f"Size of the train set: {len(train_data)...
synth-ui-training
training/train.py
Python
ccb690345039b7b69d281e1a6a97438c316b9b6b9f465c71a077c753ab1f9a45
2
896
.max_seq_length, dtype=None, load_in_4bit=load_in_4bit, ) else: model = AutoModelForCausalLM.from_pretrained( args.model_name_or_path, load_in_8bit=load_in_8bit, quantization_config=bnb_config, device_map=device_map, ...
synth-ui-training
training/train.py
Python
21f28ba830e8bb11c5a77f1e65f50c9a872ac35acdc93e76140eb0d4b6a8e485
3
649
{ "extends": [ "next/core-web-vitals", "plugin:import/recommended", "plugin:import/typescript", "prettier", "plugin:tailwindcss/recommended" ], "plugins": ["tailwindcss"], "rules": { "tailwindcss/no-custom-classname": "off", "tailwindcss/classnames-order": "off" }, "settings": { ...
tdot_chatbot
.eslintrc.json
JSON
044d6d2e0b60471093b226c25abfec91251d387b0406fe9a66decdb486d2f037
0
131
", "quoteProperties": "asNeeded", "trailingCommas": "all", "semicolons": "always", "arrowParentheses": "always", "bracketSpacing": true, "bracketSameLine": false, "quoteStyle": "single", "attributePosition": "auto" } }, "json": { "formatter": { "enabled"...
tdot_chatbot
biome.jsonc
JSON
39b59b176d432fadae06fe32c7802a0c60bcce21503d80a3c00b62c1e8345739
1
225
import { config } from 'dotenv'; import { defineConfig } from 'drizzle-kit'; config({ path: '.env.local', }); export default defineConfig({ schema: './lib/db/schema.ts', out: './lib/db/migrations', dialect: 'postgresql', dbCredentials: { // biome-ignore lint: Forbidden non-null assertion. url: proce...
tdot_chatbot
drizzle.config.ts
TypeScript
78532c9f930ec271a22fe73d3471a750a711df878099fc62abee6d6969a6b48a
0
102
import NextAuth from 'next-auth'; import { authConfig } from '@/app/(auth)/auth.config'; export default NextAuth(authConfig).auth; export const config = { matcher: ['/', '/:id', '/api/:path*', '/login', '/register'], };
tdot_chatbot
middleware.ts
TypeScript
f26b90b8031dfb2b4ca83111691a9895986d4775090a5fb45418d856c3ea4fab
0
77
import type { NextConfig } from 'next'; const nextConfig: NextConfig = { experimental: { ppr: true, }, images: { remotePatterns: [ { hostname: 'avatar.vercel.sh', }, ], }, }; export default nextConfig;
tdot_chatbot
next.config.ts
TypeScript
a3deda32b96e24d0320ad860771e901fa872d0891eb4831ea261436dc38bda2b
0
54
{ "name": "ai-chatbot", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev --turbo", "build": "tsx lib/db/migrate && next build", "start": "next start", "lint": "next lint && biome lint --write --unsafe", "lint:fix": "next lint --fix && biome lint --write --unsafe", "form...
tdot_chatbot
package.json
JSON
6aeea627bb7d488bb62c1c61dc3a3133de2f072f44a2bcb4082d3617b8cff838
0
896
: "^1.13.1", "prosemirror-model": "^1.23.0", "prosemirror-schema-basic": "^1.2.3", "prosemirror-schema-list": "^1.4.1", "prosemirror-state": "^1.4.3", "prosemirror-view": "^1.34.3", "react": "19.0.0-rc-45804af1-20241021", "react-dom": "19.0.0-rc-45804af1-20241021", "react-markdown": "^9....
tdot_chatbot
package.json
JSON
bbf60e83ed625d54d443cd997e9aba730ae9a74da6fb71eb56c3079c3dfa5bff
1
472
<a href="https://chat.vercel.ai/"> <img alt="Next.js 14 and App Router-ready AI chatbot." src="app/(chat)/opengraph-image.png"> <h1 align="center">Next.js AI Chatbot</h1> </a> <p align="center"> An Open-Source AI Chatbot Template Built With Next.js and the AI SDK by Vercel. </p> <p align="center"> <a href="#f...
tdot_chatbot
README.md
Markdown
08b3ad5558e5cc724b860b5aab373575d8e391f7e0816c5023ee31092b51bfde
0
896
%22type%22:%22blob%22}]) ## Running locally You will need to use the environment variables [defined in `.env.example`](.env.example) to run Next.js AI Chatbot. It's recommended you use [Vercel Environment Variables](https://vercel.com/docs/projects/environment-variables) for this, but a `.env` file is all that is nec...
tdot_chatbot
README.md
Markdown
ec03a60dd06eb2408d7e7209f6195984b87133ed8d49b2f0251ee5501665cdd3
1
211
import type { Config } from 'tailwindcss'; const config: Config = { darkMode: ['class'], content: [ './pages/**/*.{js,ts,jsx,tsx,mdx}', './components/**/*.{js,ts,jsx,tsx,mdx}', './app/**/*.{js,ts,jsx,tsx,mdx}', ], theme: { fontFamily: { sans: ['geist'], mono: ['geist-mono'], }, ...
tdot_chatbot
tailwind.config.ts
TypeScript
4f220883fb31bfff6b37b06e239a177ecd054959c051dd452e338412d7dc060f
0
770
@tailwind base; @tailwind components; @tailwind utilities; :root { --foreground-rgb: 0, 0, 0; --background-start-rgb: 214, 219, 220; --background-end-rgb: 255, 255, 255; } @media (prefers-color-scheme: dark) { :root { --foreground-rgb: 255, 255, 255; --background-start-rgb: 0, 0, 0; ...
tdot_chatbot
app/globals.css
CSS
6e16f1aff9150ae915c40342106e1b0c8f0b2b617c492b129fc7c6102d6d3d43
0
896
240 3.7% 15.9%; --sidebar-accent-foreground: 240 4.8% 95.9%; --sidebar-border: 240 3.7% 15.9%; --sidebar-ring: 217.2 91.2% 59.8%; } } @layer base { * { @apply border-border; } body { @apply bg-background text-foreground; } @font-face { font-fami...
tdot_chatbot
app/globals.css
CSS
1d4d69b83796a58243d6ffb175201de3e4ff2a21c74d0303ff1dbc6d01c1397d
1
476
import type { Metadata } from 'next'; import { Toaster } from 'sonner'; import { ThemeProvider } from '@/components/theme-provider'; import './globals.css'; export const metadata: Metadata = { metadataBase: new URL('https://chat.vercel.ai'), title: 'Next.js Chatbot Template', description: 'Next.js chatbot temp...
tdot_chatbot
app/layout.tsx
TypeScript
93094965bb9f7a3f75435d22a5a234edee85e3e7883ecc3a8680b586c1d38748
0
487
import type { NextAuthConfig } from 'next-auth'; export const authConfig = { pages: { signIn: '/login', newUser: '/', }, providers: [ // added later in auth.ts since it requires bcrypt which is only compatible with Node.js // while this file is also used in non-Node.js environments ], callbac...
tdot_chatbot
app/(auth)/auth.config.ts
TypeScript
11a3a67a04cec3ee06ef134fe1a59d5b763d7d09694e8fbc9f298cd19bce1df2
0
262
import { compare } from 'bcrypt-ts'; import NextAuth, { type User, type Session } from 'next-auth'; import Credentials from 'next-auth/providers/credentials'; import { getUser } from '@/lib/db/queries'; import { authConfig } from './auth.config'; interface ExtendedSession extends Session { user: User; } export co...
tdot_chatbot
app/(auth)/auth.ts
TypeScript
6a1d67c35026cd181a76fa9dd7815cb1a5bb03eb01a70d87f5331518e00aa86e
0
288
'use client'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import { useActionState, useEffect, useState } from 'react'; import { toast } from 'sonner'; import { AuthForm } from '@/components/auth-form'; import { SubmitButton } from '@/components/submit-button'; import { login, type Logi...
tdot_chatbot
app/(auth)/login/page.tsx
TypeScript
cbc1277a5bb3c7913a07da018532d8df381d93764b7ec001d35159cdb0cbeb7c
0
578
'use client'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import { useActionState, useEffect, useState } from 'react'; import { toast } from 'sonner'; import { AuthForm } from '@/components/auth-form'; import { SubmitButton } from '@/components/submit-button'; import { register, type R...
tdot_chatbot
app/(auth)/register/page.tsx
TypeScript
a726f309ce72d14644c419ff388c1a1808d4a19aa81f4ef17038845a8e70733e
0
611
'use server'; import { type CoreUserMessage, generateText } from 'ai'; import { cookies } from 'next/headers'; import { customModel } from '@/lib/ai'; import { deleteMessagesByChatIdAfterTimestamp, getMessageById, updateChatVisiblityById, } from '@/lib/db/queries'; import { VisibilityType } from '@/components/v...
tdot_chatbot
app/(chat)/actions.ts
TypeScript
a544f3bb79f943d95a0df2c86ee3147fdd4d757f5f01a2764ec02ed17646abb4
0
306
import { cookies } from 'next/headers'; import { AppSidebar } from '@/components/app-sidebar'; import { SidebarInset, SidebarProvider } from '@/components/ui/sidebar'; import { auth } from '../(auth)/auth'; import Script from 'next/script'; export const experimental_ppr = true; export default async function Layout(...
tdot_chatbot
app/(chat)/layout.tsx
TypeScript
7e46d2209af77771bdc29564992ee3e42d5adc33446d476f322891b3de3e5b83
0
220
import { cookies } from 'next/headers'; import { Chat } from '@/components/chat'; import { DEFAULT_MODEL_NAME, models } from '@/lib/ai/models'; import { generateUUID } from '@/lib/utils'; import { DataStreamHandler } from '@/components/data-stream-handler'; export default async function Page() { const id = generate...
tdot_chatbot
app/(chat)/page.tsx
TypeScript
ad0d616b608a6570b0cdb5195864cedbae4dc70a01f671058becdb80da580443
0
192
import { type Message, convertToCoreMessages, createDataStreamResponse, smoothStream, streamText, } from 'ai'; import { auth } from '@/app/(auth)/auth'; import { customModel } from '@/lib/ai'; import { models } from '@/lib/ai/models'; import { systemPrompt } from '@/lib/ai/prompts'; import { deleteChatById...
tdot_chatbot
app/(chat)/api/chat/route.ts
TypeScript
5147fd33d1ea5f5d624fd4cb89124578ef6a9d735f7ceca9cbef4d8489e62a6e
0
896
-text', }, }); result.mergeIntoDataStream(dataStream); }, }); } export async function DELETE(request: Request) { const { searchParams } = new URL(request.url); const id = searchParams.get('id'); if (!id) { return new Response('Not Found', { status: 404 }); } const session = a...
tdot_chatbot
app/(chat)/api/chat/route.ts
TypeScript
9079fd42b36150ed0831e64cb34a7ebf594813408e271af6e49e60f2685e3851
1
214
import { auth } from '@/app/(auth)/auth'; import { BlockKind } from '@/components/block'; import { deleteDocumentsByIdAfterTimestamp, getDocumentsById, saveDocument, } from '@/lib/db/queries'; export async function GET(request: Request) { const { searchParams } = new URL(request.url); const id = searchParams...
tdot_chatbot
app/(chat)/api/document/route.ts
TypeScript
52b0d41668458e6327fa1548f4a8e391b776b3d519ae6c7aff68661febdd15ce
0
611
import { auth } from '@/app/(auth)/auth'; import { getChatsByUserId } from '@/lib/db/queries'; export async function GET() { const session = await auth(); if (!session || !session.user) { return Response.json('Unauthorized!', { status: 401 }); } // biome-ignore lint: Forbidden non-null assertion. const...
tdot_chatbot
app/(chat)/api/history/route.ts
TypeScript
18cba09a699bcba1be580fd0ddd926289e12d60182a5e781c89f040593b34bd7
0
117
import { auth } from '@/app/(auth)/auth'; import { getSuggestionsByDocumentId } from '@/lib/db/queries'; export async function GET(request: Request) { const { searchParams } = new URL(request.url); const documentId = searchParams.get('documentId'); if (!documentId) { return new Response('Not Found', { statu...
tdot_chatbot
app/(chat)/api/suggestions/route.ts
TypeScript
aa6ba1c3d8850eb6f9f42679de0c48baa514fe2b967eff10ad2e01f42138fe6e
0
213
import { auth } from '@/app/(auth)/auth'; import { getVotesByChatId, voteMessage } from '@/lib/db/queries'; export async function GET(request: Request) { const { searchParams } = new URL(request.url); const chatId = searchParams.get('chatId'); if (!chatId) { return new Response('chatId is required', { statu...
tdot_chatbot
app/(chat)/api/vote/route.ts
TypeScript
c569d734b47449a6bf758aefce79737ca5562ed9a397321e1d7f008e56de0a0d
0
322
import { cookies } from 'next/headers'; import { notFound } from 'next/navigation'; import { auth } from '@/app/(auth)/auth'; import { Chat } from '@/components/chat'; import { DEFAULT_MODEL_NAME, models } from '@/lib/ai/models'; import { getChatById, getMessagesByChatId } from '@/lib/db/queries'; import { convertToUI...
tdot_chatbot
app/(chat)/chat/[id]/page.tsx
TypeScript
ebd5d23eade531918f6190432f2c2c3deee501be5c1f2e7ed6fbe46b66eff86c
0
367
'use client'; import type { User } from 'next-auth'; import { useRouter } from 'next/navigation'; import { PlusIcon } from '@/components/icons'; import { SidebarHistory } from '@/components/sidebar-history'; import { SidebarUserNav } from '@/components/sidebar-user-nav'; import { Button } from '@/components/ui/button...
tdot_chatbot
components/app-sidebar.tsx
TypeScript
be2b7e1d922315c623af67a030c86545b2bc10b7966028bb8538f27fce26d74f
0
439
import { cn } from '@/lib/utils'; import { ClockRewind, CopyIcon, RedoIcon, UndoIcon } from './icons'; import { Button } from './ui/button'; import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'; import { toast } from 'sonner'; import { ConsoleOutput, UIBlock } from './block'; import { Dispatch, memo, ...
tdot_chatbot
components/block-actions.tsx
TypeScript
999fe99940f66a10ff66b017360754c2be2e53239ebb7bd24a0f09391777acd0
0
844
import { memo } from 'react'; import { CrossIcon } from './icons'; import { Button } from './ui/button'; import { initialBlockData, useBlock } from '@/hooks/use-block'; function PureBlockCloseButton() { const { setBlock } = useBlock(); return ( <Button variant="outline" className="h-fit p-2 dark:h...
tdot_chatbot
components/block-close-button.tsx
TypeScript
804510d313aaa69275719e6881cda4c7ada357d0d960932f41e46d61ac93377e
0
178
import { PreviewMessage } from './message'; import { useScrollToBottom } from './use-scroll-to-bottom'; import { Vote } from '@/lib/db/schema'; import { ChatRequestOptions, Message } from 'ai'; import { memo } from 'react'; import equal from 'fast-deep-equal'; import { UIBlock } from './block'; interface BlockMessages...
tdot_chatbot
components/block-messages.tsx
TypeScript
d6ba2401f70a7d804742fec83dbede11bbd8fc1556653b393f4c1e508272b991
0
503
import type { Attachment, ChatRequestOptions, CreateMessage, Message, } from 'ai'; import { formatDistance } from 'date-fns'; import { AnimatePresence, motion } from 'framer-motion'; import { type Dispatch, memo, type SetStateAction, useCallback, useEffect, useState, } from 'react'; import useSWR, {...
tdot_chatbot
components/block.tsx
TypeScript
26cc0188c8e1b62ecdd7006047c12269baf98769de7e50ac5398bc979185fb8f
0
896
Array<ConsoleOutput>>( [], ); const { open: isSidebarOpen } = useSidebar(); useEffect(() => { if (documents && documents.length > 0) { const mostRecentDocument = documents.at(-1); if (mostRecentDocument) { setDocument(mostRecentDocument); setCurrentVersionIndex(documents.len...
tdot_chatbot
components/block.tsx
TypeScript
625487463bddd0f25a5f705862399c24be4e7dd48800437249b99c961a224826
1
896
} > {!isMobile && ( <motion.div className="fixed bg-background h-dvh" initial={{ width: isSidebarOpen ? windowWidth - 256 : windowWidth, right: 0, }} animate={{ width: windowWidth, right: 0 }} ...
tdot_chatbot
components/block.tsx
TypeScript
7286c5ada31af452a698b82ae26f05225da3cde311f5c5465675ece3a20dae8f
2
896
-medium">{block.title}</div> {isContentDirty ? ( <div className="text-sm text-muted-foreground"> Saving changes... </div> ) : document ? ( <div className="text-sm text-muted-foreground"> ...
tdot_chatbot
components/block.tsx
TypeScript
2796ac22c4e464f02ae2887fb5784209f3f21f212f64f8ef8e5a2ae7a3129bd9
3
834
'use client'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import { useWindowSize } from 'usehooks-ts'; import { ModelSelector } from '@/components/model-selector'; import { SidebarToggle } from '@/components/sidebar-toggle'; import { Button } from '@/components/ui/button'; import { Plus...
tdot_chatbot
components/chat-header.tsx
TypeScript
5b1d79ac034f05a78ec4e464167abab01b25c1cc45cf5065fa6b417b79e236e7
0
824
'use client'; import type { Attachment, Message } from 'ai'; import { useChat } from 'ai/react'; import { useState } from 'react'; import useSWR, { useSWRConfig } from 'swr'; import { ChatHeader } from '@/components/chat-header'; import type { Vote } from '@/lib/db/schema'; import { fetcher } from '@/lib/utils'; imp...
tdot_chatbot
components/chat.tsx
TypeScript
a81731fc4c7ef83df3c351e4c72809efbfb21924f669ed1d6966f05bcd5d824c
0
628
'use client'; import { useCallback, useState } from 'react'; import { CodeIcon, LoaderIcon, PlayIcon, PythonIcon } from './icons'; import { Button } from './ui/button'; import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'; import { cn } from '@/lib/utils'; interface CodeBlockProps { node: any; i...
tdot_chatbot
components/code-block.tsx
TypeScript
11279073c5ad9cef5e57c95be05db04f669f5186ab28883d932a612f4dd9de62
0
513
'use client'; import { EditorView } from '@codemirror/view'; import { EditorState, Transaction } from '@codemirror/state'; import { python } from '@codemirror/lang-python'; import { oneDark } from '@codemirror/theme-one-dark'; import { basicSetup } from 'codemirror'; import React, { memo, useEffect, useRef } from 'rea...
tdot_chatbot
components/code-editor.tsx
TypeScript
221544067fcbd71b58901b36a0654afdc3810712c791ab633423a529dffa1d41
0
740
import { TerminalWindowIcon, LoaderIcon, CrossSmallIcon } from './icons'; import { Button } from './ui/button'; import { Dispatch, SetStateAction, useCallback, useEffect, useRef, useState, } from 'react'; import { ConsoleOutput } from './block'; import { cn } from '@/lib/utils'; import { useBlockSelector } ...
tdot_chatbot
components/console.tsx
TypeScript
d43f1df6ec40f6eaae05373845bad5e32197feb58d083e2f80e55e5638e28f28
0
896
'text-muted-foreground': [ 'in_progress', 'loading_packages', ].includes(consoleOutput.status), 'text-emerald-500': consoleOutput.status === 'completed', 'text-red-400': consoleOutput.status === 'failed', })} ...
tdot_chatbot
components/console.tsx
TypeScript
d3407ca645c04ab3a6867f9021ae8594377e8f989d20b9522e39a74c6bc860f4
1
429
'use client'; import { useChat } from 'ai/react'; import { useEffect, useRef, useState } from 'react'; import { BlockKind } from './block'; import { Suggestion } from '@/lib/db/schema'; import { initialBlockData, useBlock } from '@/hooks/use-block'; import { useUserMessageId } from '@/hooks/use-user-message-id'; impor...
tdot_chatbot
components/data-stream-handler.tsx
TypeScript
2e558d7fd37485289ada4c8781910691abd19a431031d363017f364a7df21657
0
807
import OrderedMap from 'orderedmap'; import { Schema, type Node as ProsemirrorNode, type MarkSpec, DOMParser, } from 'prosemirror-model'; import { schema } from 'prosemirror-schema-basic'; import { addListNodes } from 'prosemirror-schema-list'; import { EditorState } from 'prosemirror-state'; import { EditorVie...
tdot_chatbot
components/diffview.tsx
TypeScript
b60d13fca0f97ff01a2f5397280929ac96fc6302708a6fc9bc68e57d5318379b
0
649
'use client'; import { memo, MouseEvent, useCallback, useEffect, useMemo, useRef, } from 'react'; import { BlockKind, UIBlock } from './block'; import { FileIcon, FullscreenIcon, ImageIcon, LoaderIcon } from './icons'; import { cn, fetcher } from '@/lib/utils'; import { Document } from '@/lib/db/schema'; i...
tdot_chatbot
components/document-preview.tsx
TypeScript
5e63c3bd98b6be643fcc3160df522d2ef4a4d63fd18289704a9ee6c5b29cf178
0
896
> <div> <FullscreenIcon /> </div> </div> {blockKind === 'image' ? ( <div className="overflow-y-scroll border rounded-b-2xl bg-muted border-t-0 dark:border-zinc-700"> <div className="animate-pulse h-[257px] bg-muted-foreground/20 w-full" /> </div> ) : ( <div clas...
tdot_chatbot
components/document-preview.tsx
TypeScript
28d9da738c892639a5a2ceb543e3383b6c93bd3d05543e676af0b157fc0b29f3
1
896
700', { 'p-4 sm:px-14 sm:py-16': document.kind === 'text', 'p-0': document.kind === 'code', }, ); const commonProps = { content: document.content ?? '', isCurrentVersion: true, currentVersionIndex: 0, status: block.status, saveContent: () => {}, suggestions: [], }; ...
tdot_chatbot
components/document-preview.tsx
TypeScript
399a54225d76272518fcf0de042d575d759e55843690ca85a84d3aec667bd0f9
2
252
'use client'; import { BlockKind } from './block'; export const DocumentSkeleton = ({ blockKind }: { blockKind: BlockKind }) => { return blockKind === 'image' ? ( <div className="flex flex-col gap-4 w-full justify-center items-center h-[calc(100dvh-60px)]"> <div className="animate-pulse rounded-lg bg-mute...
tdot_chatbot
components/document-skeleton.tsx
TypeScript
3a16724c07de0dc58caef2a164eed439c4e7b1e210d460ea4221cd2b34556606
0
555
import { memo } from 'react'; import type { BlockKind } from './block'; import { FileIcon, LoaderIcon, MessageIcon, PencilEditIcon } from './icons'; import { toast } from 'sonner'; import { useBlock } from '@/hooks/use-block'; const getActionText = ( type: 'create' | 'update' | 'request-suggestions', tense: 'pres...
tdot_chatbot
components/document.tsx
TypeScript
632f657a490f992feb7a73f94e5cf9bdb79d799700f54cbf214732397636f733
0
896
{`${getActionText(type, 'present')} ${args.title ? `"${args.title}"` : ''}`} </div> </div> <div className="animate-spin mt-1">{<LoaderIcon />}</div> </button> ); } export const DocumentToolCall = memo(PureDocumentToolCall, () => true);
tdot_chatbot
components/document.tsx
TypeScript
29126d4e688a3b9e7d2577013da3cd7e41b6b951413ecd6152d305a12fa8eac8
1
88
'use client'; import { exampleSetup } from 'prosemirror-example-setup'; import { inputRules } from 'prosemirror-inputrules'; import { EditorState } from 'prosemirror-state'; import { EditorView } from 'prosemirror-view'; import React, { memo, useEffect, useRef } from 'react'; import type { Suggestion } from '@/lib/db...
tdot_chatbot
components/editor.tsx
TypeScript
c9725b958cdc388902624db8f1e571b852f03c059c7889d155a0eb66835653b1
0
896
= nextProps.isCurrentVersion && !(prevProps.status === 'streaming' && nextProps.status === 'streaming') && prevProps.content === nextProps.content && prevProps.saveContent === nextProps.saveContent ); } export const Editor = memo(PureEditor, areEqual);
tdot_chatbot
components/editor.tsx
TypeScript
be1c392c21fface49ffefd815ae990ace2620f1f5b97a9aee7d3d738aa1b7764
1
65
export const BotIcon = () => { return ( <svg height="16" strokeLinejoin="round" viewBox="0 0 16 16" width="16" style={{ color: 'currentcolor' }} > <path fillRule="evenodd" clipRule="evenodd" d="M8.75 2.79933C9.19835 2.53997 9.5 2.05521 9.5 1.5C9.5 0....
tdot_chatbot
components/icons.tsx
TypeScript
ea5f655a344b6097aa015dc22fecc66602646eff7d1de33d34608018c2976ae8
0
896
" clipRule="evenodd" d="M8 0C3.58 0 0 3.57879 0 7.99729C0 11.5361 2.29 14.5251 5.47 15.5847C5.87 15.6547 6.02 15.4148 6.02 15.2049C6.02 15.0149 6.01 14.3851 6.01 13.7154C4 14.0852 3.48 13.2255 3.32 12.7757C3.23 12.5458 2.84 11.836 2.5 11.6461C2.22 11.4961 1.82 11.1262 2.49 11.1162C3.12 11.1062 3.57 ...
tdot_chatbot
components/icons.tsx
TypeScript
e2fef8c4e51ddbdd87cb9702c45c1e41b61941138c7dc1cf7ba8d6824579b315
1
896