├── public ├── ads.txt ├── OpenL.png ├── ecash.png ├── logo.png ├── 1-black.png ├── 2-black.png ├── favicon.ico ├── og-image.png ├── screenshot.png ├── vercelLogo.png ├── BetterPrompt.png ├── buymeacoffee.png ├── screenshot2.png ├── screenshot3.png ├── writingIcon.png ├── NeuronaDigital.jpg ├── TeachAnything.png ├── favicon-16x16.png ├── favicon-32x32.png ├── apple-touch-icon.png ├── android-chrome-192x192.png ├── android-chrome-512x512.png ├── site.webmanifest ├── twitter.svg ├── github.svg ├── vercel.svg ├── react.svg ├── sailboatui.svg ├── talentorg.svg └── magickpen.svg ├── next.config.js ├── postcss.config.js ├── pages ├── _app.tsx ├── api │ └── generate.ts ├── _document.tsx └── index.tsx ├── tailwind.config.js ├── .gitignore ├── tsconfig.json ├── components ├── LoadingDots.tsx ├── ResizablePanel.tsx ├── GitHub.tsx ├── Header.tsx ├── Footer.tsx ├── DropDown2.tsx └── DropDown.tsx ├── styles ├── globals.css └── loading-dots.module.css ├── package.json ├── utils └── OpenAIStream.ts ├── README.md └── pnpm-lock.yaml /public/ads.txt: -------------------------------------------------------------------------------- 1 | google.com, pub-9181833886721130, DIRECT, f08c47fec0942fa0 2 | -------------------------------------------------------------------------------- /public/OpenL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/OpenL.png -------------------------------------------------------------------------------- /public/ecash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/ecash.png -------------------------------------------------------------------------------- /public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/logo.png -------------------------------------------------------------------------------- /public/1-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/1-black.png -------------------------------------------------------------------------------- /public/2-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/2-black.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/og-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/og-image.png -------------------------------------------------------------------------------- /public/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/screenshot.png -------------------------------------------------------------------------------- /public/vercelLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/vercelLogo.png -------------------------------------------------------------------------------- /public/BetterPrompt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/BetterPrompt.png -------------------------------------------------------------------------------- /public/buymeacoffee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/buymeacoffee.png -------------------------------------------------------------------------------- /public/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/screenshot2.png -------------------------------------------------------------------------------- /public/screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/screenshot3.png -------------------------------------------------------------------------------- /public/writingIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/writingIcon.png -------------------------------------------------------------------------------- /public/NeuronaDigital.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/NeuronaDigital.jpg -------------------------------------------------------------------------------- /public/TeachAnything.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/TeachAnything.png -------------------------------------------------------------------------------- /public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/favicon-16x16.png -------------------------------------------------------------------------------- /public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/favicon-32x32.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/apple-touch-icon.png -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | module.exports = { 3 | reactStrictMode: true, 4 | } 5 | -------------------------------------------------------------------------------- /public/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/android-chrome-192x192.png -------------------------------------------------------------------------------- /public/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvwzhen/Ask2End/HEAD/public/android-chrome-512x512.png -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /public/site.webmanifest: -------------------------------------------------------------------------------- 1 | {"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} -------------------------------------------------------------------------------- /pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import { Analytics } from "@vercel/analytics/react"; 2 | import type { AppProps } from "next/app"; 3 | import Script from 'next/script'; 4 | import "../styles/globals.css"; 5 | 6 | function MyApp({ Component, pageProps }: AppProps) { 7 | return ( 8 | <> 9 | 10 | 11 | 12 | ); 13 | } 14 | 15 | export default MyApp; 16 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | future: { 4 | hoverOnlyWhenSupported: true, 5 | }, 6 | content: [ 7 | "./pages/**/*.{js,ts,jsx,tsx}", 8 | "./components/**/*.{js,ts,jsx,tsx}", 9 | "./app/**/*.{js,ts,jsx,tsx}", 10 | ], 11 | theme: { 12 | extend: {}, 13 | }, 14 | plugins: [require("@tailwindcss/forms"), require("@headlessui/tailwindcss")], 15 | }; 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | .pnpm-debug.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | .env 38 | 39 | # idea 40 | .idea 41 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "noEmit": true, 10 | "esModuleInterop": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "jsx": "preserve", 16 | "incremental": true 17 | }, 18 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], 19 | "exclude": ["node_modules"] 20 | } 21 | -------------------------------------------------------------------------------- /public/twitter.svg: -------------------------------------------------------------------------------- 1 | Twitter -------------------------------------------------------------------------------- /components/LoadingDots.tsx: -------------------------------------------------------------------------------- 1 | import styles from "../styles/loading-dots.module.css"; 2 | 3 | const LoadingDots = ({ 4 | color = "#000", 5 | style = "small", 6 | }: { 7 | color: string; 8 | style: string; 9 | }) => { 10 | return ( 11 | 12 | 13 | 14 | 15 | 16 | ); 17 | }; 18 | 19 | export default LoadingDots; 20 | 21 | LoadingDots.defaultProps = { 22 | style: "small", 23 | }; 24 | -------------------------------------------------------------------------------- /styles/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | 6 | .pro-btn{ 7 | background-image: linear-gradient(to right, rgb(251, 113, 133), rgb(217, 70, 239), rgb(99, 102, 241), rgb(217, 70, 239),rgb(251, 113, 133)), 8 | linear-gradient(to right, rgb(251, 113, 133), rgb(217, 70, 239), rgb(99, 102, 241), rgb(217, 70, 239),rgb(251, 113, 133)); 9 | background-size: 200% 100%; 10 | animation: text-gradient 2s linear infinite; 11 | color: #fff; 12 | } 13 | 14 | @keyframes text-gradient { 15 | 0% { 16 | background-position: 0% 0%; 17 | } 18 | 100% { 19 | background-position: 200% 0%; 20 | } 21 | } -------------------------------------------------------------------------------- /components/ResizablePanel.tsx: -------------------------------------------------------------------------------- 1 | import { motion } from "framer-motion"; 2 | import useMeasure from "react-use-measure"; 3 | 4 | export default function ResizablePanel({ 5 | children, 6 | }: { 7 | children: React.ReactNode; 8 | }) { 9 | let [ref, { height }] = useMeasure(); 10 | 11 | return ( 12 | 18 |
19 | {children} 20 |
21 |
22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /public/github.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "next dev", 5 | "build": "next build", 6 | "start": "next start" 7 | }, 8 | "dependencies": { 9 | "@headlessui/react": "^1.7.7", 10 | "@headlessui/tailwindcss": "^0.1.2", 11 | "@heroicons/react": "^2.0.13", 12 | "@tailwindcss/forms": "^0.5.3", 13 | "@vercel/analytics": "^0.1.8", 14 | "eventsource-parser": "^0.0.5", 15 | "framer-motion": "^8.4.3", 16 | "next": "latest", 17 | "react": "18.2.0", 18 | "react-dom": "18.2.0", 19 | "react-hook-form": "^7.42.0", 20 | "react-hot-toast": "^2.4.0", 21 | "react-use-measure": "^2.1.1" 22 | }, 23 | "devDependencies": { 24 | "@types/node": "18.11.3", 25 | "@types/react": "18.0.21", 26 | "@types/react-dom": "18.0.6", 27 | "autoprefixer": "^10.4.12", 28 | "postcss": "^8.4.18", 29 | "tailwindcss": "^3.2.4", 30 | "typescript": "4.9.4" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /pages/api/generate.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from "next/server"; 2 | import { OpenAIStream, OpenAIStreamPayload } from "../../utils/OpenAIStream"; 3 | 4 | if (!process.env.OPENAI_API_KEY) { 5 | throw new Error("Missing env var from OpenAI"); 6 | } 7 | 8 | export const config = { 9 | runtime: "edge", 10 | }; 11 | 12 | const handler = async (req: NextRequest): Promise => { 13 | const { prompt } = (await req.json()) as { 14 | prompt?: string; 15 | }; 16 | 17 | if (!prompt) { 18 | return new Response("No prompt in the request", { status: 400 }); 19 | } 20 | 21 | const payload: OpenAIStreamPayload = { 22 | model: "gpt-3.5-turbo", 23 | messages: [{ role: "user", content: prompt }], 24 | temperature: 0.7, 25 | top_p: 1, 26 | frequency_penalty: 0, 27 | presence_penalty: 0, 28 | max_tokens: 500, 29 | stream: true, 30 | n: 1, 31 | }; 32 | 33 | const stream = await OpenAIStream(payload); 34 | return new Response(stream); 35 | }; 36 | 37 | export default handler; 38 | -------------------------------------------------------------------------------- /components/GitHub.tsx: -------------------------------------------------------------------------------- 1 | export default function Github({ className }: { className?: string }) { 2 | return ( 3 | 11 | 12 | 13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /public/vercel.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /styles/loading-dots.module.css: -------------------------------------------------------------------------------- 1 | .loading { 2 | display: inline-flex; 3 | align-items: center; 4 | } 5 | 6 | .loading .spacer { 7 | margin-right: 2px; 8 | } 9 | 10 | .loading span { 11 | animation-name: blink; 12 | animation-duration: 1.4s; 13 | animation-iteration-count: infinite; 14 | animation-fill-mode: both; 15 | width: 5px; 16 | height: 5px; 17 | border-radius: 50%; 18 | display: inline-block; 19 | margin: 0 1px; 20 | } 21 | 22 | .loading span:nth-of-type(2) { 23 | animation-delay: 0.2s; 24 | } 25 | 26 | .loading span:nth-of-type(3) { 27 | animation-delay: 0.4s; 28 | } 29 | 30 | .loading2 { 31 | display: inline-flex; 32 | align-items: center; 33 | } 34 | 35 | .loading2 .spacer { 36 | margin-right: 2px; 37 | } 38 | 39 | .loading2 span { 40 | animation-name: blink; 41 | animation-duration: 1.4s; 42 | animation-iteration-count: infinite; 43 | animation-fill-mode: both; 44 | width: 4px; 45 | height: 4px; 46 | border-radius: 50%; 47 | display: inline-block; 48 | margin: 0 1px; 49 | } 50 | 51 | .loading2 span:nth-of-type(2) { 52 | animation-delay: 0.2s; 53 | } 54 | 55 | .loading2 span:nth-of-type(3) { 56 | animation-delay: 0.4s; 57 | } 58 | 59 | @keyframes blink { 60 | 0% { 61 | opacity: 0.2; 62 | } 63 | 20% { 64 | opacity: 1; 65 | } 66 | 100% { 67 | opacity: 0.2; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /pages/_document.tsx: -------------------------------------------------------------------------------- 1 | import Document, { Head, Html, Main, NextScript } from "next/document"; 2 | import Script from 'next/script'; 3 | 4 | class MyDocument extends Document { 5 | render() { 6 | return ( 7 | 8 | 9 | 10 | 11 | 12 | 13 | 17 | 21 | 22 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 134 | 135 |
136 | 137 |
138 |

Ask to the End

139 |

Ask anything, get the ultimate answer!

140 |
141 |
142 | 143 | 1 144 | 145 |

Write your question

146 |
147 |