Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

feat: added getting started page (#73)

Aman Agarwalcbe8e02fe7c3
diff --git a/src/client/package-lock.json b/src/client/package-lock.json
index 0e7b36f4..f911e9df 100644
--- a/src/client/package-lock.json
+++ b/src/client/package-lock.json
@@ -20,13 +20,15 @@
"next": "14.0.4",
"next-auth": "^4.24.5",
"react": "^18",
- "react-dom": "^18"
+ "react-dom": "^18",
+ "react-syntax-highlighter": "^15.5.0"
},
"devDependencies": {
"@types/lodash": "^4.14.202",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
+ "@types/react-syntax-highlighter": "^15.5.11",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.4",
@@ -719,6 +721,14 @@
"resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",
"integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw=="
},
+ "node_modules/@types/hast": {
+ "version": "2.3.10",
+ "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.10.tgz",
+ "integrity": "sha512-McWspRw8xx8J9HurkVBfYj0xKoE25tOFlHGdx4MJ5xORQrMGZNqJhVQWaIbm6Oyla5kYOXtDiopzKRJzEOkwJw==",
+ "dependencies": {
+ "@types/unist": "^2"
+ }
+ },
"node_modules/@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
@@ -766,12 +776,26 @@
"@types/react": "*"
}
},
+ "node_modules/@types/react-syntax-highlighter": {
+ "version": "15.5.11",
+ "resolved": "https://registry.npmjs.org/@types/react-syntax-highlighter/-/react-syntax-highlighter-15.5.11.tgz",
+ "integrity": "sha512-ZqIJl+Pg8kD+47kxUjvrlElrraSUrYa4h0dauY/U/FTUuprSCqvUj+9PNQNQzVc6AJgIWUUxn87/gqsMHNbRjw==",
+ "dev": true,
+ "dependencies": {
+ "@types/react": "*"
+ }
+ },
"node_modules/@types/scheduler": {
"version": "0.16.8",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz",
"integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==",
"dev": true
},
+ "node_modules/@types/unist": {
+ "version": "2.0.10",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz",
+ "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA=="
+ },
"node_modules/@typescript-eslint/parser": {
"version": "6.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.0.tgz",
@@ -1375,6 +1399,33 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
+ "node_modules/character-entities": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz",
+ "integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/character-entities-legacy": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz",
+ "integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/character-reference-invalid": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz",
+ "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
@@ -1441,6 +1492,15 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
+ "node_modules/comma-separated-tokens": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz",
+ "integrity": "sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/commander": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
@@ -2376,6 +2436,18 @@
"reusify": "^1.0.4"
}
},
+ "node_modules/fault": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz",
+ "integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==",
+ "dependencies": {
+ "format": "^0.2.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/file-entry-cache": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
@@ -2459,6 +2531,14 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/format": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz",
+ "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==",
+ "engines": {
+ "node": ">=0.4.x"
+ }
+ },
"node_modules/fraction.js": {
"version": "4.3.7",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
@@ -2758,6 +2838,39 @@
"node": ">= 0.4"
}
},
+ "node_modules/hast-util-parse-selector": {
+ "version": "2.2.5",
+ "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.5.tgz",
+ "integrity": "sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ==",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/hastscript": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-6.0.0.tgz",
+ "integrity": "sha512-nDM6bvd7lIqDUiYEiu5Sl/+6ReP0BMk/2f4U/Rooccxkj0P5nm+acM5PrGJ/t5I8qPGiqZSE6hVAwZEdZIvP4w==",
+ "dependencies": {
+ "@types/hast": "^2.0.0",
+ "comma-separated-tokens": "^1.0.0",
+ "hast-util-parse-selector": "^2.0.0",
+ "property-information": "^5.0.0",
+ "space-separated-tokens": "^1.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/highlight.js": {
+ "version": "10.7.3",
+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",
+ "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==",
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/ignore": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz",
@@ -2830,6 +2943,28 @@
"node": ">=12"
}
},
+ "node_modules/is-alphabetical": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz",
+ "integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/is-alphanumerical": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz",
+ "integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==",
+ "dependencies": {
+ "is-alphabetical": "^1.0.0",
+ "is-decimal": "^1.0.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/is-array-buffer": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz",
@@ -2936,6 +3071,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-decimal": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz",
+ "integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -2990,6 +3134,15 @@
"node": ">=0.10.0"
}
},
+ "node_modules/is-hexadecimal": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz",
+ "integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/is-map": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz",
@@ -3368,6 +3521,19 @@
"loose-envify": "cli.js"
}
},
+ "node_modules/lowlight": {
+ "version": "1.20.0",
+ "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-1.20.0.tgz",
+ "integrity": "sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw==",
+ "dependencies": {
+ "fault": "^1.0.0",
+ "highlight.js": "~10.7.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@@ -3818,6 +3984,23 @@
"node": ">=6"
}
},
+ "node_modules/parse-entities": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz",
+ "integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==",
+ "dependencies": {
+ "character-entities": "^1.0.0",
+ "character-entities-legacy": "^1.0.0",
+ "character-reference-invalid": "^1.0.0",
+ "is-alphanumerical": "^1.0.0",
+ "is-decimal": "^1.0.0",
+ "is-hexadecimal": "^1.0.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
@@ -4101,6 +4284,14 @@
"node": ">=16.13"
}
},
+ "node_modules/prismjs": {
+ "version": "1.29.0",
+ "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz",
+ "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/prop-types": {
"version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
@@ -4111,6 +4302,18 @@
"react-is": "^16.13.1"
}
},
+ "node_modules/property-information": {
+ "version": "5.6.0",
+ "resolved": "https://registry.npmjs.org/property-information/-/property-information-5.6.0.tgz",
+ "integrity": "sha512-YUHSPk+A30YPv+0Qf8i9Mbfe/C0hdPXk1s1jPVToV8pk8BQtpw10ct89Eo7OWkutrwqvT0eicAxlOg3dOAu8JA==",
+ "dependencies": {
+ "xtend": "^4.0.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@@ -4222,6 +4425,21 @@
"react-dom": ">=15.0.0"
}
},
+ "node_modules/react-syntax-highlighter": {
+ "version": "15.5.0",
+ "resolved": "https://registry.npmjs.org/react-syntax-highlighter/-/react-syntax-highlighter-15.5.0.tgz",
+ "integrity": "sha512-+zq2myprEnQmH5yw6Gqc8lD55QHnpKaU8TOcFeC/Lg/MQSs8UknEA0JC4nTZGFAXC2J2Hyj/ijJ7NlabyPi2gg==",
+ "dependencies": {
+ "@babel/runtime": "^7.3.1",
+ "highlight.js": "^10.4.1",
+ "lowlight": "^1.17.0",
+ "prismjs": "^1.27.0",
+ "refractor": "^3.6.0"
+ },
+ "peerDependencies": {
+ "react": ">= 0.14.0"
+ }
+ },
"node_modules/react-transition-group": {
"version": "4.4.5",
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz",
@@ -4307,6 +4525,28 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/refractor": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/refractor/-/refractor-3.6.0.tgz",
+ "integrity": "sha512-MY9W41IOWxxk31o+YvFCNyNzdkc9M20NoZK5vq6jkv4I/uh2zkWcfudj0Q1fovjUQJrNewS9NMzeTtqPf+n5EA==",
+ "dependencies": {
+ "hastscript": "^6.0.0",
+ "parse-entities": "^2.0.0",
+ "prismjs": "~1.27.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/refractor/node_modules/prismjs": {
+ "version": "1.27.0",
+ "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.27.0.tgz",
+ "integrity": "sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
@@ -4558,6 +4798,15 @@
"node": ">=0.10.0"
}
},
+ "node_modules/space-separated-tokens": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz",
+ "integrity": "sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/streamsearch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
@@ -5374,6 +5623,14 @@
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true
},
+ "node_modules/xtend": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
+ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
+ "engines": {
+ "node": ">=0.4"
+ }
+ },
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
diff --git a/src/client/package.json b/src/client/package.json
index 0450a455..87ff0b00 100644
--- a/src/client/package.json
+++ b/src/client/package.json
@@ -21,13 +21,15 @@
"next": "14.0.4",
"next-auth": "^4.24.5",
"react": "^18",
- "react-dom": "^18"
+ "react-dom": "^18",
+ "react-syntax-highlighter": "^15.5.0"
},
"devDependencies": {
"@types/lodash": "^4.14.202",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
+ "@types/react-syntax-highlighter": "^15.5.11",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.4",
diff --git a/src/client/src/app/(auth)/auth-form.tsx b/src/client/src/app/(auth)/auth-form.tsx
index f9f4b1c0..168e25ad 100644
--- a/src/client/src/app/(auth)/auth-form.tsx
+++ b/src/client/src/app/(auth)/auth-form.tsx
@@ -1,7 +1,10 @@
+"use client";
+import { DEFAULT_LOGGED_IN_ROUTE } from "@/constants/route";
import asaw from "@/utils/asaw";
import { signIn } from "next-auth/react";
import Image from "next/image";
import Link from "next/link";
+import { useSearchParams } from "next/navigation";
import { useState } from "react";
const errors = {
@@ -26,6 +29,9 @@ const SignInError = ({ error }: { error: keyof typeof errors }) => {
};
export function AuthForm({ type }: { type: "login" | "register" }) {
+ const searchParams = useSearchParams();
+ const callbackUrl: string =
+ (searchParams.get("callbackUrl") as string) || DEFAULT_LOGGED_IN_ROUTE;
const [error, setError] = useState<string>("");
async function authWrapper(fn: any) {
const [err, response] = await asaw(fn());
@@ -40,12 +46,12 @@ export function AuthForm({ type }: { type: "login" | "register" }) {
return;
}
- window.location.replace("/dashboard");
+ window.location.replace(callbackUrl);
}
async function login(formData: FormData) {
authWrapper(() =>
signIn("login", {
- callbackUrl: "/dashboard",
+ callbackUrl,
email: formData.get("email") as string,
password: formData.get("password") as string,
redirect: false,
@@ -56,7 +62,7 @@ export function AuthForm({ type }: { type: "login" | "register" }) {
async function register(formData: FormData) {
authWrapper(() =>
signIn("register", {
- callbackUrl: "/dashboard",
+ callbackUrl,
email: formData.get("email") as string,
password: formData.get("password") as string,
redirect: false,
diff --git a/src/client/src/app/(playground)/getting-started/page.tsx b/src/client/src/app/(playground)/getting-started/page.tsx
new file mode 100644
index 00000000..960de042
--- /dev/null
+++ b/src/client/src/app/(playground)/getting-started/page.tsx
@@ -0,0 +1,220 @@
+"use client";
+
+import CodeBlock from "@/components/common/code-block";
+import { Tab } from "@headlessui/react";
+
+export default function GettingStarted() {
+ const code = [
+ {
+ key: "python",
+ text: "Python",
+ component: (
+ <div className="flex flex-col border border-secondary text-sm rounded-b-lg p-3 text-tertiary">
+ <p>
+ Install the{" "}
+ <a
+ href="https://pypi.org/project/dokumetry/"
+ className="text-primary/[0.7] hover:text-primary bg-secondary px-1"
+ >
+ dokumetry
+ </a>{" "}
+ python sdk using pip:
+ </p>
+ <CodeBlock
+ className="text-xs"
+ code={`pip install dokumetry`}
+ language="bash"
+ />
+ <p className="mt-2">
+ Add the following two lines to your application code:
+ </p>
+ <CodeBlock
+ className="text-xs"
+ code={`import dokumetry
+dokumetry.init(llm=client, doku_url="YOUR_DOKU_URL", api_key="YOUR_DOKU_TOKEN")`}
+ language="python"
+ />
+ <p className="mt-2">
+ Example Usage for monitoring{" "}
+ <a
+ className="text-primary/[0.7] hover:text-primary bg-secondary px-1"
+ href="https://platform.openai.com/docs/introduction"
+ >
+ OpenAI
+ </a>{" "}
+ Usage:
+ </p>
+ <CodeBlock
+ className="text-xs"
+ code={`from openai import OpenAI
+import dokumetry
+
+client = OpenAI(
+ api_key="YOUR_OPENAI_KEY"
+)
+
+# Pass the above \`client\` object along with your DOKU URL and API key and this will make sure that all OpenAI calls are automatically tracked.
+dokumetry.init(llm=client, doku_url="YOUR_DOKU_URL", api_key="YOUR_DOKU_TOKEN")
+
+chat_completion = client.chat.completions.create(
+ messages=[
+ {
+ "role": "user",
+ "content": "What is LLM Observability",
+ }
+ ],
+ model="gpt-3.5-turbo",
+)`}
+ language="python"
+ />
+ <p className="mt-2">
+ Refer to the{" "}
+ <a
+ className="text-primary/[0.7] hover:text-primary bg-secondary px-1"
+ href="https://github.com/dokulabs/dokumetry-python"
+ >
+ dokumetry python sdk
+ </a>{" "}
+ repository for more advanced configurations and use cases.
+ </p>
+ </div>
+ ),
+ },
+ {
+ key: "node",
+ text: "NodeJs",
+ component: (
+ <div className="flex flex-col border border-secondary text-sm rounded-b-lg p-3 text-tertiary">
+ <p>
+ Install the{" "}
+ <a
+ href="https://www.npmjs.com/package/dokumetry"
+ className="text-primary/[0.7] hover:text-primary bg-secondary px-1"
+ >
+ dokumetry
+ </a>{" "}
+ nodejs sdk using npm:
+ </p>
+ <CodeBlock
+ className="text-xs"
+ code={`npm install dokumetry`}
+ language="bash"
+ />
+ <p className="mt-2">
+ Add the following two lines to your application code:
+ </p>
+ <CodeBlock
+ className="text-xs"
+ code={`import DokuMetry from "dokumetry";
+DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_URL", apiKey: "YOUR_DOKU_TOKEN"});`}
+ language="javascript"
+ />
+ <p className="mt-2">
+ Example Usage for monitoring{" "}
+ <a
+ className="text-primary/[0.7] hover:text-primary bg-secondary px-1"
+ href="https://platform.openai.com/docs/introduction"
+ >
+ OpenAI
+ </a>{" "}
+ Usage:
+ </p>
+ <CodeBlock
+ className="text-xs"
+ code={`import OpenAI from "openai";
+import DokuMetry from "dokumetry";
+
+const openai = new OpenAI({
+ apiKey: "My API Key", // defaults to process.env["OPENAI_API_KEY"]
+});
+
+// Pass the above \`openai\` object along with your DOKU URL and API key and this will make sure that all OpenAI calls are automatically tracked.
+DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_URL", apiKey: "YOUR_DOKU_TOKEN"})
+
+async function main() {
+ const chatCompletion = await openai.chat.completions.create({
+ messages: [{ role: "user", content: "What are the key to effective observability?" }],
+ model: "gpt-3.5-turbo",
+ });
+}
+
+main();`}
+ language="javascript"
+ />
+ <p className="mt-2">
+ Refer to the{" "}
+ <a
+ className="text-primary/[0.7] hover:text-primary bg-secondary px-1"
+ href="https://github.com/dokulabs/dokumetry-node"
+ >
+ dokumetry nodejs sdk
+ </a>{" "}
+ repository for more advanced configurations and use cases.
+ </p>
+ </div>
+ ),
+ },
+ ];
+
+ return (
+ <div className="flex flex-col w-full flex-1 overflow-auto relative">
+ <p className="mb-5 text-sm font-medium border-l-4 border-primary p-3 text-primary bg-secondary/[0.5]">
+ Doku is an open-source observability tool engineered for Large Language
+ Models (LLMs). Designed for ease of integration into existing LLM
+ applications, Doku offers unparalleled insights into usage, performance,
+ and overhead—allowing you to analyze, optimize, and scale your AI
+ applications and LLM usage effectively.
+ </p>
+ <p className="mb-5 text-tertiary text-sm">
+ With the <span className="text-primary">dokumetry</span> SDKs for
+ <a
+ href="https://pypi.org/project/dokumetry/"
+ className="text-primary/[0.7] hover:text-primary bg-secondary px-1"
+ >
+ Python
+ </a>{" "}
+ and{" "}
+ <a
+ href="https://www.npmjs.com/package/dokumetry"
+ className="text-primary/[0.7] hover:text-primary bg-secondary px-1"
+ >
+ NodeJS
+ </a>{" "}
+ , sending observability data to Doku is just two lines of code in your
+ application. Once integrated, the SDKs take care of capturing and
+ conveying LLM usage data directly to your Doku instance, requiring
+ minimal effort on your part.
+ </p>
+ <div className="w-full">
+ <Tab.Group>
+ <Tab.List className="flex space-x-1 bg-white sticky top-0 z-20">
+ {code.map((item) => (
+ <Tab
+ key={item.key}
+ className={({ selected }) =>
+ `w-auto py-2 px-3 text-sm font-medium leading-5 outline-none border-b-2 ${
+ selected
+ ? "text-primary border-primary"
+ : "text-tertiary/[0.3] border-white"
+ }`
+ }
+ >
+ {item.text}
+ </Tab>
+ ))}
+ </Tab.List>
+ <Tab.Panels className="w-full mt-3">
+ {code.map((item, idx) => (
+ <Tab.Panel
+ key={idx}
+ className={`rounded-xl bg-white outline-none`}
+ >
+ {item.component}
+ </Tab.Panel>
+ ))}
+ </Tab.Panels>
+ </Tab.Group>
+ </div>
+ </div>
+ );
+}
diff --git a/src/client/src/components/(playground)/sidebar.tsx b/src/client/src/components/(playground)/sidebar.tsx
index 07ec0436..817345fe 100644
--- a/src/client/src/components/(playground)/sidebar.tsx
+++ b/src/client/src/components/(playground)/sidebar.tsx
@@ -3,6 +3,7 @@
import { signOut } from "next-auth/react";
import { ReactElement } from "react";
import {
+ AcademicCapIcon,
CircleStackIcon,
HomeModernIcon,
KeyIcon,
@@ -22,6 +23,11 @@ const ICON_CLASSES =
"flex-shrink-0 w-6 h-6 transition duration-75 transition duration-75";
const SIDEBAR_ITEMS: SidebarItemProps[] = [
+ {
+ icon: <AcademicCapIcon className={ICON_CLASSES} />,
+ text: "Getting started",
+ link: "/getting-started",
+ },
{
icon: <HomeModernIcon className={ICON_CLASSES} />,
text: "Dashboard",
@@ -97,7 +103,7 @@ export default function Sidebar() {
className={
item.link === pathname
? "border-r-4 border-primary text-primary bg-primary/[.09]"
- : "text-tertiary"
+ : "text-tertiary/[0.9] hover:text-primary"
}
{...item}
/>
diff --git a/src/client/src/components/common/code-block.tsx b/src/client/src/components/common/code-block.tsx
new file mode 100644
index 00000000..f74df3e6
--- /dev/null
+++ b/src/client/src/components/common/code-block.tsx
@@ -0,0 +1,36 @@
+import { DocumentDuplicateIcon } from "@heroicons/react/24/outline";
+import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
+import { dracula } from "react-syntax-highlighter/dist/esm/styles/prism";
+import copyToCB from "copy-to-clipboard";
+
+export default function CodeBlock({
+ className = "",
+ code,
+ copy = true,
+ language,
+}: {
+ className?: string;
+ code: string;
+ copy?: boolean;
+ language: string;
+}) {
+ const onClickCopy = () => copyToCB(code);
+
+ return (
+ <section className="relative group">
+ <SyntaxHighlighter
+ language={language}
+ style={dracula}
+ className={`overflow-hidden ${className}`}
+ >
+ {code}
+ </SyntaxHighlighter>
+ {copy && (
+ <DocumentDuplicateIcon
+ className="w-4 h-4 absolute right-3 top-4 hidden group-hover:inline-block z-10 text-secondary hover:text-primary cursor-pointer"
+ onClick={onClickCopy}
+ />
+ )}
+ </section>
+ );
+}
diff --git a/src/client/src/constants/route.ts b/src/client/src/constants/route.ts
new file mode 100644
index 00000000..c053b2bf
--- /dev/null
+++ b/src/client/src/constants/route.ts
@@ -0,0 +1 @@
+export const DEFAULT_LOGGED_IN_ROUTE = "/getting-started";
diff --git a/src/client/src/middleware.ts b/src/client/src/middleware.ts
index db4e70f4..4f8c4087 100644
--- a/src/client/src/middleware.ts
+++ b/src/client/src/middleware.ts
@@ -1,6 +1,7 @@
import { getToken } from "next-auth/jwt";
import { withAuth } from "next-auth/middleware";
import { NextResponse } from "next/server";
+import { DEFAULT_LOGGED_IN_ROUTE } from "@/constants/route";
export default withAuth(
async function middleware(req) {
@@ -20,7 +21,7 @@ export default withAuth(
if (isAuthPage) {
if (isAuth) {
- return NextResponse.redirect(new URL("/dashboard", req.url));
+ return NextResponse.redirect(new URL(DEFAULT_LOGGED_IN_ROUTE, req.url));
}
return null;
@@ -60,6 +61,7 @@ export const config = {
"/api/:path*",
"/login",
"/register",
+ "/getting-started",
"/dashboard",
"/api-keys",
"/requests",
diff --git a/src/client/tsconfig.json b/src/client/tsconfig.json
index 82ce3382..e7892053 100644
--- a/src/client/tsconfig.json
+++ b/src/client/tsconfig.json
@@ -23,7 +23,8 @@
"@/lib/*": ["./src/lib/*"],
"@/components/*": ["./src/components/*"],
"@/prisma/*": ["./prisma/*"],
- "@/utils/*": ["./src/utils/*"]
+ "@/utils/*": ["./src/utils/*"],
+ "@/constants/*": ["./src/constants/*"],
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],