├── template ├── .npmrc ├── .env-sample ├── static │ ├── robots.txt │ └── favicon.png ├── postcss.config.js ├── src │ ├── lib │ │ ├── images │ │ │ ├── sender.png │ │ │ ├── receiver.png │ │ │ ├── github.svg │ │ │ └── svelte-logo.svg │ │ ├── components │ │ │ ├── Footer.svelte │ │ │ ├── TextArea.svelte │ │ │ ├── SubmitButton.svelte │ │ │ ├── Profile.svelte │ │ │ ├── Message.svelte │ │ │ └── Header.svelte │ │ ├── config │ │ │ └── index.ts │ │ └── utils │ │ │ └── formatMessage.ts │ ├── app.d.ts │ ├── routes │ │ ├── about │ │ │ ├── +page.ts │ │ │ └── +page.svelte │ │ ├── +layout.svelte │ │ ├── api │ │ │ └── chat │ │ │ │ └── +server.ts │ │ ├── +page.svelte │ │ └── styles.css │ └── app.html ├── tailwind.config.js ├── .gitignore ├── gitignore ├── .eslintignore ├── .prettierignore ├── .prettierrc ├── vite.config.ts ├── .eslintrc.cjs ├── tsconfig.json ├── svelte.config.js ├── package.json └── README.md ├── .gitignore ├── package.json ├── README.md └── bin └── cli.js /template/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /template/.env-sample: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY= 2 | -------------------------------------------------------------------------------- /template/static/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /template/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WillKre/create-svelte-chatgpt/HEAD/template/static/favicon.png -------------------------------------------------------------------------------- /template/postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {} 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /template/src/lib/images/sender.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WillKre/create-svelte-chatgpt/HEAD/template/src/lib/images/sender.png -------------------------------------------------------------------------------- /template/src/lib/images/receiver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WillKre/create-svelte-chatgpt/HEAD/template/src/lib/images/receiver.png -------------------------------------------------------------------------------- /template/src/lib/components/Footer.svelte: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /template/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | export default { 3 | content: ['./src/**/*.{html,js,svelte,ts}'], 4 | theme: { 5 | extend: {} 6 | }, 7 | plugins: [] 8 | }; 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | .vercel 10 | .output 11 | vite.config.js.timestamp-* 12 | vite.config.ts.timestamp-* 13 | -------------------------------------------------------------------------------- /template/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | .vercel 10 | .output 11 | vite.config.js.timestamp-* 12 | vite.config.ts.timestamp-* 13 | -------------------------------------------------------------------------------- /template/gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | .vercel 10 | .output 11 | vite.config.js.timestamp-* 12 | vite.config.ts.timestamp-* 13 | -------------------------------------------------------------------------------- /template/.eslintignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | 10 | # Ignore files for PNPM, NPM and YARN 11 | pnpm-lock.yaml 12 | package-lock.json 13 | yarn.lock 14 | -------------------------------------------------------------------------------- /template/.prettierignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | 10 | # Ignore files for PNPM, NPM and YARN 11 | pnpm-lock.yaml 12 | package-lock.json 13 | yarn.lock 14 | -------------------------------------------------------------------------------- /template/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "none", 4 | "printWidth": 100, 5 | "plugins": ["prettier-plugin-svelte"], 6 | "pluginSearchDirs": ["."], 7 | "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] 8 | } 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-svelte-chatgpt", 3 | "version": "1.0.0", 4 | "bin": { 5 | "create-svelte-chatgpt": "./bin/cli.js" 6 | }, 7 | "dependencies": { 8 | "chalk": "^5.2.0", 9 | "enquirer": "^2.3.6", 10 | "fs-extra": "^11.1.1" 11 | }, 12 | "type": "module" 13 | } 14 | -------------------------------------------------------------------------------- /template/src/app.d.ts: -------------------------------------------------------------------------------- 1 | // See https://kit.svelte.dev/docs/types#app 2 | // for information about these interfaces 3 | declare global { 4 | namespace App { 5 | // interface Error {} 6 | // interface Locals {} 7 | // interface PageData {} 8 | // interface Platform {} 9 | } 10 | } 11 | 12 | export {}; 13 | -------------------------------------------------------------------------------- /template/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { sveltekit } from '@sveltejs/kit/vite'; 2 | import { defineConfig } from 'vitest/config'; 3 | import wasm from 'vite-plugin-wasm'; 4 | 5 | export default defineConfig({ 6 | plugins: [sveltekit(), wasm()], 7 | test: { 8 | include: ['src/**/*.{test,spec}.{js,ts}'] 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /template/src/routes/about/+page.ts: -------------------------------------------------------------------------------- 1 | import { dev } from '$app/environment'; 2 | 3 | // we don't need any JS on this page, though we'll load 4 | // it in dev so that we get hot module replacement 5 | export const csr = dev; 6 | 7 | // since there's no dynamic data here, we can prerender 8 | // it so that it gets served as a static asset in production 9 | export const prerender = true; 10 | -------------------------------------------------------------------------------- /template/src/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %sveltekit.head% 8 | 9 | 10 |
%sveltekit.body%
11 | 12 | 13 | -------------------------------------------------------------------------------- /template/src/routes/+layout.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 |
8 |
9 | 10 |
11 | 12 |
13 | 14 |
16 | -------------------------------------------------------------------------------- /template/src/lib/config/index.ts: -------------------------------------------------------------------------------- 1 | import receiverImg from '../images/receiver.png'; 2 | import senderImg from '../images/sender.png'; 3 | 4 | export function createConfig() { 5 | return { 6 | nickName: 'Mr. Robot', 7 | fullName: 'ChatGPT', 8 | receiverImgSrc: receiverImg, 9 | senderImgSrc: senderImg, 10 | promptPrefix: '' // e.g. 'Answer this as if you were Elon Musk: \n\n' 11 | }; 12 | } 13 | 14 | export const config = createConfig(); 15 | -------------------------------------------------------------------------------- /template/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: '@typescript-eslint/parser', 4 | extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], 5 | plugins: ['svelte3', '@typescript-eslint'], 6 | ignorePatterns: ['*.cjs'], 7 | overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }], 8 | settings: { 9 | 'svelte3/typescript': () => require('typescript') 10 | }, 11 | parserOptions: { 12 | sourceType: 'module', 13 | ecmaVersion: 2020 14 | }, 15 | env: { 16 | browser: true, 17 | es2017: true, 18 | node: true 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /template/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./.svelte-kit/tsconfig.json", 3 | "compilerOptions": { 4 | "allowJs": true, 5 | "checkJs": true, 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "resolveJsonModule": true, 9 | "skipLibCheck": true, 10 | "sourceMap": true, 11 | "strict": true 12 | } 13 | // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias 14 | // 15 | // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes 16 | // from the referenced tsconfig.json - TypeScript does not merge them in 17 | } 18 | -------------------------------------------------------------------------------- /template/src/lib/components/TextArea.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 |