├── frontend ├── lib │ ├── index.ts │ ├── searchMovie.ts │ ├── getMovie.ts │ └── openAIStream.ts ├── .eslintrc.json ├── public │ ├── googleced055e053d2b05b.html │ ├── home.png │ ├── favicon.ico │ ├── vercel.svg │ ├── thirteen.svg │ ├── next.svg │ ├── linkedin.svg │ └── github.svg ├── app │ ├── favicon.ico │ ├── search │ │ ├── page.tsx │ │ ├── [search] │ │ │ └── page.tsx │ │ └── layout.tsx │ ├── components │ │ ├── loading-image.tsx │ │ ├── remake.module.css │ │ ├── loader.tsx │ │ ├── loading-image.module.css │ │ ├── loader.module.css │ │ ├── original.module.css │ │ ├── original.tsx │ │ ├── search.tsx │ │ ├── reload-image.tsx │ │ ├── result.tsx │ │ └── styles.module.css │ ├── page.tsx │ ├── legal │ │ ├── layout.tsx │ │ └── page.tsx │ ├── remake │ │ └── [id] │ │ │ ├── layout.tsx │ │ │ └── page.tsx │ ├── layout.tsx │ ├── styles.module.css │ └── globals.css ├── .vscode │ └── settings.json ├── next.config.js ├── .gitignore ├── tsconfig.json ├── package.json └── README.md ├── .DS_Store ├── slides ├── .npmrc ├── images │ ├── nextjs.png │ ├── robot.jpg │ ├── aws-cloud.jpg │ ├── nextjs2.png │ ├── streaming.jpg │ ├── background.jpg │ └── vercel-next.png ├── .gitignore ├── vercel.json ├── README.md ├── netlify.toml ├── package.json └── layouts │ └── image-left-33.vue ├── frontend-v2 ├── app │ ├── loading.tsx │ ├── search │ │ └── [search] │ │ │ ├── loading.tsx │ │ │ └── page.tsx │ ├── layout.tsx │ ├── page.tsx │ ├── globals.css │ ├── remake │ │ └── [movieId] │ │ │ └── page.tsx │ └── legal │ │ └── page.tsx ├── public │ ├── placeholder.jpg │ ├── placeholder-logo.png │ ├── placeholder-user.jpg │ ├── placeholder-logo.svg │ └── placeholder.svg ├── postcss.config.mjs ├── lib │ ├── utils.ts │ ├── search-movies.ts │ └── get-movie.ts ├── components │ ├── ui │ │ ├── aspect-ratio.tsx │ │ ├── skeleton.tsx │ │ ├── collapsible.tsx │ │ ├── use-mobile.tsx │ │ ├── textarea.tsx │ │ ├── label.tsx │ │ ├── input.tsx │ │ ├── separator.tsx │ │ ├── progress.tsx │ │ ├── toaster.tsx │ │ ├── sonner.tsx │ │ ├── checkbox.tsx │ │ ├── slider.tsx │ │ ├── switch.tsx │ │ ├── badge.tsx │ │ ├── tooltip.tsx │ │ ├── hover-card.tsx │ │ ├── popover.tsx │ │ ├── avatar.tsx │ │ ├── radio-group.tsx │ │ ├── toggle.tsx │ │ ├── alert.tsx │ │ ├── scroll-area.tsx │ │ ├── resizable.tsx │ │ ├── toggle-group.tsx │ │ ├── tabs.tsx │ │ ├── button.tsx │ │ ├── card.tsx │ │ ├── accordion.tsx │ │ ├── input-otp.tsx │ │ ├── calendar.tsx │ │ ├── breadcrumb.tsx │ │ ├── pagination.tsx │ │ ├── table.tsx │ │ ├── drawer.tsx │ │ ├── dialog.tsx │ │ └── use-toast.ts │ ├── loader.tsx │ ├── theme-provider.tsx │ ├── loading-image.tsx │ ├── search-container.tsx │ ├── reloadable-image.tsx │ ├── footer.tsx │ ├── styles.module.css │ ├── search-input.tsx │ ├── movie-search-result.tsx │ ├── original-movie.tsx │ ├── remake.module.css │ └── original.module.css ├── next-env.d.ts ├── next.config.mjs ├── components.json ├── hooks │ ├── use-mobile.tsx │ └── use-toast.ts ├── tsconfig.json ├── package.json ├── styles │ └── globals.css └── tailwind.config.ts ├── lambda-streaming-ttfb-write-sam ├── .DS_Store ├── samconfig.toml ├── src │ ├── package.json │ ├── .gitignore │ ├── generateImage.js │ ├── openAIStream.js │ └── index.js ├── template.yaml ├── example-pattern.json └── README.md ├── cloudflare-remake └── movie-remake │ ├── src │ ├── index.ts │ ├── messageHandling.ts │ ├── downloadImage.ts │ ├── openAIStream.ts │ └── imageGeneration.ts │ ├── tsconfig.json │ ├── package.json │ ├── wrangler.toml.example │ ├── .gitignore │ └── package-lock.json ├── .gitignore ├── migration ├── package.json └── migrate-to-uploadthing.js └── README.md /frontend/lib/index.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/.DS_Store -------------------------------------------------------------------------------- /frontend/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /slides/.npmrc: -------------------------------------------------------------------------------- 1 | # for pnpm 2 | shamefully-hoist=true 3 | auto-install-peers=true 4 | -------------------------------------------------------------------------------- /frontend-v2/app/loading.tsx: -------------------------------------------------------------------------------- 1 | export default function Loading() { 2 | return null 3 | } 4 | -------------------------------------------------------------------------------- /frontend/public/googleced055e053d2b05b.html: -------------------------------------------------------------------------------- 1 | google-site-verification: googleced055e053d2b05b.html -------------------------------------------------------------------------------- /frontend/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/frontend/app/favicon.ico -------------------------------------------------------------------------------- /frontend/public/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/frontend/public/home.png -------------------------------------------------------------------------------- /slides/images/nextjs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/slides/images/nextjs.png -------------------------------------------------------------------------------- /slides/images/robot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/slides/images/robot.jpg -------------------------------------------------------------------------------- /frontend-v2/app/search/[search]/loading.tsx: -------------------------------------------------------------------------------- 1 | export default function Loading() { 2 | return null 3 | } 4 | -------------------------------------------------------------------------------- /frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/frontend/public/favicon.ico -------------------------------------------------------------------------------- /slides/images/aws-cloud.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/slides/images/aws-cloud.jpg -------------------------------------------------------------------------------- /slides/images/nextjs2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/slides/images/nextjs2.png -------------------------------------------------------------------------------- /slides/images/streaming.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/slides/images/streaming.jpg -------------------------------------------------------------------------------- /slides/images/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/slides/images/background.jpg -------------------------------------------------------------------------------- /slides/images/vercel-next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/slides/images/vercel-next.png -------------------------------------------------------------------------------- /frontend-v2/public/placeholder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/frontend-v2/public/placeholder.jpg -------------------------------------------------------------------------------- /slides/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | *.local 5 | index.html 6 | .remote-assets 7 | components.d.ts 8 | -------------------------------------------------------------------------------- /frontend-v2/public/placeholder-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/frontend-v2/public/placeholder-logo.png -------------------------------------------------------------------------------- /frontend-v2/public/placeholder-user.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/frontend-v2/public/placeholder-user.jpg -------------------------------------------------------------------------------- /lambda-streaming-ttfb-write-sam/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vLX42/movie-remake/HEAD/lambda-streaming-ttfb-write-sam/.DS_Store -------------------------------------------------------------------------------- /frontend/app/search/page.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | export default async function Page({ params }: { params: { search: string } }) { 4 | return
; 5 | } 6 | -------------------------------------------------------------------------------- /frontend/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/.pnpm/typescript@5.0.2/node_modules/typescript/lib", 3 | "typescript.enablePromptUseWorkspaceTsdk": true 4 | } -------------------------------------------------------------------------------- /slides/vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "rewrites": [ 3 | { "source": "/(.*)", "destination": "/index.html" } 4 | ], 5 | "buildCommand": "npm run build", 6 | "outputDirectory": "dist" 7 | } 8 | -------------------------------------------------------------------------------- /frontend-v2/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /cloudflare-remake/movie-remake/src/index.ts: -------------------------------------------------------------------------------- 1 | import { fetchAndApply } from "./askQuestions"; 2 | 3 | addEventListener("fetch", (event: FetchEvent) => { 4 | event.respondWith(fetchAndApply(event.request)); 5 | }); -------------------------------------------------------------------------------- /frontend-v2/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx, type ClassValue } from "clsx" 2 | import { twMerge } from "tailwind-merge" 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)) 6 | } 7 | -------------------------------------------------------------------------------- /frontend-v2/components/ui/aspect-ratio.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" 4 | 5 | const AspectRatio = AspectRatioPrimitive.Root 6 | 7 | export { AspectRatio } 8 | -------------------------------------------------------------------------------- /cloudflare-remake/movie-remake/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "lib": ["esnext"], 6 | "types": ["@cloudflare/workers-types"] 7 | } 8 | } -------------------------------------------------------------------------------- /frontend-v2/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. 6 | -------------------------------------------------------------------------------- /frontend-v2/components/loader.tsx: -------------------------------------------------------------------------------- 1 | export function Loader() { 2 | return ( 3 |
4 |
5 |
6 | ) 7 | } 8 | -------------------------------------------------------------------------------- /cloudflare-remake/movie-remake/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-worker", 3 | "dependencies": { 4 | "eventsource-parser": "^1.0.0" 5 | }, 6 | "devDependencies": { 7 | "@cloudflare/workers-types": "^4.20230419.0", 8 | "typescript": "^5.0.4" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /frontend/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | experimental: { 4 | appDir: true, 5 | }, 6 | images: { 7 | domains: ["image.tmdb.org", "oaidalleapiprodscus.blob.core.windows.net"], 8 | }, 9 | }; 10 | module.exports = nextConfig; 11 | -------------------------------------------------------------------------------- /lambda-streaming-ttfb-write-sam/samconfig.toml: -------------------------------------------------------------------------------- 1 | version = 0.1 2 | [default.deploy.parameters] 3 | stack_name = "lambda-streaming-movie-remake" 4 | resolve_s3 = true 5 | s3_prefix = "lambda-streaming-movie-remake" 6 | region = "eu-central-1" 7 | capabilities = "CAPABILITY_IAM" 8 | image_repositories = [] 9 | -------------------------------------------------------------------------------- /frontend-v2/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | eslint: { 4 | ignoreDuringBuilds: true, 5 | }, 6 | typescript: { 7 | ignoreBuildErrors: true, 8 | }, 9 | images: { 10 | unoptimized: true, 11 | }, 12 | }; 13 | 14 | export default nextConfig; 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | cloudflair-remake/movie-remake/wrangler.toml 3 | cloudflair-remake/movie-remake/wrangler.toml 4 | cloudflair-remake/movie-remake/wrangler.toml 5 | cloudflare-remake/movie-remake/wrangler.toml 6 | migration/.env 7 | /migration/node_modules 8 | frontend-v2/.env 9 | /frontend-v2/.next 10 | /frontend-v2/node_modules 11 | -------------------------------------------------------------------------------- /slides/README.md: -------------------------------------------------------------------------------- 1 | # Welcome to [Slidev](https://github.com/slidevjs/slidev)! 2 | 3 | To start the slide show: 4 | 5 | - `npm install` 6 | - `npm run dev` 7 | - visit http://localhost:3030 8 | 9 | Edit the [slides.md](./slides.md) to see the changes. 10 | 11 | Learn more about Slidev on [documentations](https://sli.dev/). 12 | -------------------------------------------------------------------------------- /slides/netlify.toml: -------------------------------------------------------------------------------- 1 | [build.environment] 2 | NODE_VERSION = "14" 3 | 4 | [build] 5 | publish = "dist" 6 | command = "npm run build" 7 | 8 | [[redirects]] 9 | from = "/.well-known/*" 10 | to = "/.well-known/:splat" 11 | status = 200 12 | 13 | [[redirects]] 14 | from = "/*" 15 | to = "/index.html" 16 | status = 200 17 | -------------------------------------------------------------------------------- /frontend/app/components/loading-image.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { Loader } from "./loader"; 4 | import styles from "./loading-image.module.css"; 5 | 6 | export const LoadingImage = () => ( 7 |
8 |

9 | Generating poster 10 | 11 |

12 |
13 | ); 14 | -------------------------------------------------------------------------------- /slides/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "slides", 3 | "private": true, 4 | "scripts": { 5 | "build": "slidev build", 6 | "dev": "slidev --open", 7 | "export": "slidev export" 8 | }, 9 | "dependencies": { 10 | "@slidev/cli": "^0.40.14", 11 | "@slidev/theme-default": "*", 12 | "@slidev/theme-seriph": "*" 13 | } 14 | } -------------------------------------------------------------------------------- /frontend/app/components/remake.module.css: -------------------------------------------------------------------------------- 1 | .h1 { 2 | display: flex; 3 | align-items: center; 4 | padding-bottom: 20px; 5 | } 6 | 7 | .description p { 8 | padding-bottom: 10px; 9 | font-size: 20px; 10 | } 11 | 12 | .poster { 13 | width: 100%; 14 | height: auto; 15 | } 16 | 17 | .back { 18 | display: block; 19 | font-size: 25px; 20 | } 21 | -------------------------------------------------------------------------------- /frontend-v2/components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "@/lib/utils" 2 | 3 | function Skeleton({ 4 | className, 5 | ...props 6 | }: React.HTMLAttributes) { 7 | return ( 8 |
12 | ) 13 | } 14 | 15 | export { Skeleton } 16 | -------------------------------------------------------------------------------- /frontend/app/components/loader.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styles from './loader.module.css'; 3 | 4 | export const Loader = () => { 5 | return ( 6 |
7 |
8 |
9 |
10 |
11 | ); 12 | }; -------------------------------------------------------------------------------- /frontend-v2/components/theme-provider.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import * as React from 'react' 4 | import { 5 | ThemeProvider as NextThemesProvider, 6 | type ThemeProviderProps, 7 | } from 'next-themes' 8 | 9 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) { 10 | return {children} 11 | } 12 | -------------------------------------------------------------------------------- /frontend-v2/components/ui/collapsible.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as CollapsiblePrimitive from "@radix-ui/react-collapsible" 4 | 5 | const Collapsible = CollapsiblePrimitive.Root 6 | 7 | const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger 8 | 9 | const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent 10 | 11 | export { Collapsible, CollapsibleTrigger, CollapsibleContent } 12 | -------------------------------------------------------------------------------- /frontend/app/components/loading-image.module.css: -------------------------------------------------------------------------------- 1 | .loadingImage { 2 | background-color: lightgray; 3 | width: 512px; 4 | height: 512px; 5 | display: flex; 6 | align-items: center; 7 | justify-content: center; 8 | } 9 | 10 | @media only screen and (max-width: 767px) { 11 | /* styles for screens smaller than 768px, which are typically mobile devices */ 12 | .loadingImage { 13 | width: 100%; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lambda-streaming-ttfb-write-sam/src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lambda-aws-movie-remake", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "node-fetch": "^3.3.1", 14 | "eventsource-parser": "1.0.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cloudflare-remake/movie-remake/wrangler.toml.example: -------------------------------------------------------------------------------- 1 | name = "movie-remake" 2 | main = "src/index.ts" 3 | compatibility_date = "2023-04-11" 4 | usage_model = "bundled" 5 | 6 | kv_namespaces = [ 7 | { binding = "MOVIE_DATA", id = "" } 8 | ] 9 | 10 | [triggers] 11 | crons = [ ] 12 | 13 | [vars] 14 | REPLICATE_API_TOKEN = "" 15 | OPENAI_API_KEY = "" 16 | IMAGES_ACCOUNT_ID = "" 17 | IMAGES_TOKEN = "" -------------------------------------------------------------------------------- /migration/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "migration", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "migrate": "node -r dotenv/config migrate-to-uploadthing.js" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "description": "", 12 | "dependencies": { 13 | "dotenv": "^16.5.0", 14 | "form-data": "^4.0.2", 15 | "node-fetch": "^3.3.2", 16 | "uploadthing": "^7.7.2" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /frontend-v2/components/loading-image.tsx: -------------------------------------------------------------------------------- 1 | export function LoadingImage() { 2 | return ( 3 |
4 |
5 |
6 | Generating image... 7 |
8 |
9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /frontend/app/page.tsx: -------------------------------------------------------------------------------- 1 | import { MovieSearchForm } from "./components/search"; 2 | import styles from "./styles.module.css"; 3 | import { Abril_Fatface } from "next/font/google"; 4 | const abril_fatface = Abril_Fatface({ weight: ["400"], subsets: ["latin"] }); 5 | 6 | export default function Page() { 7 | return ( 8 |
9 |

10 | Hollywood Movie Remake Generator 11 |

12 | 13 |
14 | ); 15 | } -------------------------------------------------------------------------------- /frontend-v2/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "app/globals.css", 9 | "baseColor": "neutral", 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 | "iconLibrary": "lucide" 21 | } -------------------------------------------------------------------------------- /frontend/app/search/[search]/page.tsx: -------------------------------------------------------------------------------- 1 | import { Suspense } from "react"; 2 | import { 3 | MovieSearchResult, 4 | MovieSearchResultSkeleton, 5 | } from "../../components/result"; 6 | import { searchMovies } from "../../../lib/searchMovie"; 7 | 8 | export default async function Page({ params }: { params: { search: string } }) { 9 | const movieData = await searchMovies(params.search); 10 | return ( 11 | }> 12 | 13 | 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /frontend/.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 | -------------------------------------------------------------------------------- /cloudflare-remake/movie-remake/src/messageHandling.ts: -------------------------------------------------------------------------------- 1 | export function getMessagesPrompt(chat) { 2 | let messages = []; 3 | 4 | chat.map((message) => { 5 | const role = message.name == "Me" ? "user" : "assistant"; 6 | const m = { role: role, content: message.message }; 7 | messages.push(m); 8 | }); 9 | 10 | return messages; 11 | } 12 | 13 | export async function sendEvent(writer, data) { 14 | let encoder = new TextEncoder(); 15 | await writer.write(encoder.encode(`event: add\n`)); 16 | await writer.write(encoder.encode(`data: ${JSON.stringify(data)}\n\n`)); 17 | } 18 | -------------------------------------------------------------------------------- /cloudflare-remake/movie-remake/.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 | -------------------------------------------------------------------------------- /lambda-streaming-ttfb-write-sam/src/.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 | -------------------------------------------------------------------------------- /frontend/app/search/layout.tsx: -------------------------------------------------------------------------------- 1 | import { MovieSearchForm } from "../components/search"; 2 | import styles from "../styles.module.css"; 3 | import { Abril_Fatface } from "next/font/google"; 4 | const abril_fatface = Abril_Fatface({ weight: ["400"], subsets: ["latin"] }); 5 | 6 | export default function RootLayout({ 7 | children, 8 | }: { 9 | children: React.ReactNode; 10 | }) { 11 | return ( 12 |
13 |

14 | Hollywood Movie Remake Generator 15 |

16 | 17 | {children} 18 |
19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /frontend/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/app/components/loader.module.css: -------------------------------------------------------------------------------- 1 | @keyframes dotFade { 2 | 0% { 3 | opacity: 1; 4 | } 5 | 100% { 6 | opacity: 0.3; 7 | } 8 | } 9 | 10 | .loader { 11 | display: inline-flex; 12 | margin-left: 5px; 13 | } 14 | 15 | .dot { 16 | background-color: white; /* Change this to your desired color */ 17 | border-radius: 50%; 18 | width: 10px; 19 | height: 10px; 20 | margin: 0 2px; 21 | animation: dotFade 1s infinite; 22 | } 23 | 24 | .dot:nth-child(2) { 25 | animation-delay: 0.2s; 26 | } 27 | 28 | .dot:nth-child(3) { 29 | animation-delay: 0.4s; 30 | } -------------------------------------------------------------------------------- /frontend-v2/components/search-container.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import { SearchInput } from "./search-input" 4 | 5 | interface SearchContainerProps { 6 | searchTerm?: string 7 | size?: "large" | "medium" 8 | } 9 | 10 | export function SearchContainer({ searchTerm = "", size = "large" }: SearchContainerProps) { 11 | const sizeClasses = { 12 | large: "text-2xl md:text-3xl p-6", 13 | medium: "text-xl md:text-2xl p-4", 14 | } 15 | 16 | return ( 17 |
18 | 19 |
20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /frontend/app/legal/layout.tsx: -------------------------------------------------------------------------------- 1 | import { MovieSearchForm } from "../components/search"; 2 | import styles from "../styles.module.css"; 3 | import { Abril_Fatface } from "next/font/google"; 4 | const abril_fatface = Abril_Fatface({ weight: ["400"], subsets: ["latin"] }); 5 | 6 | export default function RootLayout({ 7 | children, 8 | }: { 9 | children: React.ReactNode; 10 | }) { 11 | return ( 12 |
13 |

14 | Hollywood Movie Remake Generator 15 |

16 |
{children}
17 |
18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /frontend-v2/hooks/use-mobile.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | const MOBILE_BREAKPOINT = 768 4 | 5 | export function useIsMobile() { 6 | const [isMobile, setIsMobile] = React.useState(undefined) 7 | 8 | React.useEffect(() => { 9 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) 10 | const onChange = () => { 11 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 12 | } 13 | mql.addEventListener("change", onChange) 14 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 15 | return () => mql.removeEventListener("change", onChange) 16 | }, []) 17 | 18 | return !!isMobile 19 | } 20 | -------------------------------------------------------------------------------- /slides/layouts/image-left-33.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | -------------------------------------------------------------------------------- /frontend-v2/components/ui/use-mobile.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | const MOBILE_BREAKPOINT = 768 4 | 5 | export function useIsMobile() { 6 | const [isMobile, setIsMobile] = React.useState(undefined) 7 | 8 | React.useEffect(() => { 9 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) 10 | const onChange = () => { 11 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 12 | } 13 | mql.addEventListener("change", onChange) 14 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 15 | return () => mql.removeEventListener("change", onChange) 16 | }, []) 17 | 18 | return !!isMobile 19 | } 20 | -------------------------------------------------------------------------------- /frontend/app/remake/[id]/layout.tsx: -------------------------------------------------------------------------------- 1 | import "../../globals.css"; 2 | import { Abril_Fatface } from "next/font/google"; 3 | import styles from "../../styles.module.css"; 4 | const abril_fatface = Abril_Fatface({ weight: ["400"], subsets: ["latin"] }); 5 | 6 | export const metadata = { 7 | title: "Movie Remake Generator", 8 | description: "Generated by create next app", 9 | }; 10 | 11 | export default function RootLayout({ 12 | children, 13 | }: { 14 | children: React.ReactNode; 15 | }) { 16 | return ( 17 | <> 18 |

19 | Hollywood Movie Remake Generator 20 |

21 | {children} 22 | 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /frontend-v2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "target": "ES6", 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /cloudflare-remake/movie-remake/src/downloadImage.ts: -------------------------------------------------------------------------------- 1 | export async function downloadImageWithRetry( 2 | imageURL, 3 | retries = 10, 4 | delay = 600 5 | ) { 6 | for (let i = 0; i <= retries; i++) { 7 | try { 8 | const response = await fetch(imageURL); 9 | if (response.ok) { 10 | const imageData = await response.arrayBuffer(); 11 | return imageData; 12 | } 13 | } catch (error) { 14 | console.error(`Attempt ${i} failed: ${error.message}`); 15 | } 16 | 17 | if (i < retries) { 18 | await new Promise((resolve) => setTimeout(resolve, delay)); 19 | } 20 | } 21 | console.error("Failed to download image after retries") 22 | return 23 | } 24 | -------------------------------------------------------------------------------- /frontend/app/components/original.module.css: -------------------------------------------------------------------------------- 1 | .blurayCover { 2 | position: relative; 3 | width: 150px; 4 | height: 200px; 5 | perspective: 1000px; 6 | margin: 50px; 7 | float: right; 8 | } 9 | 10 | .coverImage { 11 | position: absolute; 12 | width: 100%; 13 | height: auto; 14 | background-color: #000; 15 | transform: rotateY(-10deg) rotateX(-5deg); 16 | border-radius: 5px; 17 | box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); 18 | } 19 | 20 | .titleLabel { 21 | position: absolute; 22 | bottom: 0; 23 | left: 0; 24 | background-color: rgba(0, 0, 0, 0.7); 25 | color: #fff; 26 | font-weight: bold; 27 | padding: 5px 10px; 28 | border-radius: 0 0 5px 0; 29 | text-align: center; 30 | width: 100%; 31 | } -------------------------------------------------------------------------------- /frontend/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 | "plugins": [ 18 | { 19 | "name": "next" 20 | } 21 | ], 22 | "paths": { 23 | "@/*": ["./*"] 24 | } 25 | }, 26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "lib/OpenAIStream.ts "], 27 | "exclude": ["node_modules"] 28 | } 29 | -------------------------------------------------------------------------------- /frontend-v2/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | const Textarea = React.forwardRef< 6 | HTMLTextAreaElement, 7 | React.ComponentProps<"textarea"> 8 | >(({ className, ...props }, ref) => { 9 | return ( 10 |