🎥 Make videos programmatically with React
AI improvements
Jonny Burger41c707f19473
diff --git a/packages/ai-improvements/.gitignore b/packages/ai-improvements/.gitignorenew file mode 100644index 0000000000..76cd19437d--- /dev/null+++ b/packages/ai-improvements/.gitignore@@ -0,0 +1,3 @@+.env+node_modules+.donediff --git a/packages/ai-improvements/improve-docs.ts b/packages/ai-improvements/improve-docs.tsnew file mode 100644index 0000000000..40591da548--- /dev/null+++ b/packages/ai-improvements/improve-docs.ts@@ -0,0 +1,72 @@+import path from "path";+import { articles } from "../docs/src/data/articles";+import { OpenAI } from "openai";++const openai = new OpenAI({+ apiKey: process.env.OPEN_AI_API_KEY,+});++for (const article of articles) {+ const filePath = path.join(+ path.join(process.cwd(), "..", "docs", article.relativePath)+ );+ const contents = await Bun.file(filePath).text();+ const containsSourceCode = contents+ .toLowerCase()+ .includes("source code for ");++ if (containsSourceCode) {+ const match = contents.match(/\[.*source code for.*\]\((.*)\)/i);+ if (!match) {+ console.error(`Could not find source code for article ${article.title}`);+ continue;+ }+ const url = match[1];+ const p = url.replace(+ "https://github.com/remotion-dev/remotion/blob/main/",+ ""+ );+ const flag = path.join(".done", article.id);++ if (await Bun.file(flag).exists()) {+ console.log(`Article ${article.title} already processed`);+ continue;+ }++ const file = path.join(process.cwd(), "..", "..", p);+ console.log(file);+ const sourceContents = await Bun.file(file).text();+ console.log(`Article ${article.title} contains source code`);++ const stream = await openai.chat.completions.create({+ model: "gpt-4-turbo",+ messages: [+ {+ role: "system",+ content: [+ "You are going to be given an API and an API documentation.",+ "respond if you think the API documentation is missing parameters the user can pass or the return value is not right.",+ "Also point out typos.",+ "Do only point out obvious mistakes.",+ "Consider that the documentation may contain backticks and html tags, which are not mistakes.",+ "Point out if the markdown is not formatted correctly.",+ "Otherwise, just say OK.",+ ].join("\n"),+ },+ {+ role: "user",+ content: "This is the source code for the API:\n" + sourceContents,+ },+ {+ role: "user",+ content: "This is the markdown of the document:\n" + contents,+ },+ ],+ stream: true,+ });+ for await (const chunk of stream) {+ process.stdout.write(chunk.choices[0]?.delta?.content || "");+ }+ await Bun.write(flag, "txt");+ }+}diff --git a/packages/ai-improvements/package.json b/packages/ai-improvements/package.jsonnew file mode 100644index 0000000000..aa565b0756--- /dev/null+++ b/packages/ai-improvements/package.json@@ -0,0 +1,10 @@+{+ "name": "ai-improvements",+ "dependencies": {+ "@types/node": "^20.6.5",+ "@types/bun": "1.0.12",+ "openai": "^4.18.0"+ },+ "private": true,+ "version": "4.0.142"+}diff --git a/packages/docs/docs/cloudrun/deletesite.md b/packages/docs/docs/cloudrun/deletesite.mdindex 352c8639c6..f8d5fc3595 100644--- a/packages/docs/docs/cloudrun/deletesite.md+++ b/packages/docs/docs/cloudrun/deletesite.md@@ -54,11 +54,7 @@ The unique ID of the project you want to delete.## Return value-A promise resolving to an object with the following property:--### `totalSizeInBytes`--Nothing. If the deletion failed, the service rejects with an error.+A promise resolving nothing.## See alsodiff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex 4699b3f097..a9a4c8eefb 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -391,6 +391,13 @@ export const articles = [compId: "articles-docs-cloudrun-generate-env",crumb: "Cloud Run",},+ {+ id: "getserviceinfo",+ title: "getServiceInfo()",+ relativePath: "docs/cloudrun/getServiceinfo.md",+ compId: "articles-docs-cloudrun-getServiceinfo",+ crumb: "Cloud Run API",+ },{id: "getorcreatebucket",title: "getOrCreateBucket()",@@ -405,13 +412,6 @@ export const articles = [compId: "articles-docs-cloudrun-getregions",crumb: "Cloud Run API",},- {- id: "getserviceinfo",- title: "getServiceInfo()",- relativePath: "docs/cloudrun/getServiceinfo.md",- compId: "articles-docs-cloudrun-getServiceinfo",- crumb: "Cloud Run API",- },{id: "getservices",title: "getServices()",@@ -1640,7 +1640,7 @@ export const articles = [{id: "miscellaneous/cloud-gpu-docker",title: "Setup EC2 for Docker with GPU",- relativePath: "docs/miscellaneous/cloud-gpu-docker.md",+ relativePath: "docs/miscellaneous/cloud-gpu-docker.mdx",compId: "articles-docs-miscellaneous-cloud-gpu-docker",crumb: "FAQ",},diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 8d95eaaf4f..4defc80589 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -25,6 +25,18 @@ importers:specifier: 18.14.6version: 18.14.6+ packages/ai-improvements:+ dependencies:+ '@types/bun':+ specifier: 1.0.12+ version: 1.0.12+ '@types/node':+ specifier: ^20.6.5+ version: 20.11.17+ openai:+ specifier: ^4.18.0+ version: 4.38.2+packages/animation-utils:dependencies:react:@@ -1046,8 +1058,6 @@ importers:specifier: 18.2.18version: 18.2.18- packages/example/build/public: {}-packages/gif:dependencies:remotion:@@ -9698,7 +9708,6 @@ packages:resolution: {integrity: sha512-qPb5FcygbpSS1NDBjWyQCWeI9kKXwSYSR1Enu7yb+gMXgFwGMhlyOvgV/7FGrdvAjlSXWRY6IDepos7k8WzAtQ==}dependencies:bun-types: 1.0.36- dev: true/@types/[email protected]:resolution: {integrity: sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA==}@@ -9940,6 +9949,13 @@ packages:'@types/unist': 2.0.6dev: false+ /@types/[email protected]:+ resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==}+ dependencies:+ '@types/node': 18.14.6+ form-data: 4.0.0+ dev: false+/@types/[email protected]:resolution: {integrity: sha512-e8PUNQy1HgJGV3iU/Bp2+D/DXh3PYeyli8LgIwsQcs1Ar1LoaWHSIT6Rw+H2rNJmiq6SNWiDytfx8+gYj7wDHw==}dev: false@@ -9951,7 +9967,6 @@ packages:resolution: {integrity: sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==}dependencies:undici-types: 5.26.5- dev: true/@types/[email protected]:resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}@@ -10985,6 +11000,13 @@ packages:- supports-colordev: true+ resolution: {integrity: sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==}+ engines: {node: '>= 8.0.0'}+ dependencies:+ humanize-ms: 1.2.1+ dev: false+resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==}engines: {node: '>=8'}@@ -11825,7 +11847,6 @@ packages:dependencies:'@types/node': 20.11.17'@types/ws': 8.5.10- dev: trueresolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==}@@ -14588,6 +14609,10 @@ packages:webpack: 5.83.1(@swc/[email protected])dev: false+ resolution: {integrity: sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==}+ dev: false+resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}engines: {node: '>= 6'}@@ -14596,6 +14621,14 @@ packages:combined-stream: 1.0.8mime-types: 2.1.34+ resolution: {integrity: sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==}+ engines: {node: '>= 12.20'}+ dependencies:+ node-domexception: 1.0.0+ web-streams-polyfill: 4.0.0-beta.3+ dev: false+resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}engines: {node: '>= 0.6'}@@ -15579,6 +15612,12 @@ packages:engines: {node: '>=12.20.0'}dev: false+ resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==}+ dependencies:+ ms: 2.1.3+ dev: false+resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}engines: {node: '>=0.10.0'}@@ -17844,6 +17883,11 @@ packages:resolution: {integrity: sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==}dev: true+ resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}+ engines: {node: '>=10.5.0'}+ dev: false+resolution: {integrity: sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==}dependencies:@@ -18088,6 +18132,22 @@ packages:is-wsl: 2.2.0dev: false+ resolution: {integrity: sha512-M16ehj0D84Gjq5cjvBzXRb5X+UvtWlxPDRAWAWMC0EN+6nHqnULIn5fWWeiexDPup25FeSZYv/ldp8KefcZVJQ==}+ hasBin: true+ dependencies:+ '@types/node': 18.14.6+ '@types/node-fetch': 2.6.11+ abort-controller: 3.0.0+ agentkeepalive: 4.5.0+ form-data-encoder: 1.7.2+ formdata-node: 4.4.1+ node-fetch: 2.6.9+ web-streams-polyfill: 3.3.3+ transitivePeerDependencies:+ - encoding+ dev: false+resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==}hasBin: true@@ -22334,7 +22394,6 @@ packages:resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}- dev: trueresolution: {integrity: sha512-1iVwbhonhFytNdg0P4PqyIAXbdlVZVebtPDvuM36m66mRw4OGrCm2MYynJv/UENFLdP13J1nPVQzVE2zTs1OeA==}@@ -23306,6 +23365,16 @@ packages:resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}dev: false+ resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==}+ engines: {node: '>= 8'}+ dev: false++ resolution: {integrity: sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==}+ engines: {node: '>= 14'}+ dev: false+resolution: {integrity: sha512-LkBXKjU5r9vAW7Gcu3T5u+5cvSvh5WwINdr0C+9jpzVB41cjQAP5ePArDtk/WHYdVj0GefCgM73BA7FlIiNtdg==}dev: false