From 3cf05d7fbd8f4c91301866b4641b133fd56f92db Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Sat, 13 Apr 2024 11:50:26 +0530 Subject: [PATCH 01/43] Install @vercel/og and created route for OG image responce --- package.json | 1 + src/app/api/og/route.tsx | 23 ++++++++++ src/app/dashboard/[slug]/page.tsx | 12 ++++++ src/app/page.tsx | 6 ++- src/components/chatcard.tsx | 3 +- src/components/search.tsx | 63 ++++++++++++++------------- src/utils/apiHelper.ts | 72 ------------------------------- 7 files changed, 75 insertions(+), 105 deletions(-) create mode 100644 src/app/api/og/route.tsx diff --git a/package.json b/package.json index 59b8e18f..a4223e49 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "@uidotdev/usehooks": "^2.4.1", "@uploadthing/react": "5.2.0", "@upstash/redis": "^1.24.3", + "@vercel/og": "^0.6.2", "ably": "^1.2.48", "ai": "2.2.20", "algoliasearch": "^4.20.0", diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx new file mode 100644 index 00000000..972566aa --- /dev/null +++ b/src/app/api/og/route.tsx @@ -0,0 +1,23 @@ +import { ImageResponse } from "next/og"; + +export const runtime = "edge"; + +export async function GET(request: Request) { + try { + const { searchParams } = new URL(request.url); + + // ?title= + const hasTitle = searchParams.has('title'); + const title = hasTitle + ? searchParams.get('title')?.slice(0, 100) + : 'My default title'; + return new ImageResponse( + (<div>{title}</div>) + ) + + } catch (e) { + return new Response("Failed to generate the image", { + status: 500 + }); + } +} diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index 12a30ab4..fc674d21 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -1,6 +1,7 @@ import { Button } from "@/components/button"; import Link from "next/link"; import { db } from "@/lib/db"; +import { Metadata } from "next"; import { chats, Chat as ChatSchema } from "@/lib/db/schema"; import { eq, desc, ne, and } from "drizzle-orm"; import { auth } from "@clerk/nextjs"; @@ -10,6 +11,17 @@ import ChatCardWrapper from "@/components/chatcardwrapper"; export const dynamic = "force-dynamic", revalidate = 0; + + export const metadata: Metadata = { + openGraph: { + images: [{ + url: "http://localhost:3000/api/og?title=HelloWorld", + width: 1200, + height: 630, + alt: "Hello" + }] + } + } export default async function Page({ params, searchParams, diff --git a/src/app/page.tsx b/src/app/page.tsx index 7842b9a6..f94d52c3 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,5 +1,4 @@ "use client"; - import { useEffect } from "react"; import { Header } from "@/components/header"; import { Button, buttonVariants } from "@/components/button"; @@ -10,6 +9,11 @@ import { motion, AnimatePresence, useAnimation } from "framer-motion"; import { useInView } from "react-intersection-observer"; import { Key, LayoutDashboard } from "lucide-react"; import { useAuth } from "@clerk/nextjs"; + + + + + const handleSmoothScroll = (): void => { if (typeof window !== "undefined") { const hashId = window.location.hash; diff --git a/src/components/chatcard.tsx b/src/components/chatcard.tsx index 3448c3c9..9b8dc7ad 100644 --- a/src/components/chatcard.tsx +++ b/src/components/chatcard.tsx @@ -100,7 +100,8 @@ const Chatcard = ({ chat, uid, org_id, org_slug, priority, type }: Props) => { const chatlog = JSON.parse(msg as string) as ChatLog; const firstMessage = chatlog.log[0].content; const chatTitle = chat.title || firstMessage; - + + console.log("chatCard chat",chatlog); // extracts chatentry from chatlog const chats = JSON.parse(chat.messages as string) as ChatLog; const userIds = getUserIdList(chats.log); diff --git a/src/components/search.tsx b/src/components/search.tsx index fc628106..eb39a9de 100644 --- a/src/components/search.tsx +++ b/src/components/search.tsx @@ -56,13 +56,14 @@ const Search = (props: Props) => { }, []); // open command bar with / key useEffect(() => { + // console.log("throttledValue", throttledValue); index .search(throttledValue, { hitsPerPage: 8, filters: `orgSlug: "${props.orgSlug}"`, }) .then((response) => { - console.log(response); + console.log(" search responce", response); return setResults(response.hits); }); }, [throttledValue]); @@ -71,7 +72,7 @@ const Search = (props: Props) => { <CommandDialog open={showSearchDialog} onOpenChange={toggleSearchDialog}> <CommandInput onValueChange={(val) => { - console.log("got the input value"); + console.log("got the input value", val); setValue(val); }} value={value} @@ -100,35 +101,35 @@ const Search = (props: Props) => { <CommandGroup heading="Chat History"> {results.length ? results.map((result: any, index: number) => ( - <CommandItem key={index}> - <Link - href={ - result.id - ? `/dashboard/${props.orgSlug}/chat/${result.chatId}/#${result.id}` - : `/dashboard/${props.orgSlug}/chat/${result.chatId}` - } // needs to be updated - onClick={toggleSearchDialog} - key={result.objectID} - className="flex gap-2 grow justify-between" - > - <div> - <p className="text-md text-muted-foreground"> - {result.chatTitle - .replace('"', "") - .replace('"', "") - .split(" ") - .slice(0, 5) - .join(" ")} - {" (" + timestampToDate(result.updatedAt)}) - </p> - <p className="line-clamp-1 text-sm"> - {result.content ? result.content : null} - </p> - </div> - <UserAvatar role={result.role} userData={result.name} /> - </Link> - </CommandItem> - )) + <CommandItem key={index}> + <Link + href={ + result.id + ? `/dashboard/${props.orgSlug}/chat/${result.chatId}/#${result.id}` + : `/dashboard/${props.orgSlug}/chat/${result.chatId}` + } // needs to be updated + onClick={toggleSearchDialog} + key={result.objectID} + className="flex gap-2 grow justify-between" + > + <div> + <p className="text-md text-muted-foreground"> + {result.chatTitle + .replace('"', "") + .replace('"', "") + .split(" ") + .slice(0, 5) + .join(" ")} + {" (" + timestampToDate(result.updatedAt)}) + </p> + <p className="line-clamp-1 text-sm"> + {result.content ? result.content : null} + </p> + </div> + <UserAvatar role={result.role} userData={result.name} /> + </Link> + </CommandItem> + )) : null} </CommandGroup> {/* diff --git a/src/utils/apiHelper.ts b/src/utils/apiHelper.ts index 4ea4d238..8410e9f8 100644 --- a/src/utils/apiHelper.ts +++ b/src/utils/apiHelper.ts @@ -685,75 +685,3 @@ export const saveToDB = async ({ console.log("error in saving to db", error); } }; - -// export const saveToDBForImage = async ({ -// _chat, -// chatId, -// orgSlug, -// latestResponse, -// userId, -// urlArray, -// orgId, -// }: { -// latestResponse: ChatEntry; -// _chat: ChatEntry[]; -// chatId: number; -// orgSlug: string; -// orgId: string; -// userId: string; -// urlArray: string[]; -// }) => { -// try { -// if (_chat.length === 1) { -// console.log("got in 1 length case"); -// _chat.push(latestResponse); -// // step for generating title and adding to search index -// axios.post(`https://zeplo.to/step?_token=${env.ZEPLO_TOKEN}`, [ -// { -// url: `https://${urlArray[2]}/api/generateTitle/${chatId}/${orgId}?_step=A`, -// body: JSON.stringify({ chat: _chat }), -// headers: { -// "x-zeplo-secret": env.ZEPLO_SECRET, -// }, -// }, -// { -// url: `https://${urlArray[2]}/api/addToSearch?_step=B&_requires=A`, -// body: JSON.stringify({ -// chats: _chat, -// chatId: chatId, -// orgSlug: orgSlug as string, -// }), -// headers: { -// "x-zeplo-secret": env.ZEPLO_SECRET, -// }, -// }, -// ]); -// await db -// .update(chats) -// .set({ -// messages: JSON.stringify({ log: _chat } as ChatLog), -// creator: userId, -// }) -// .where(eq(chats.id, chatId)) -// .run(); -// } else { -// _chat.push(latestResponse); -// postToAlgolia({ -// chats: [_chat[_chat.length - 2], latestResponse], -// chatId: chatId, -// orgSlug: orgSlug as string, -// urlArray: urlArray, -// }); // add to search index -// await db -// .update(chats) -// .set({ -// messages: JSON.stringify({ log: _chat }), -// updatedAt: new Date(), -// }) -// .where(eq(chats.id, chatId)) -// .run(); -// } -// } catch (error) { -// console.log("error in saving to db", error); -// } -// }; From 02a3708c66b7de23c7d223ea76c1c2083ea0ee9a Mon Sep 17 00:00:00 2001 From: Rohittomar01 <rohittomar9285@gmail.com> Date: Sat, 13 Apr 2024 13:00:29 +0530 Subject: [PATCH 02/43] in layout page mata data content url changed and lint fixed --- src/app/api/og/route.tsx | 82 +++++++++++++++++++++++++------ src/app/dashboard/[slug]/page.tsx | 17 ++++--- src/app/layout.tsx | 7 +-- src/app/page.tsx | 4 -- src/components/chatcard.tsx | 4 +- src/components/search.tsx | 58 +++++++++++----------- 6 files changed, 109 insertions(+), 63 deletions(-) diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index 972566aa..18529287 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -1,23 +1,75 @@ import { ImageResponse } from "next/og"; +// App router includes @vercel/og. +// No need to install it. export const runtime = "edge"; export async function GET(request: Request) { - try { - const { searchParams } = new URL(request.url); + try { + const { searchParams } = new URL(request.url); - // ?title=<title> - const hasTitle = searchParams.has('title'); - const title = hasTitle - ? searchParams.get('title')?.slice(0, 100) - : 'My default title'; - return new ImageResponse( - (<div>{title}</div>) - ) + const hasTitle = searchParams.has("title"); + const title = hasTitle + ? searchParams.get("title")?.slice(0, 100) + : "My default title"; - } catch (e) { - return new Response("Failed to generate the image", { - status: 500 - }); - } + return new ImageResponse( + ( + <div + style={{ + backgroundColor: "black", + backgroundSize: "150px 150px", + height: "100%", + width: "100%", + display: "flex", + textAlign: "center", + alignItems: "center", + justifyContent: "center", + flexDirection: "column", + flexWrap: "nowrap", + }} + > + <div + style={{ + display: "flex", + alignItems: "center", + justifyContent: "center", + justifyItems: "center", + }} + > + <img + alt="Vercel" + height={200} + src="data:image/svg+xml,%3Csvg width='116' height='100' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M57.5 0L115 100H0L57.5 0z' /%3E%3C/svg%3E" + style={{ margin: "0 30px" }} + width={232} + /> + </div> + <div + style={{ + fontSize: 60, + fontStyle: "normal", + letterSpacing: "-0.025em", + color: "white", + marginTop: 30, + padding: "0 120px", + lineHeight: 1.4, + whiteSpace: "pre-wrap", + }} + > + {title} + </div> + </div> + ), + { + width: 1200, + height: 630, + }, + ); + } catch (e: any) { + console.log(`${e.message}`); + return new Response(`Failed to generate the image`, { + status: 500, + }); + } } diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index fc674d21..a3cafc9f 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -11,17 +11,18 @@ import ChatCardWrapper from "@/components/chatcardwrapper"; export const dynamic = "force-dynamic", revalidate = 0; - - export const metadata: Metadata = { - openGraph: { - images: [{ +export const metadata: Metadata = { + openGraph: { + images: [ + { url: "http://localhost:3000/api/og?title=HelloWorld", width: 1200, height: 630, - alt: "Hello" - }] - } - } + alt: "Hello", + }, + ], + }, +}; export default async function Page({ params, searchParams, diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 093a56a9..8e1d8cf5 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -243,11 +243,8 @@ export default function RootLayout({ content="Collaborative Platform for Researchers. Designed for Humans and AIs." /> <meta property="og:site_name" content="Echoes" /> - <meta property="og:url" content="https://echoes.team" /> - <meta - property="og:image" - content="https://echoes.team/apple-icon-180.png" - /> + <meta property="og:url" content="https://echoes.team/api/og" /> + <meta property="og:image" content="https://echoes.team/api/og" /> <title>Echoes diff --git a/src/app/page.tsx b/src/app/page.tsx index f94d52c3..e70b6b7f 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -10,10 +10,6 @@ import { useInView } from "react-intersection-observer"; import { Key, LayoutDashboard } from "lucide-react"; import { useAuth } from "@clerk/nextjs"; - - - - const handleSmoothScroll = (): void => { if (typeof window !== "undefined") { const hashId = window.location.hash; diff --git a/src/components/chatcard.tsx b/src/components/chatcard.tsx index 9b8dc7ad..bf4b577f 100644 --- a/src/components/chatcard.tsx +++ b/src/components/chatcard.tsx @@ -100,8 +100,8 @@ const Chatcard = ({ chat, uid, org_id, org_slug, priority, type }: Props) => { const chatlog = JSON.parse(msg as string) as ChatLog; const firstMessage = chatlog.log[0].content; const chatTitle = chat.title || firstMessage; - - console.log("chatCard chat",chatlog); + + console.log("chatCard chat", chatlog); // extracts chatentry from chatlog const chats = JSON.parse(chat.messages as string) as ChatLog; const userIds = getUserIdList(chats.log); diff --git a/src/components/search.tsx b/src/components/search.tsx index eb39a9de..c3c8d9d5 100644 --- a/src/components/search.tsx +++ b/src/components/search.tsx @@ -101,35 +101,35 @@ const Search = (props: Props) => { {results.length ? results.map((result: any, index: number) => ( - - -
-

- {result.chatTitle - .replace('"', "") - .replace('"', "") - .split(" ") - .slice(0, 5) - .join(" ")} - {" (" + timestampToDate(result.updatedAt)}) -

-

- {result.content ? result.content : null} -

-
- - -
- )) + + +
+

+ {result.chatTitle + .replace('"', "") + .replace('"', "") + .split(" ") + .slice(0, 5) + .join(" ")} + {" (" + timestampToDate(result.updatedAt)}) +

+

+ {result.content ? result.content : null} +

+
+ + +
+ )) : null}
{/* From f4d71f01cf1c366ab39279f0ada55a55836c493e Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Sat, 13 Apr 2024 13:50:35 +0530 Subject: [PATCH 03/43] content="https://echoes-git-og-image-tcr.vercel.app/api/og" --- src/app/layout.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 8e1d8cf5..cb832331 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -243,8 +243,14 @@ export default function RootLayout({ content="Collaborative Platform for Researchers. Designed for Humans and AIs." /> - - + + Echoes From eb3fb00b2017fa061da50d546e808c0513d61263 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Sat, 13 Apr 2024 14:09:27 +0530 Subject: [PATCH 04/43] For check use external image --- src/app/layout.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index cb832331..249ed29e 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -243,14 +243,8 @@ export default function RootLayout({ content="Collaborative Platform for Researchers. Designed for Humans and AIs." /> - - + + Echoes From 744a5ad9fcbf9db8fcfe7985ceefe5a5b344935b Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Sat, 13 Apr 2024 14:23:39 +0530 Subject: [PATCH 05/43] https://www.echoes.team/api/og changed and lint fix --- src/app/layout.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 249ed29e..dc4b9431 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -243,8 +243,8 @@ export default function RootLayout({ content="Collaborative Platform for Researchers. Designed for Humans and AIs." /> - - + + Echoes From b0ab4fb319483848e7b35749894be46764da0299 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Sun, 14 Apr 2024 18:05:04 +0530 Subject: [PATCH 06/43] create metadata in chat page --- src/app/dashboard/[slug]/chat/[chatid]/page.tsx | 14 ++++++++++++++ src/app/dashboard/[slug]/page.tsx | 5 +++-- src/app/layout.tsx | 6 +++--- src/app/robots.tsx | 12 ++++++++++++ src/app/robusts.txt | 5 +++++ 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 src/app/robots.tsx create mode 100644 src/app/robusts.txt diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index dd9b2309..0768ce29 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -1,5 +1,6 @@ import { ChatLog, ChatType } from "@/lib/types"; import { db } from "@/lib/db"; +import { Metadata } from "next"; import { redirect } from "next/navigation"; import { Chat as ChatSchema, chats } from "@/lib/db/schema"; import { eq, and } from "drizzle-orm"; @@ -9,6 +10,19 @@ import { AblyChannelProvider } from "@/components/ablyprovider"; export const dynamic = "force-dynamic", revalidate = 0; +export const metadata: Metadata = { + openGraph: { + images: [ + { + url: "https://echoes.team/api/og?title=chat kro veere chat id ", + width: 1200, + height: 630, + alt: "echoes image", + }, + ], + }, +}; + export default async function Page({ params, }: { diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index a3cafc9f..ea3d0b75 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -15,14 +15,15 @@ export const metadata: Metadata = { openGraph: { images: [ { - url: "http://localhost:3000/api/og?title=HelloWorld", + url: "https://www.echoes.team/api/og?title=chat kro veere slug", width: 1200, height: 630, - alt: "Hello", + alt: "echoes image", }, ], }, }; + export default async function Page({ params, searchParams, diff --git a/src/app/layout.tsx b/src/app/layout.tsx index dc4b9431..21704df7 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -10,7 +10,7 @@ import { Providers } from "@/app/providers"; const inter = Inter({ subsets: ["latin"] }); export const metadata = { - title: "Echoes", + title: "Echoe", description: "Seek using Research Agents", manifest: "/manifest.json", viewport: @@ -244,9 +244,9 @@ export default function RootLayout({ /> - + - Echoes + {/* Echoes */} diff --git a/src/app/robots.tsx b/src/app/robots.tsx new file mode 100644 index 00000000..e2cfa46e --- /dev/null +++ b/src/app/robots.tsx @@ -0,0 +1,12 @@ +import { MetadataRoute } from "next"; + +export default function robots(): MetadataRoute.Robots { + return { + rules: { + userAgent: "*", + allow: "/api/og/*", + disallow: "/private/", + }, + sitemap: "https://acme.com/sitemap.xml", + }; +} diff --git a/src/app/robusts.txt b/src/app/robusts.txt new file mode 100644 index 00000000..a098a4d2 --- /dev/null +++ b/src/app/robusts.txt @@ -0,0 +1,5 @@ +User-Agent: * +Allow: /api/og/* +Disallow: /private/ + +Sitemap: https://acme.com/sitemap.xml \ No newline at end of file From 08dd9a4aadb359899c74daff3d11c25cc79beb1a Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Sun, 14 Apr 2024 23:45:52 +0530 Subject: [PATCH 07/43] use metadata tag in layout or page --- src/app/api/og/route.tsx | 1 + .../dashboard/[slug]/chat/[chatid]/page.tsx | 15 ++++++++---- src/app/dashboard/[slug]/page.tsx | 14 +++++++---- src/app/layout.tsx | 23 ++++++++++++++++--- 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index 18529287..e431c8a1 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -8,6 +8,7 @@ export async function GET(request: Request) { try { const { searchParams } = new URL(request.url); + // ?title= const hasTitle = searchParams.has("title"); const title = hasTitle ? searchParams.get("title")?.slice(0, 100) diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index 0768ce29..300d800c 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -7,19 +7,26 @@ import { eq, and } from "drizzle-orm"; import { auth, currentUser } from "@clerk/nextjs"; import RoomWrapper from "@/components/room"; import { AblyChannelProvider } from "@/components/ablyprovider"; + export const dynamic = "force-dynamic", revalidate = 0; export const metadata: Metadata = { openGraph: { + title: "Next.js", + description: "The React Framework for the Web", + url: "https://nextjs.org", + siteName: "Next.js", images: [ { - url: "https://echoes.team/api/og?title=chat kro veere chat id ", - width: 1200, - height: 630, - alt: "echoes image", + url: "https://buffer.com/library/content/images/size/w1200/2023/10/free-images.jpg", // Must be an absolute URL + width: 1800, + height: 1600, + alt: "My custom alt", }, ], + locale: "en_US", + type: "website", }, }; diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index ea3d0b75..478a459d 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -13,14 +13,20 @@ export const dynamic = "force-dynamic", export const metadata: Metadata = { openGraph: { + title: "Next.js", + description: "The React Framework for the Web", + url: "https://nextjs.org", + siteName: "Next.js", images: [ { - url: "https://www.echoes.team/api/og?title=chat kro veere slug", - width: 1200, - height: 630, - alt: "echoes image", + url: "https://buffer.com/library/content/images/size/w1200/2023/10/free-images.jpg", // Must be an absolute URL + width: 1800, + height: 1600, + alt: "My custom alt", }, ], + locale: "en_US", + type: "website", }, }; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 21704df7..6c2ed9eb 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -10,11 +10,28 @@ import { Providers } from "@/app/providers"; const inter = Inter({ subsets: ["latin"] }); export const metadata = { - title: "Echoe", + title: "Echoes", description: "Seek using Research Agents", manifest: "/manifest.json", viewport: "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", + openGraph: { + title: "Next.js", + description: "The React Framework for the Web", + url: "https://nextjs.org", + siteName: "Next.js", + images: [ + { + // url:'https//echoes.team/api/og?title=Hello brother', + url: "https://buffer.com/library/content/images/size/w1200/2023/10/free-images.jpg", // Must be an absolute URL + width: 1800, + height: 1600, + alt: "My custom alt", + }, + ], + locale: "en_US", + type: "website", + }, }; export default function RootLayout({ @@ -236,7 +253,7 @@ export default function RootLayout({ content="https://echoes.team/android-chrome-192x192.png" /> <meta name="twitter:creator" content="@satiyum" /> - <meta property="og:type" content="website" /> + {/* <meta property="og:type" content="website" /> <meta property="og:title" content="Echoes" /> <meta property="og:description" @@ -244,7 +261,7 @@ export default function RootLayout({ /> <meta property="og:site_name" content="Echoes" /> <meta property="og:url" content="https://www.echoes.team/api/og" /> - <meta property="og:image" content="https://echoes.team/3000/api/og" /> + <meta property="og:image" content="https://echoes.team/api/og" /> */} {/* <title>Echoes */} From 44606fbdc24b501e0ae2c9ac6cd3f0b20b339660 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Mon, 15 Apr 2024 00:30:52 +0530 Subject: [PATCH 08/43] used generatemetadata function --- .../dashboard/[slug]/chat/[chatid]/page.tsx | 7 +-- src/app/dashboard/[slug]/page.tsx | 54 ++++++++++++------- src/app/layout.tsx | 13 ++--- 3 files changed, 47 insertions(+), 27 deletions(-) diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index 300d800c..862c1f88 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -13,12 +13,13 @@ export const dynamic = "force-dynamic", export const metadata: Metadata = { openGraph: { - title: "Next.js", + title: "Echoes", description: "The React Framework for the Web", - url: "https://nextjs.org", - siteName: "Next.js", + url: "https://echoes.team", + siteName: "Echoes", images: [ { + // url:'https//echoes.team/api/og?title=Hello brother', url: "https://buffer.com/library/content/images/size/w1200/2023/10/free-images.jpg", // Must be an absolute URL width: 1800, height: 1600, diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index 478a459d..221dff02 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -1,7 +1,7 @@ import { Button } from "@/components/button"; import Link from "next/link"; import { db } from "@/lib/db"; -import { Metadata } from "next"; +import { Metadata, ResolvingMetadata } from "next"; import { chats, Chat as ChatSchema } from "@/lib/db/schema"; import { eq, desc, ne, and } from "drizzle-orm"; import { auth } from "@clerk/nextjs"; @@ -11,25 +11,43 @@ import ChatCardWrapper from "@/components/chatcardwrapper"; export const dynamic = "force-dynamic", revalidate = 0; -export const metadata: Metadata = { - openGraph: { - title: "Next.js", - description: "The React Framework for the Web", - url: "https://nextjs.org", - siteName: "Next.js", - images: [ - { - url: "https://buffer.com/library/content/images/size/w1200/2023/10/free-images.jpg", // Must be an absolute URL - width: 1800, - height: 1600, - alt: "My custom alt", - }, - ], - locale: "en_US", - type: "website", - }, +type Props = { + params: { id: string }; + searchParams: { [key: string]: string | string[] | undefined }; }; +export async function generateMetadata( + { params, searchParams }: Props, + parent: ResolvingMetadata, +): Promise { + // read route params + const id = params.id; + console.log("params", params); + console.log("searchParams", searchParams); + + // fetch data + + return { + openGraph: { + title: "Echoes", + description: "The React Framework for the Web", + url: "https://echoes.team", + siteName: "Echoes", + images: [ + { + url: "https//www.echoes.team/api/og?title=Hello brother", + // url: "https://buffer.com/library/content/images/size/w1200/2023/10/free-images.jpg", // Must be an absolute URL + width: 1800, + height: 1600, + alt: "My custom alt", + }, + ], + locale: "en_US", + type: "website", + }, + }; +} + export default async function Page({ params, searchParams, diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6c2ed9eb..4a0f9abe 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -16,14 +16,15 @@ export const metadata = { viewport: "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", openGraph: { - title: "Next.js", - description: "The React Framework for the Web", - url: "https://nextjs.org", - siteName: "Next.js", + title: "Echoes", + description: + "Collaborative Platform for Researchers. Designed for Humans and AIs.", + url: "https://echoes.team", + siteName: "Echoes", images: [ { - // url:'https//echoes.team/api/og?title=Hello brother', - url: "https://buffer.com/library/content/images/size/w1200/2023/10/free-images.jpg", // Must be an absolute URL + // url:'https//api/og?title=Hello brother', + url: "https://private-user-images.githubusercontent.com/33483920/265264171-292d4969-ecda-4799-b032-cc256dcd872c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTMwOTY3MzUsIm5iZiI6MTcxMzA5NjQzNSwicGF0aCI6Ii8zMzQ4MzkyMC8yNjUyNjQxNzEtMjkyZDQ5NjktZWNkYS00Nzk5LWIwMzItY2MyNTZkY2Q4NzJjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDE0VDEyMDcxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNhYTU4MGJlZGQwYTI1OTMzM2UwZDNiZmEyNGY2OGU5MGY5MTg4YTc1NDU5NTkxNGI1MzlhZDZiYmY4MDg5MjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.AiAHiYIJjan6mdQmnhW5_OVTXvwdCGd5z0xXl6S8nHk", // Must be an absolute URL width: 1800, height: 1600, alt: "My custom alt", From 9ab652305f4d0d31083826cc0c6eddd829c829ee Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Mon, 15 Apr 2024 00:47:29 +0530 Subject: [PATCH 09/43] changed the url of image --- src/app/dashboard/[slug]/chat/[chatid]/page.tsx | 5 +++-- src/app/dashboard/[slug]/page.tsx | 11 +++++------ src/app/layout.tsx | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index 862c1f88..35b642c9 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -14,13 +14,14 @@ export const dynamic = "force-dynamic", export const metadata: Metadata = { openGraph: { title: "Echoes", - description: "The React Framework for the Web", + description: + "Collaborative Platform for Researchers. Designed for Humans and AIs.", url: "https://echoes.team", siteName: "Echoes", images: [ { // url:'https//echoes.team/api/og?title=Hello brother', - url: "https://buffer.com/library/content/images/size/w1200/2023/10/free-images.jpg", // Must be an absolute URL + url: "https://0901.static.prezi.com/preview/v2/hxsohg2f6zal6vcgzqdlh4lsfx6jc3sachvcdoaizecfr3dnitcq_3_0.png", // Must be an absolute URL width: 1800, height: 1600, alt: "My custom alt", diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index 221dff02..38066c13 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -28,15 +28,14 @@ export async function generateMetadata( // fetch data return { + title: "Echoes", + description: + "Collaborative Platform for Researchers. Designed for Humans and AIs.", openGraph: { - title: "Echoes", - description: "The React Framework for the Web", - url: "https://echoes.team", - siteName: "Echoes", images: [ { - url: "https//www.echoes.team/api/og?title=Hello brother", - // url: "https://buffer.com/library/content/images/size/w1200/2023/10/free-images.jpg", // Must be an absolute URL + // url: "https//www.echoes.team/api/og?title=Hello brother", + url: "https://0901.static.prezi.com/preview/v2/hxsohg2f6zal6vcgzqdlh4lsfx6jc3sachvcdoaizecfr3dnitcq_3_0.png", // Must be an absolute URL width: 1800, height: 1600, alt: "My custom alt", diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 4a0f9abe..cfb21212 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -24,7 +24,7 @@ export const metadata = { images: [ { // url:'https//api/og?title=Hello brother', - url: "https://private-user-images.githubusercontent.com/33483920/265264171-292d4969-ecda-4799-b032-cc256dcd872c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTMwOTY3MzUsIm5iZiI6MTcxMzA5NjQzNSwicGF0aCI6Ii8zMzQ4MzkyMC8yNjUyNjQxNzEtMjkyZDQ5NjktZWNkYS00Nzk5LWIwMzItY2MyNTZkY2Q4NzJjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDE0VDEyMDcxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNhYTU4MGJlZGQwYTI1OTMzM2UwZDNiZmEyNGY2OGU5MGY5MTg4YTc1NDU5NTkxNGI1MzlhZDZiYmY4MDg5MjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.AiAHiYIJjan6mdQmnhW5_OVTXvwdCGd5z0xXl6S8nHk", // Must be an absolute URL + url: "https://media.licdn.com/dms/image/C560BAQG1AcH3R1tVQA/company-logo_200_200/0/1630661181669?e=2147483647&v=beta&t=UcvY6346uivc84MbUXi7IaPcPNJz9Wd5isemdDWMydI", // Must be an absolute URL width: 1800, height: 1600, alt: "My custom alt", From fb30a739b239cffb1761e2eab6cd27e431941944 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Mon, 15 Apr 2024 01:22:31 +0530 Subject: [PATCH 10/43] I tried to generate dynamic title --- .../dashboard/[slug]/chat/[chatid]/page.tsx | 51 ++++++++++++------- src/app/dashboard/[slug]/page.tsx | 6 +-- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index 35b642c9..e600017d 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -1,6 +1,6 @@ import { ChatLog, ChatType } from "@/lib/types"; import { db } from "@/lib/db"; -import { Metadata } from "next"; +import { Metadata, ResolvingMetadata } from "next"; import { redirect } from "next/navigation"; import { Chat as ChatSchema, chats } from "@/lib/db/schema"; import { eq, and } from "drizzle-orm"; @@ -11,26 +11,38 @@ import { AblyChannelProvider } from "@/components/ablyprovider"; export const dynamic = "force-dynamic", revalidate = 0; -export const metadata: Metadata = { - openGraph: { - title: "Echoes", +type Props = { + params: { id: string }; + searchParams: { [key: string]: string | string[] | undefined }; +}; +let chattitle: any = ""; +export async function generateMetadata( + { params, searchParams }: Props, + parent: ResolvingMetadata, +): Promise { + // read route params + console.log("params", params); + console.log("searchParams", searchParams); + + return { + title: chattitle, description: "Collaborative Platform for Researchers. Designed for Humans and AIs.", - url: "https://echoes.team", - siteName: "Echoes", - images: [ - { - // url:'https//echoes.team/api/og?title=Hello brother', - url: "https://0901.static.prezi.com/preview/v2/hxsohg2f6zal6vcgzqdlh4lsfx6jc3sachvcdoaizecfr3dnitcq_3_0.png", // Must be an absolute URL - width: 1800, - height: 1600, - alt: "My custom alt", - }, - ], - locale: "en_US", - type: "website", - }, -}; + openGraph: { + images: [ + { + // url: "https//www.echoes.team/api/og?title=Hello brother", + url: "https://0901.static.prezi.com/preview/v2/hxsohg2f6zal6vcgzqdlh4lsfx6jc3sachvcdoaizecfr3dnitcq_3_0.png", // Must be an absolute URL + width: 1800, + height: 1600, + alt: "My custom alt", + }, + ], + locale: "en_US", + type: "website", + }, + }; +} export default async function Page({ params, @@ -72,6 +84,7 @@ export default async function Page({ chatlog = JSON.parse(msg as string) as ChatLog; console.log("chatlog", chatlog); console.log("chatlogData", chatlog.log); + chattitle = fetchedChat[0]?.title as string; // console.log("chatlogSnapshot", chatlog.tldraw_snapshot); } diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index 38066c13..91bf0605 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -1,11 +1,12 @@ import { Button } from "@/components/button"; import Link from "next/link"; import { db } from "@/lib/db"; -import { Metadata, ResolvingMetadata } from "next"; import { chats, Chat as ChatSchema } from "@/lib/db/schema"; import { eq, desc, ne, and } from "drizzle-orm"; import { auth } from "@clerk/nextjs"; import ChatCardWrapper from "@/components/chatcardwrapper"; +import { Metadata, ResolvingMetadata } from "next"; + // import Uploadzone from "@/components/uploadzone"; export const dynamic = "force-dynamic", @@ -15,13 +16,11 @@ type Props = { params: { id: string }; searchParams: { [key: string]: string | string[] | undefined }; }; - export async function generateMetadata( { params, searchParams }: Props, parent: ResolvingMetadata, ): Promise { // read route params - const id = params.id; console.log("params", params); console.log("searchParams", searchParams); @@ -46,7 +45,6 @@ export async function generateMetadata( }, }; } - export default async function Page({ params, searchParams, From 39dd6a22f9a314cb06883cb467b6ad581ed7ac43 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Mon, 15 Apr 2024 12:43:38 +0530 Subject: [PATCH 11/43] created image same like mockup --- src/app/api/og/route.tsx | 92 ++++++++++++++++++++++--------- src/app/dashboard/[slug]/page.tsx | 36 +++++++++++- 2 files changed, 100 insertions(+), 28 deletions(-) diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index e431c8a1..6e8b21f2 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -4,6 +4,41 @@ import { ImageResponse } from "next/og"; export const runtime = "edge"; +// Gradient Square Component +function GradientSquare() { + return ( +
+ ); +} + +function Circle() { + return ( +
+ IK +
+ ); +} + export async function GET(request: Request) { try { const { searchParams } = new URL(request.url); @@ -16,49 +51,54 @@ export async function GET(request: Request) { return new ImageResponse( ( + // Main Design Component
-
- Vercel -
+ The Dual Role of Tween 80 in Biofilm Formation + +

+ Inhibition and Enhancement +

- {title} + + + + + +
), diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index 91bf0605..8e168c08 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -24,16 +24,48 @@ export async function generateMetadata( console.log("params", params); console.log("searchParams", searchParams); - // fetch data + const ogUrl = new URL(`https://www.echoes.team/api/og?title=Hello+brother`); + console.log("ogUrl", ogUrl.toString()); + + // const res = await axios.get(`/api/og`); + // console.log("fetchImageResponce", res.data) + // const imageUrl = `image=${encodeURIComponent( + // res.data.imageUrl || "", + // )}&description=${encodeURIComponent( + // res.data.description || "", + // )}`; + + // console.log("imageUrl", imageUrl) + + // fetch(ogUrl) + // .then(response => { + // if (!response.ok) { + // throw new Error('Network response was not ok'); + // } + // return response.json(); + // }) + // .then(data => { + // const imageUrl = data.imageUrl; + // console.log("img",imageUrl); + // const img = document.createElement('img'); + // img.src = imageUrl; + // document.body.appendChild(img); // Append the image to the body or any other desired element + // }) + // .catch(error => { + // console.error('Error fetching data:', error); + // }); return { title: "Echoes", description: "Collaborative Platform for Researchers. Designed for Humans and AIs.", openGraph: { + title: "Echoes", + description: + "Collaborative Platform for Researchers. Designed for Humans and AIs.", images: [ { - // url: "https//www.echoes.team/api/og?title=Hello brother", + // url: ogUrl.toString(), url: "https://0901.static.prezi.com/preview/v2/hxsohg2f6zal6vcgzqdlh4lsfx6jc3sachvcdoaizecfr3dnitcq_3_0.png", // Must be an absolute URL width: 1800, height: 1600, From 320595f95920996d56e2aa8b8ef4474bda86a940 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Mon, 15 Apr 2024 13:32:51 +0530 Subject: [PATCH 12/43] made route public --- src/app/dashboard/[slug]/chat/[chatid]/page.tsx | 6 +++--- src/middleware.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index e600017d..a5696375 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -25,14 +25,14 @@ export async function generateMetadata( console.log("searchParams", searchParams); return { - title: chattitle, + title: "echoes id", description: "Collaborative Platform for Researchers. Designed for Humans and AIs.", openGraph: { images: [ { - // url: "https//www.echoes.team/api/og?title=Hello brother", - url: "https://0901.static.prezi.com/preview/v2/hxsohg2f6zal6vcgzqdlh4lsfx6jc3sachvcdoaizecfr3dnitcq_3_0.png", // Must be an absolute URL + url: "https//www.echoes.team/api/og", + // url: "https://0901.static.prezi.com/preview/v2/hxsohg2f6zal6vcgzqdlh4lsfx6jc3sachvcdoaizecfr3dnitcq_3_0.png", // Must be an absolute URL width: 1800, height: 1600, alt: "My custom alt", diff --git a/src/middleware.ts b/src/middleware.ts index 5cddfb3e..474d6e67 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -6,7 +6,7 @@ import { env } from "@/app/env.mjs"; // This is your original middleware const clerkMiddleware = authMiddleware({ // "/" will be accessible to all users - publicRoutes: ["/"], + publicRoutes: ["/api/og"], }); export async function middleware(req: NextRequest, event: NextFetchEvent) { From 39f6d7858868860364edb9bd2189f1ad5faf4d43 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Mon, 15 Apr 2024 13:37:25 +0530 Subject: [PATCH 13/43] chnaged the layout og image url --- src/app/layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index cfb21212..e32ebc75 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -24,7 +24,7 @@ export const metadata = { images: [ { // url:'https//api/og?title=Hello brother', - url: "https://media.licdn.com/dms/image/C560BAQG1AcH3R1tVQA/company-logo_200_200/0/1630661181669?e=2147483647&v=beta&t=UcvY6346uivc84MbUXi7IaPcPNJz9Wd5isemdDWMydI", // Must be an absolute URL + url: "https//www.echoes.team/api/og", // Must be an absolute URL width: 1800, height: 1600, alt: "My custom alt", From f5def5597ea557b4e065313ff124e35614425b60 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Mon, 15 Apr 2024 13:48:06 +0530 Subject: [PATCH 14/43] removed this https//www.echoes.team from page and layout.tsx --- src/app/dashboard/[slug]/chat/[chatid]/page.tsx | 2 +- src/app/layout.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index a5696375..a8d1391a 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -31,7 +31,7 @@ export async function generateMetadata( openGraph: { images: [ { - url: "https//www.echoes.team/api/og", + url: "/api/og", // url: "https://0901.static.prezi.com/preview/v2/hxsohg2f6zal6vcgzqdlh4lsfx6jc3sachvcdoaizecfr3dnitcq_3_0.png", // Must be an absolute URL width: 1800, height: 1600, diff --git a/src/app/layout.tsx b/src/app/layout.tsx index e32ebc75..143fe4b9 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -24,7 +24,7 @@ export const metadata = { images: [ { // url:'https//api/og?title=Hello brother', - url: "https//www.echoes.team/api/og", // Must be an absolute URL + url: "/api/og", // Must be an absolute URL width: 1800, height: 1600, alt: "My custom alt", From 25190d90375dbf7a382fc59a278a593a96ad4e04 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Mon, 15 Apr 2024 14:10:19 +0530 Subject: [PATCH 15/43] tried to make route title dynamically --- src/app/api/og/route.tsx | 2 +- .../dashboard/[slug]/chat/[chatid]/page.tsx | 46 +++++------ src/app/dashboard/[slug]/page.tsx | 77 ++++--------------- 3 files changed, 35 insertions(+), 90 deletions(-) diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index 6e8b21f2..9a81a449 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -74,7 +74,7 @@ export async function GET(request: Request) { fontWeight: "900", }} > - The Dual Role of Tween 80 in Biofilm Formation + {title ? title : " The Dual Role of Tween 80 in Biofilm Formation"}

{ - // read route params - console.log("params", params); - console.log("searchParams", searchParams); - - return { - title: "echoes id", - description: - "Collaborative Platform for Researchers. Designed for Humans and AIs.", - openGraph: { - images: [ - { - url: "/api/og", - // url: "https://0901.static.prezi.com/preview/v2/hxsohg2f6zal6vcgzqdlh4lsfx6jc3sachvcdoaizecfr3dnitcq_3_0.png", // Must be an absolute URL - width: 1800, - height: 1600, - alt: "My custom alt", - }, - ], - locale: "en_US", - type: "website", - }, - }; -} +console.log("chattitle in id page", chattitle); +export const metadata = { + openGraph: { + title: "Echoes", + description: "The React Framework for the Web", + url: "https://www.echoes.team", + siteName: "Echoes", + images: [ + { + url: `/api/og?title=${chattitle}`, // Must be an absolute URL + width: 800, + height: 600, + }, + ], + locale: "en_US", + type: "website", + }, +}; export default async function Page({ params, diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index 8e168c08..dc6dd4f0 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -5,7 +5,6 @@ import { chats, Chat as ChatSchema } from "@/lib/db/schema"; import { eq, desc, ne, and } from "drizzle-orm"; import { auth } from "@clerk/nextjs"; import ChatCardWrapper from "@/components/chatcardwrapper"; -import { Metadata, ResolvingMetadata } from "next"; // import Uploadzone from "@/components/uploadzone"; @@ -16,67 +15,23 @@ type Props = { params: { id: string }; searchParams: { [key: string]: string | string[] | undefined }; }; -export async function generateMetadata( - { params, searchParams }: Props, - parent: ResolvingMetadata, -): Promise { - // read route params - console.log("params", params); - console.log("searchParams", searchParams); - - const ogUrl = new URL(`https://www.echoes.team/api/og?title=Hello+brother`); - console.log("ogUrl", ogUrl.toString()); - - // const res = await axios.get(`/api/og`); - // console.log("fetchImageResponce", res.data) - // const imageUrl = `image=${encodeURIComponent( - // res.data.imageUrl || "", - // )}&description=${encodeURIComponent( - // res.data.description || "", - // )}`; - - // console.log("imageUrl", imageUrl) - - // fetch(ogUrl) - // .then(response => { - // if (!response.ok) { - // throw new Error('Network response was not ok'); - // } - // return response.json(); - // }) - // .then(data => { - // const imageUrl = data.imageUrl; - // console.log("img",imageUrl); - // const img = document.createElement('img'); - // img.src = imageUrl; - // document.body.appendChild(img); // Append the image to the body or any other desired element - // }) - // .catch(error => { - // console.error('Error fetching data:', error); - // }); - - return { +export const metadata = { + openGraph: { title: "Echoes", - description: - "Collaborative Platform for Researchers. Designed for Humans and AIs.", - openGraph: { - title: "Echoes", - description: - "Collaborative Platform for Researchers. Designed for Humans and AIs.", - images: [ - { - // url: ogUrl.toString(), - url: "https://0901.static.prezi.com/preview/v2/hxsohg2f6zal6vcgzqdlh4lsfx6jc3sachvcdoaizecfr3dnitcq_3_0.png", // Must be an absolute URL - width: 1800, - height: 1600, - alt: "My custom alt", - }, - ], - locale: "en_US", - type: "website", - }, - }; -} + description: "The React Framework for the Web slug", + url: "https://www.echoes.team", + siteName: "Echoes", + images: [ + { + url: `/api/og`, // Must be an absolute URL + width: 800, + height: 600, + }, + ], + locale: "en_US", + type: "website", + }, +}; export default async function Page({ params, searchParams, From 4fa233133cc9b87f67491e814ea582e4d57ecd7a Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Mon, 15 Apr 2024 17:43:55 +0530 Subject: [PATCH 16/43] tried to check chat is and chat slug page meta data --- .../dashboard/[slug]/chat/[chatid]/page.tsx | 38 ++++++++++--------- src/app/dashboard/[slug]/page.tsx | 32 ++++++++-------- src/app/layout.tsx | 35 +++++++++-------- 3 files changed, 54 insertions(+), 51 deletions(-) diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index 6ba4e89d..bd33ecaa 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -6,6 +6,7 @@ import { eq, and } from "drizzle-orm"; import { auth, currentUser } from "@clerk/nextjs"; import RoomWrapper from "@/components/room"; import { AblyChannelProvider } from "@/components/ablyprovider"; +import { ResolvingMetadata, Metadata } from "next"; export const dynamic = "force-dynamic", revalidate = 0; @@ -14,25 +15,28 @@ type Props = { params: { id: string }; searchParams: { [key: string]: string | string[] | undefined }; }; + let chattitle: any = ""; -console.log("chattitle in id page", chattitle); -export const metadata = { - openGraph: { +export async function generateMetadata( + { params, searchParams }: Props, + parent: ResolvingMetadata, +): Promise { + // read route params + const id = params.id; + + return { title: "Echoes", - description: "The React Framework for the Web", - url: "https://www.echoes.team", - siteName: "Echoes", - images: [ - { - url: `/api/og?title=${chattitle}`, // Must be an absolute URL - width: 800, - height: 600, - }, - ], - locale: "en_US", - type: "website", - }, -}; + openGraph: { + images: [ + { + url: "api/og", // Must be an absolute URL + width: 1200, + height: 680, + }, + ], + }, + }; +} export default async function Page({ params, diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index dc6dd4f0..4c1d2929 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -5,6 +5,7 @@ import { chats, Chat as ChatSchema } from "@/lib/db/schema"; import { eq, desc, ne, and } from "drizzle-orm"; import { auth } from "@clerk/nextjs"; import ChatCardWrapper from "@/components/chatcardwrapper"; +import { Metadata, ResolvingMetadata } from "next"; // import Uploadzone from "@/components/uploadzone"; @@ -15,23 +16,22 @@ type Props = { params: { id: string }; searchParams: { [key: string]: string | string[] | undefined }; }; -export const metadata = { - openGraph: { + +let chattitle: any = ""; +export async function generateMetadata( + { params, searchParams }: Props, + parent: ResolvingMetadata, +): Promise { + // read route params + const id = params.id; + + return { title: "Echoes", - description: "The React Framework for the Web slug", - url: "https://www.echoes.team", - siteName: "Echoes", - images: [ - { - url: `/api/og`, // Must be an absolute URL - width: 800, - height: 600, - }, - ], - locale: "en_US", - type: "website", - }, -}; + openGraph: { + images: ["api/og"], + }, + }; +} export default async function Page({ params, searchParams, diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 143fe4b9..81283537 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -15,24 +15,23 @@ export const metadata = { manifest: "/manifest.json", viewport: "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", - openGraph: { - title: "Echoes", - description: - "Collaborative Platform for Researchers. Designed for Humans and AIs.", - url: "https://echoes.team", - siteName: "Echoes", - images: [ - { - // url:'https//api/og?title=Hello brother', - url: "/api/og", // Must be an absolute URL - width: 1800, - height: 1600, - alt: "My custom alt", - }, - ], - locale: "en_US", - type: "website", - }, + // openGraph: { + // title: "Echoes", + // description: + // "Collaborative Platform for Researchers. Designed for Humans and AIs.", + // url: "https://echoes.team", + // siteName: "Echoes", + // images: [ + // { + // url: `/api/og?title=Hello layout`, // Must be an absolute URL + // width: 1800, + // height: 1600, + // alt: "Echoes", + // }, + // ], + // locale: "en_US", + // type: "website", + // }, }; export default function RootLayout({ From 18a9dee304807bb76fde9d7e4d6259fc84a36fbc Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Mon, 15 Apr 2024 17:48:20 +0530 Subject: [PATCH 17/43] uncomment data in layout.tsx --- src/app/layout.tsx | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 81283537..f2f7af1b 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -15,23 +15,23 @@ export const metadata = { manifest: "/manifest.json", viewport: "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", - // openGraph: { - // title: "Echoes", - // description: - // "Collaborative Platform for Researchers. Designed for Humans and AIs.", - // url: "https://echoes.team", - // siteName: "Echoes", - // images: [ - // { - // url: `/api/og?title=Hello layout`, // Must be an absolute URL - // width: 1800, - // height: 1600, - // alt: "Echoes", - // }, - // ], - // locale: "en_US", - // type: "website", - // }, + openGraph: { + title: "Echoes", + description: + "Collaborative Platform for Researchers. Designed for Humans and AIs.", + url: "https://echoes.team", + siteName: "Echoes", + images: [ + { + url: `/api/og`, // Must be an absolute URL + width: 1800, + height: 1600, + alt: "Echoes", + }, + ], + locale: "en_US", + type: "website", + }, }; export default function RootLayout({ From 4980b34094b40166218b2fd82ef9282e3eb5e7be Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Mon, 15 Apr 2024 23:55:36 +0530 Subject: [PATCH 18/43] I fetched title with some logic --- src/app/api/og/route.tsx | 25 +++++++++++++------ .../dashboard/[slug]/chat/[chatid]/page.tsx | 15 +++++------ src/app/dashboard/[slug]/page.tsx | 16 +++++++----- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index 9a81a449..2228d357 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -1,4 +1,5 @@ import { ImageResponse } from "next/og"; + // App router includes @vercel/og. // No need to install it. @@ -41,13 +42,15 @@ function Circle() { export async function GET(request: Request) { try { - const { searchParams } = new URL(request.url); - - // ?title= - const hasTitle = searchParams.has("title"); - const title = hasTitle - ? searchParams.get("title")?.slice(0, 100) - : "My default title"; + const urlParams = new URLSearchParams(request.url.split("?")[1]); // Splitting URL to get query params + const title = urlParams.get("title"); + console.log("title01", title); + // const { searchParams } = new URL(request.url); + // console.log("searchParams", searchParams) + // const hasTitle = searchParams.has("title"); + // const title = hasTitle + // ? searchParams.get("title")?.slice(0, 100) + // : "My default title"; return new ImageResponse( ( @@ -97,6 +100,14 @@ export async function GET(request: Request) { <Circle /> </span> <span> + {/* <img + width="40" + height="40" + src={"https://ik.imagekit.io/echoes/echoes_logo.png"} + style={{ + borderRadius: 128, + }} + /> */} <GradientSquare /> </span> </div> diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index bd33ecaa..1998f88a 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -23,17 +23,18 @@ export async function generateMetadata( ): Promise<Metadata> { // read route params const id = params.id; + const ogurl = new URL("api/og"); + ogurl.searchParams.set("title", chattitle); + console.log("chattitle in chat id page ", chattitle); return { title: "Echoes", + description: "echoes slug", openGraph: { - images: [ - { - url: "api/og", // Must be an absolute URL - width: 1200, - height: 680, - }, - ], + title: "Echoes", + description: "Echoes Slug", + type: "website", + images: ["api/og?title=hello id"], }, }; } diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index 4c1d2929..7c2fa153 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -5,7 +5,7 @@ import { chats, Chat as ChatSchema } from "@/lib/db/schema"; import { eq, desc, ne, and } from "drizzle-orm"; import { auth } from "@clerk/nextjs"; import ChatCardWrapper from "@/components/chatcardwrapper"; -import { Metadata, ResolvingMetadata } from "next"; +import { Metadata } from "next"; // import Uploadzone from "@/components/uploadzone"; @@ -18,17 +18,21 @@ type Props = { }; let chattitle: any = ""; -export async function generateMetadata( - { params, searchParams }: Props, - parent: ResolvingMetadata, -): Promise<Metadata> { +export async function generateMetadata({ + params, + searchParams, +}: Props): Promise<Metadata> { // read route params const id = params.id; return { title: "Echoes", + description: "echoes slug", openGraph: { - images: ["api/og"], + title: "Echoes", + description: "Echoes Slug", + type: "website", + images: ["api/og?title=hello slug"], }, }; } From 669de3f85f57bc77f6375cc6ee1696a730c98baa Mon Sep 17 00:00:00 2001 From: Rohittomar01 <rohittomar9285@gmail.com> Date: Tue, 16 Apr 2024 00:13:59 +0530 Subject: [PATCH 19/43] commented layout metadata --- src/app/api/og/route.tsx | 12 ++--- .../dashboard/[slug]/chat/[chatid]/page.tsx | 6 ++- src/app/dashboard/[slug]/page.tsx | 4 +- src/app/layout.tsx | 50 +++++++++---------- 4 files changed, 38 insertions(+), 34 deletions(-) diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index 2228d357..ad58fd03 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -45,12 +45,12 @@ export async function GET(request: Request) { const urlParams = new URLSearchParams(request.url.split("?")[1]); // Splitting URL to get query params const title = urlParams.get("title"); console.log("title01", title); - // const { searchParams } = new URL(request.url); - // console.log("searchParams", searchParams) - // const hasTitle = searchParams.has("title"); - // const title = hasTitle - // ? searchParams.get("title")?.slice(0, 100) - // : "My default title"; + const { searchParams } = new URL(request.url); + console.log("searchParams", searchParams); + const hasTitle = searchParams.has("title"); + const title01 = hasTitle + ? searchParams.get("title")?.slice(0, 100) + : "My default title"; return new ImageResponse( ( diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index 1998f88a..eaaf3511 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -23,7 +23,7 @@ export async function generateMetadata( ): Promise<Metadata> { // read route params const id = params.id; - const ogurl = new URL("api/og"); + const ogurl = new URL("http://localhost:3000/api/og?title=Hello"); ogurl.searchParams.set("title", chattitle); console.log("chattitle in chat id page ", chattitle); @@ -34,7 +34,9 @@ export async function generateMetadata( title: "Echoes", description: "Echoes Slug", type: "website", - images: ["api/og?title=hello id"], + images: ["api/og?title=Hello id"], + siteName: "Echoes", + url: `https://www.echoes.team`, }, }; } diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index 7c2fa153..dd33fb1b 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -32,7 +32,9 @@ export async function generateMetadata({ title: "Echoes", description: "Echoes Slug", type: "website", - images: ["api/og?title=hello slug"], + images: ["api/og?title=Hello slug"], + siteName: "Echoes", + url: `https://www.echoes.team`, }, }; } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f2f7af1b..17669d57 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -9,30 +9,30 @@ import { Toaster } from "@/components/ui/toaster"; import { Providers } from "@/app/providers"; const inter = Inter({ subsets: ["latin"] }); -export const metadata = { - title: "Echoes", - description: "Seek using Research Agents", - manifest: "/manifest.json", - viewport: - "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", - openGraph: { - title: "Echoes", - description: - "Collaborative Platform for Researchers. Designed for Humans and AIs.", - url: "https://echoes.team", - siteName: "Echoes", - images: [ - { - url: `/api/og`, // Must be an absolute URL - width: 1800, - height: 1600, - alt: "Echoes", - }, - ], - locale: "en_US", - type: "website", - }, -}; +// export const metadata = { +// title: "Echoes", +// description: "Seek using Research Agents", +// manifest: "/manifest.json", +// viewport: +// "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", +// openGraph: { +// title: "Echoes", +// description: +// "Collaborative Platform for Researchers. Designed for Humans and AIs.", +// url: "https://echoes.team", +// siteName: "Echoes", +// images: [ +// { +// url: `/api/og`, // Must be an absolute URL +// width: 1800, +// height: 1600, +// alt: "Echoes", +// }, +// ], +// locale: "en_US", +// type: "website", +// }, +// }; export default function RootLayout({ children, @@ -263,7 +263,7 @@ export default function RootLayout({ <meta property="og:url" content="https://www.echoes.team/api/og" /> <meta property="og:image" content="https://echoes.team/api/og" /> */} - {/* <title>Echoes */} + Echoes From 079bafc8f46cef8cf0c80902b97a654f5832e7b6 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 00:32:27 +0530 Subject: [PATCH 20/43] uncommented layout metadata --- src/app/layout.tsx | 50 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 17669d57..f2f7af1b 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -9,30 +9,30 @@ import { Toaster } from "@/components/ui/toaster"; import { Providers } from "@/app/providers"; const inter = Inter({ subsets: ["latin"] }); -// export const metadata = { -// title: "Echoes", -// description: "Seek using Research Agents", -// manifest: "/manifest.json", -// viewport: -// "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", -// openGraph: { -// title: "Echoes", -// description: -// "Collaborative Platform for Researchers. Designed for Humans and AIs.", -// url: "https://echoes.team", -// siteName: "Echoes", -// images: [ -// { -// url: `/api/og`, // Must be an absolute URL -// width: 1800, -// height: 1600, -// alt: "Echoes", -// }, -// ], -// locale: "en_US", -// type: "website", -// }, -// }; +export const metadata = { + title: "Echoes", + description: "Seek using Research Agents", + manifest: "/manifest.json", + viewport: + "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", + openGraph: { + title: "Echoes", + description: + "Collaborative Platform for Researchers. Designed for Humans and AIs.", + url: "https://echoes.team", + siteName: "Echoes", + images: [ + { + url: `/api/og`, // Must be an absolute URL + width: 1800, + height: 1600, + alt: "Echoes", + }, + ], + locale: "en_US", + type: "website", + }, +}; export default function RootLayout({ children, @@ -263,7 +263,7 @@ export default function RootLayout({ */} - Echoes + {/* Echoes */} From e7c25b006507169bc8e400728c5ffeefe96be289 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 09:34:00 +0530 Subject: [PATCH 21/43] changed something in image metadata --- src/app/dashboard/[slug]/chat/[chatid]/page.tsx | 12 +++++++++--- src/app/dashboard/[slug]/page.tsx | 8 +++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index eaaf3511..2d365d17 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -28,13 +28,19 @@ export async function generateMetadata( console.log("chattitle in chat id page ", chattitle); return { - title: "Echoes", + title: "Echoesss", description: "echoes slug", openGraph: { title: "Echoes", - description: "Echoes Slug", + description: "Echoes id", type: "website", - images: ["api/og?title=Hello id"], + images: [ + { + url: "api/og", + width: 1200, + height: 680, + }, + ], siteName: "Echoes", url: `https://www.echoes.team`, }, diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index dd33fb1b..edfa5e67 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -32,7 +32,13 @@ export async function generateMetadata({ title: "Echoes", description: "Echoes Slug", type: "website", - images: ["api/og?title=Hello slug"], + images: [ + { + url: "api/og", // Must be an absolute URL + width: 1200, + height: 680, + }, + ], siteName: "Echoes", url: `https://www.echoes.team`, }, From ffeeada285b4f3d71f85f015a4d2e52eba56e565 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 09:39:21 +0530 Subject: [PATCH 22/43] changed this publicRoutes: ["/"], --- src/middleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware.ts b/src/middleware.ts index 474d6e67..5cddfb3e 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -6,7 +6,7 @@ import { env } from "@/app/env.mjs"; // This is your original middleware const clerkMiddleware = authMiddleware({ // "/" will be accessible to all users - publicRoutes: ["/api/og"], + publicRoutes: ["/"], }); export async function middleware(req: NextRequest, event: NextFetchEvent) { From d4445b3c65564575c0efe353686f96f25ba9a48c Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 09:43:45 +0530 Subject: [PATCH 23/43] again rechanged --- src/middleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware.ts b/src/middleware.ts index 5cddfb3e..474d6e67 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -6,7 +6,7 @@ import { env } from "@/app/env.mjs"; // This is your original middleware const clerkMiddleware = authMiddleware({ // "/" will be accessible to all users - publicRoutes: ["/"], + publicRoutes: ["/api/og"], }); export async function middleware(req: NextRequest, event: NextFetchEvent) { From ee3026be015c868be66ad9f22140783d9211df05 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 09:51:38 +0530 Subject: [PATCH 24/43] commentted layout metadata --- src/app/layout.tsx | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f2f7af1b..08c8d0b4 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -15,23 +15,23 @@ export const metadata = { manifest: "/manifest.json", viewport: "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", - openGraph: { - title: "Echoes", - description: - "Collaborative Platform for Researchers. Designed for Humans and AIs.", - url: "https://echoes.team", - siteName: "Echoes", - images: [ - { - url: `/api/og`, // Must be an absolute URL - width: 1800, - height: 1600, - alt: "Echoes", - }, - ], - locale: "en_US", - type: "website", - }, + // openGraph: { + // title: "Echoes", + // description: + // "Collaborative Platform for Researchers. Designed for Humans and AIs.", + // url: "https://echoes.team", + // siteName: "Echoes", + // images: [ + // { + // url: `/api/og`, // Must be an absolute URL + // width: 1800, + // height: 1600, + // alt: "Echoes", + // }, + // ], + // locale: "en_US", + // type: "website", + // }, }; export default function RootLayout({ @@ -253,15 +253,15 @@ export default function RootLayout({ content="https://echoes.team/android-chrome-192x192.png" /> - {/* + - - */} + + {/* Echoes */} From 218a02a0943cd1f57adadecca05f4d529d78aa5f Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 09:55:32 +0530 Subject: [PATCH 25/43] uncomment the layout metadata --- src/app/layout.tsx | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 08c8d0b4..f2f7af1b 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -15,23 +15,23 @@ export const metadata = { manifest: "/manifest.json", viewport: "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", - // openGraph: { - // title: "Echoes", - // description: - // "Collaborative Platform for Researchers. Designed for Humans and AIs.", - // url: "https://echoes.team", - // siteName: "Echoes", - // images: [ - // { - // url: `/api/og`, // Must be an absolute URL - // width: 1800, - // height: 1600, - // alt: "Echoes", - // }, - // ], - // locale: "en_US", - // type: "website", - // }, + openGraph: { + title: "Echoes", + description: + "Collaborative Platform for Researchers. Designed for Humans and AIs.", + url: "https://echoes.team", + siteName: "Echoes", + images: [ + { + url: `/api/og`, // Must be an absolute URL + width: 1800, + height: 1600, + alt: "Echoes", + }, + ], + locale: "en_US", + type: "website", + }, }; export default function RootLayout({ @@ -253,15 +253,15 @@ export default function RootLayout({ content="https://echoes.team/android-chrome-192x192.png" /> - + {/* - - + + */} {/* Echoes */} From d1db99309ad2cc2e8b5d4c003eaa0f15bf348cba Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 11:12:05 +0530 Subject: [PATCH 26/43] gave static title in layout tsx --- src/app/api/og/route.tsx | 15 +++---- .../dashboard/[slug]/chat/[chatid]/page.tsx | 42 +++++++++++-------- src/app/layout.tsx | 2 +- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index ad58fd03..44277ff2 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -44,13 +44,14 @@ export async function GET(request: Request) { try { const urlParams = new URLSearchParams(request.url.split("?")[1]); // Splitting URL to get query params const title = urlParams.get("title"); - console.log("title01", title); - const { searchParams } = new URL(request.url); - console.log("searchParams", searchParams); - const hasTitle = searchParams.has("title"); - const title01 = hasTitle - ? searchParams.get("title")?.slice(0, 100) - : "My default title"; + console.log("title", title); + console.log("request.url", request.url); + // const { searchParams } = new URL(request.url); + // console.log("searchParams", searchParams); + // const hasTitle = searchParams.has("title"); + // const title01 = hasTitle + // ? searchParams.get("title")?.slice(0, 100) + // : "My default title"; return new ImageResponse( ( diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index 2d365d17..d0ea6402 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -12,7 +12,7 @@ export const dynamic = "force-dynamic", revalidate = 0; type Props = { - params: { id: string }; + params: { id: string; uid: string; chatid: string; chattitle: string }; searchParams: { [key: string]: string | string[] | undefined }; }; @@ -25,18 +25,33 @@ export async function generateMetadata( const id = params.id; const ogurl = new URL("http://localhost:3000/api/og?title=Hello"); ogurl.searchParams.set("title", chattitle); + const { userId, sessionClaims } = auth(); + let fetchedChat: ChatSchema[] = []; + if (sessionClaims?.org_id) { + fetchedChat = await db + .select() + .from(chats) + .where( + and( + eq(chats.id, Number(params.chatid)), + eq(chats.user_id, sessionClaims?.org_id), + ), + ) + .limit(1) + .all(); + } - console.log("chattitle in chat id page ", chattitle); + console.log("chattitle in chat id page ", fetchedChat[0]?.title as string); return { - title: "Echoesss", - description: "echoes slug", + title: "Echoes Chat", + description: "echoes Chat", openGraph: { - title: "Echoes", - description: "Echoes id", + title: fetchedChat[0]?.title as string, + description: "Echoes", type: "website", images: [ { - url: "api/og", + url: `api/og?title=${fetchedChat[0]?.title as string}`, width: 1200, height: 680, }, @@ -47,11 +62,7 @@ export async function generateMetadata( }; } -export default async function Page({ - params, -}: { - params: { uid: string; chatid: string }; -}) { +export default async function Page({ params }: Props) { const { userId, sessionClaims } = auth(); const user = await currentUser(); @@ -65,7 +76,6 @@ export default async function Page({ } let chatlog: ChatLog = { log: [], tldraw_snapshot: [] }; - // let tldrawSnapshot: SnapShot = { tldraw_snapshot: [] } let fetchedChat: ChatSchema[] = []; if (sessionClaims.org_id) { @@ -82,13 +92,11 @@ export default async function Page({ .all(); } const msg = fetchedChat[0]?.messages; - console.log("msg", msg); if (fetchedChat.length === 1 && msg) { chatlog = JSON.parse(msg as string) as ChatLog; - console.log("chatlog", chatlog); - console.log("chatlogData", chatlog.log); + // console.log("chatlog", chatlog); + // console.log("chatlogData", chatlog.log); chattitle = fetchedChat[0]?.title as string; - // console.log("chatlogSnapshot", chatlog.tldraw_snapshot); } return ( diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f2f7af1b..7dd3040a 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -23,7 +23,7 @@ export const metadata = { siteName: "Echoes", images: [ { - url: `/api/og`, // Must be an absolute URL + url: `/api/og?title=This is Echoes Team`, width: 1800, height: 1600, alt: "Echoes", From fb30fd6819a687724125968d2f6eb314b8ab5beb Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 12:36:08 +0530 Subject: [PATCH 27/43] made public this /dashboard/user --- src/app/dashboard/[slug]/chat/[chatid]/page.tsx | 13 ++----------- src/app/dashboard/[slug]/page.tsx | 2 -- src/app/layout.tsx | 2 +- src/middleware.ts | 2 +- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index d0ea6402..cce42dcd 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -16,16 +16,11 @@ type Props = { searchParams: { [key: string]: string | string[] | undefined }; }; -let chattitle: any = ""; export async function generateMetadata( { params, searchParams }: Props, parent: ResolvingMetadata, ): Promise { - // read route params - const id = params.id; - const ogurl = new URL("http://localhost:3000/api/og?title=Hello"); - ogurl.searchParams.set("title", chattitle); - const { userId, sessionClaims } = auth(); + const { sessionClaims } = auth(); let fetchedChat: ChatSchema[] = []; if (sessionClaims?.org_id) { fetchedChat = await db @@ -40,8 +35,7 @@ export async function generateMetadata( .limit(1) .all(); } - - console.log("chattitle in chat id page ", fetchedChat[0]?.title as string); + console.log("chattitle in chat id page", fetchedChat[0]?.title as string); return { title: "Echoes Chat", description: "echoes Chat", @@ -56,8 +50,6 @@ export async function generateMetadata( height: 680, }, ], - siteName: "Echoes", - url: `https://www.echoes.team`, }, }; } @@ -96,7 +88,6 @@ export default async function Page({ params }: Props) { chatlog = JSON.parse(msg as string) as ChatLog; // console.log("chatlog", chatlog); // console.log("chatlogData", chatlog.log); - chattitle = fetchedChat[0]?.title as string; } return ( diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index edfa5e67..58acfbd6 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -39,8 +39,6 @@ export async function generateMetadata({ height: 680, }, ], - siteName: "Echoes", - url: `https://www.echoes.team`, }, }; } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 7dd3040a..deb5e90b 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -23,7 +23,7 @@ export const metadata = { siteName: "Echoes", images: [ { - url: `/api/og?title=This is Echoes Team`, + url: `/api/og?title=Collaborative Platform for Researchers. Designed for Humans and AIs.`, width: 1800, height: 1600, alt: "Echoes", diff --git a/src/middleware.ts b/src/middleware.ts index 474d6e67..98482f62 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -6,7 +6,7 @@ import { env } from "@/app/env.mjs"; // This is your original middleware const clerkMiddleware = authMiddleware({ // "/" will be accessible to all users - publicRoutes: ["/api/og"], + publicRoutes: ["/api/og", "/dashboard/user"], }); export async function middleware(req: NextRequest, event: NextFetchEvent) { From 6c21f7c71cc127dfb09f7f6829ef84cb55598d54 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 13:12:46 +0530 Subject: [PATCH 28/43] applied org logo --- src/app/api/og/route.tsx | 71 ++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index 44277ff2..8b9f3291 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -1,5 +1,5 @@ import { ImageResponse } from "next/og"; - +import logo from "@/assets/logo.png"; // App router includes @vercel/og. // No need to install it. @@ -45,7 +45,8 @@ export async function GET(request: Request) { const urlParams = new URLSearchParams(request.url.split("?")[1]); // Splitting URL to get query params const title = urlParams.get("title"); console.log("title", title); - console.log("request.url", request.url); + console.log("request.url", request.url, logo); + // const { searchParams } = new URL(request.url); // console.log("searchParams", searchParams); // const hasTitle = searchParams.has("title"); @@ -55,7 +56,6 @@ export async function GET(request: Request) { return new ImageResponse( ( - // Main Design Component
-

- {title ? title : " The Dual Role of Tween 80 in Biofilm Formation"} -

-

- Inhibition and Enhancement -

+

+ {title + ? title + : " The Dual Role of Tween 80 in Biofilm Formation"} +

+

+ Inhibition and Enhancement +

+
- {/* */} - + + {/* */}
From e120345d24eea7a844f0367f68d202e1b79c3616 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 17:53:46 +0530 Subject: [PATCH 29/43] add this line in middleware publicRoutes: ["/api/og", "/*"], --- src/app/api/og/route.tsx | 19 +++++++++---------- src/app/dashboard/[slug]/page.tsx | 2 +- src/middleware.ts | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index 8b9f3291..ee4f9962 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -24,9 +24,9 @@ function Circle() { return (
{title @@ -96,7 +95,7 @@ export async function GET(request: Request) { color: "grey", fontWeight: "normal", fontFamily: "sans-serif", - fontSize: "2rem", + fontSize: "2.2rem", }} > Inhibition and Enhancement @@ -106,7 +105,7 @@ export async function GET(request: Request) { style={{ display: "flex", justifyContent: "space-between", - marginTop: "25vh", + marginTop: "22vh", }} > @@ -114,8 +113,8 @@ export async function GET(request: Request) { {/* */} diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index 58acfbd6..3ae7c29a 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -34,7 +34,7 @@ export async function generateMetadata({ type: "website", images: [ { - url: "api/og", // Must be an absolute URL + url: "api/og", width: 1200, height: 680, }, diff --git a/src/middleware.ts b/src/middleware.ts index 98482f62..4bdd3ee3 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -6,7 +6,7 @@ import { env } from "@/app/env.mjs"; // This is your original middleware const clerkMiddleware = authMiddleware({ // "/" will be accessible to all users - publicRoutes: ["/api/og", "/dashboard/user"], + publicRoutes: ["/api/og", "/*"], }); export async function middleware(req: NextRequest, event: NextFetchEvent) { From 8f9e6e82771bf2db79f5b62b3c8f68bf1c82bd3a Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 17:57:30 +0530 Subject: [PATCH 30/43] rechanged publicRoutes: ["/api/og", "/"], --- src/middleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware.ts b/src/middleware.ts index 4bdd3ee3..5df36615 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -6,7 +6,7 @@ import { env } from "@/app/env.mjs"; // This is your original middleware const clerkMiddleware = authMiddleware({ // "/" will be accessible to all users - publicRoutes: ["/api/og", "/*"], + publicRoutes: ["/api/og", "/"], }); export async function middleware(req: NextRequest, event: NextFetchEvent) { From a25a0212b9947adc66584341aae7f80e824e4916 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 20:22:12 +0530 Subject: [PATCH 31/43] used tailwind css instead style element --- src/app/api/og/route.tsx | 67 +++++-------------- .../dashboard/[slug]/chat/[chatid]/page.tsx | 25 +++---- src/app/dashboard/[slug]/page.tsx | 5 +- src/app/robots.tsx | 12 ---- src/app/robusts.txt | 5 -- 5 files changed, 30 insertions(+), 84 deletions(-) delete mode 100644 src/app/robots.tsx delete mode 100644 src/app/robusts.txt diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index ee4f9962..b0aa25bc 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -26,7 +26,7 @@ function Circle() { style={{ width: "85px", height: "85px", - backgroundColor: "green", // Assuming a blue background for the circle + backgroundColor: "green", borderRadius: "50%", color: "white", display: "flex", @@ -42,9 +42,17 @@ function Circle() { export async function GET(request: Request) { try { - const urlParams = new URLSearchParams(request.url.split("?")[1]); // Splitting URL to get query params - const title = urlParams.get("title"); - console.log("title", title); + let title: string | null = ""; + try { + const urlParams = new URLSearchParams(request.url.split("?")[1]); // Splitting URL to get query params + title = urlParams.get("title"); + console.log("title", title); + } catch (error) { + console.error("Error parsing URL:", error); + } + // const urlParams = new URLSearchParams(request.url.split("?")[1]); // Splitting URL to get query params + // const title = urlParams.get("title"); + // console.log("title", title); // const { searchParams } = new URL(request.url); // console.log("searchParams", searchParams); @@ -55,59 +63,18 @@ export async function GET(request: Request) { return new ImageResponse( ( -
-
-

+
+
+

{title ? title : " The Dual Role of Tween 80 in Biofilm Formation"}

-

+

Inhibition and Enhancement

-
+
diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index cce42dcd..23836d95 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -22,22 +22,19 @@ export async function generateMetadata( ): Promise { const { sessionClaims } = auth(); let fetchedChat: ChatSchema[] = []; - if (sessionClaims?.org_id) { - fetchedChat = await db - .select() - .from(chats) - .where( - and( - eq(chats.id, Number(params.chatid)), - eq(chats.user_id, sessionClaims?.org_id), - ), - ) - .limit(1) - .all(); - } + + console.log("params", params); + console.log("searchParams", searchParams); + fetchedChat = await db + .select() + .from(chats) + .where(and(eq(chats.id, Number(params.chatid)))) + .limit(1) + .all(); console.log("chattitle in chat id page", fetchedChat[0]?.title as string); + return { - title: "Echoes Chat", + title: "Echoes", description: "echoes Chat", openGraph: { title: fetchedChat[0]?.title as string, diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index 3ae7c29a..b59263d6 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -17,7 +17,6 @@ type Props = { searchParams: { [key: string]: string | string[] | undefined }; }; -let chattitle: any = ""; export async function generateMetadata({ params, searchParams, @@ -27,10 +26,10 @@ export async function generateMetadata({ return { title: "Echoes", - description: "echoes slug", + description: "echoes", openGraph: { title: "Echoes", - description: "Echoes Slug", + description: "Echoes", type: "website", images: [ { diff --git a/src/app/robots.tsx b/src/app/robots.tsx deleted file mode 100644 index e2cfa46e..00000000 --- a/src/app/robots.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { MetadataRoute } from "next"; - -export default function robots(): MetadataRoute.Robots { - return { - rules: { - userAgent: "*", - allow: "/api/og/*", - disallow: "/private/", - }, - sitemap: "https://acme.com/sitemap.xml", - }; -} diff --git a/src/app/robusts.txt b/src/app/robusts.txt deleted file mode 100644 index a098a4d2..00000000 --- a/src/app/robusts.txt +++ /dev/null @@ -1,5 +0,0 @@ -User-Agent: * -Allow: /api/og/* -Disallow: /private/ - -Sitemap: https://acme.com/sitemap.xml \ No newline at end of file From 5c7633481134a246a2dceed16ec2fbefd8ccffd0 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 16 Apr 2024 20:34:06 +0530 Subject: [PATCH 32/43] just for title check --- src/app/dashboard/[slug]/chat/[chatid]/page.tsx | 2 +- src/app/dashboard/[slug]/page.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index 23836d95..27a5d062 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -34,7 +34,7 @@ export async function generateMetadata( console.log("chattitle in chat id page", fetchedChat[0]?.title as string); return { - title: "Echoes", + title: "Echoes chat", description: "echoes Chat", openGraph: { title: fetchedChat[0]?.title as string, diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index b59263d6..2656e331 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -25,7 +25,7 @@ export async function generateMetadata({ const id = params.id; return { - title: "Echoes", + title: "Echoes slug", description: "echoes", openGraph: { title: "Echoes", From dc720676d7d33374a9786948b4bc8d940bc9caf7 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Wed, 17 Apr 2024 11:12:47 +0530 Subject: [PATCH 33/43] created robots.txt file --- src/app/api/og/route.tsx | 2 +- .../dashboard/[slug]/chat/[chatid]/page.tsx | 24 +++++---- src/app/dashboard/[slug]/page.tsx | 54 +++++++++---------- src/app/layout.tsx | 1 + src/app/robots.txt | 3 ++ 5 files changed, 46 insertions(+), 38 deletions(-) create mode 100644 src/app/robots.txt diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index b0aa25bc..6357fb57 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -44,7 +44,7 @@ export async function GET(request: Request) { try { let title: string | null = ""; try { - const urlParams = new URLSearchParams(request.url.split("?")[1]); // Splitting URL to get query params + const urlParams = new URLSearchParams(request.url.split("?")[1]); title = urlParams.get("title"); console.log("title", title); } catch (error) { diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index 27a5d062..5c5b6505 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -22,19 +22,23 @@ export async function generateMetadata( ): Promise { const { sessionClaims } = auth(); let fetchedChat: ChatSchema[] = []; + // console.log("parent",parent) + const previousImages = (await parent).openGraph?.images || []; - console.log("params", params); - console.log("searchParams", searchParams); - fetchedChat = await db - .select() - .from(chats) - .where(and(eq(chats.id, Number(params.chatid)))) - .limit(1) - .all(); + // console.log("params", params); + // console.log("searchParams", searchParams) + if (sessionClaims?.org_id) { + fetchedChat = await db + .select() + .from(chats) + .where(and(eq(chats.id, Number(params.chatid)))) + .limit(1) + .all(); + } console.log("chattitle in chat id page", fetchedChat[0]?.title as string); return { - title: "Echoes chat", + title: "Echoes", description: "echoes Chat", openGraph: { title: fetchedChat[0]?.title as string, @@ -43,9 +47,11 @@ export async function generateMetadata( images: [ { url: `api/og?title=${fetchedChat[0]?.title as string}`, + width: 1200, height: 680, }, + ...previousImages, ], }, }; diff --git a/src/app/dashboard/[slug]/page.tsx b/src/app/dashboard/[slug]/page.tsx index 2656e331..714b3be9 100644 --- a/src/app/dashboard/[slug]/page.tsx +++ b/src/app/dashboard/[slug]/page.tsx @@ -5,42 +5,40 @@ import { chats, Chat as ChatSchema } from "@/lib/db/schema"; import { eq, desc, ne, and } from "drizzle-orm"; import { auth } from "@clerk/nextjs"; import ChatCardWrapper from "@/components/chatcardwrapper"; -import { Metadata } from "next"; +// import { Metadata } from "next"; // import Uploadzone from "@/components/uploadzone"; export const dynamic = "force-dynamic", revalidate = 0; -type Props = { - params: { id: string }; - searchParams: { [key: string]: string | string[] | undefined }; -}; +// type Props = { +// params: { id: string }; +// searchParams: { [key: string]: string | string[] | undefined }; +// }; -export async function generateMetadata({ - params, - searchParams, -}: Props): Promise { - // read route params - const id = params.id; +// export async function generateMetadata({ +// params, +// searchParams, +// }: Props): Promise { - return { - title: "Echoes slug", - description: "echoes", - openGraph: { - title: "Echoes", - description: "Echoes", - type: "website", - images: [ - { - url: "api/og", - width: 1200, - height: 680, - }, - ], - }, - }; -} +// return { +// title: "Echoes slug", +// description: "echoes", +// openGraph: { +// title: "Echoes", +// description: "Echoes", +// type: "website", +// images: [ +// { +// url: "api/og", +// width: 1200, +// height: 680, +// }, +// ], +// }, +// }; +// } export default async function Page({ params, searchParams, diff --git a/src/app/layout.tsx b/src/app/layout.tsx index deb5e90b..e7c711fb 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -7,6 +7,7 @@ import { Inter } from "next/font/google"; import QueryProviders from "@/app/queryProvider"; import { Toaster } from "@/components/ui/toaster"; import { Providers } from "@/app/providers"; + const inter = Inter({ subsets: ["latin"] }); export const metadata = { diff --git a/src/app/robots.txt b/src/app/robots.txt new file mode 100644 index 00000000..8fd76d53 --- /dev/null +++ b/src/app/robots.txt @@ -0,0 +1,3 @@ +User-Agent: * +Disallow: +Sitemap: https://acme.com/sitemap.xml \ No newline at end of file From 22d82c5da3a4c3fc2d24484ae9efb776d54b4513 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Wed, 17 Apr 2024 11:22:31 +0530 Subject: [PATCH 34/43] changes in robots.txt User-agent: * Allow: / --- src/app/robots.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/robots.txt b/src/app/robots.txt index 8fd76d53..aa0ea516 100644 --- a/src/app/robots.txt +++ b/src/app/robots.txt @@ -1,3 +1,3 @@ -User-Agent: * -Disallow: +User-agent: * +Allow: / Sitemap: https://acme.com/sitemap.xml \ No newline at end of file From 61ceff20ea88a4892b92d277b9872d87c4fe01e8 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Wed, 17 Apr 2024 11:42:28 +0530 Subject: [PATCH 35/43] created robots.ts --- .../dashboard/[slug]/chat/[chatid]/page.tsx | 3 +- src/app/layout.tsx | 34 +++++++++---------- src/app/robots.ts | 11 ++++++ src/app/robots.txt | 3 -- 4 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 src/app/robots.ts delete mode 100644 src/app/robots.txt diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index 5c5b6505..686febf2 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -38,7 +38,7 @@ export async function generateMetadata( console.log("chattitle in chat id page", fetchedChat[0]?.title as string); return { - title: "Echoes", + title: "Echoes chat", description: "echoes Chat", openGraph: { title: fetchedChat[0]?.title as string, @@ -47,7 +47,6 @@ export async function generateMetadata( images: [ { url: `api/og?title=${fetchedChat[0]?.title as string}`, - width: 1200, height: 680, }, diff --git a/src/app/layout.tsx b/src/app/layout.tsx index e7c711fb..89db50fc 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -16,23 +16,23 @@ export const metadata = { manifest: "/manifest.json", viewport: "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", - openGraph: { - title: "Echoes", - description: - "Collaborative Platform for Researchers. Designed for Humans and AIs.", - url: "https://echoes.team", - siteName: "Echoes", - images: [ - { - url: `/api/og?title=Collaborative Platform for Researchers. Designed for Humans and AIs.`, - width: 1800, - height: 1600, - alt: "Echoes", - }, - ], - locale: "en_US", - type: "website", - }, + // openGraph: { + // title: "Echoes", + // description: + // "Collaborative Platform for Researchers. Designed for Humans and AIs.", + // url: "https://echoes.team", + // siteName: "Echoes", + // images: [ + // { + // url: `/api/og?title=Collaborative Platform for Researchers. Designed for Humans and AIs.`, + // width: 1800, + // height: 1600, + // alt: "Echoes", + // }, + // ], + // locale: "en_US", + // type: "website", + // }, }; export default function RootLayout({ diff --git a/src/app/robots.ts b/src/app/robots.ts new file mode 100644 index 00000000..74fed238 --- /dev/null +++ b/src/app/robots.ts @@ -0,0 +1,11 @@ +import { MetadataRoute } from "next"; + +export default function robots(): MetadataRoute.Robots { + return { + rules: { + userAgent: "*", + allow: "/", + }, + // sitemap: 'https://acme.com/sitemap.xml', + }; +} diff --git a/src/app/robots.txt b/src/app/robots.txt deleted file mode 100644 index aa0ea516..00000000 --- a/src/app/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -User-agent: * -Allow: / -Sitemap: https://acme.com/sitemap.xml \ No newline at end of file From 62f4197495839d3f250bd0a2bf05e143f996766c Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Wed, 17 Apr 2024 11:57:06 +0530 Subject: [PATCH 36/43] changed the allow path in robots allow: "/dashboard/[slug]/chat/[chatid]/page.tsx", --- src/app/layout.tsx | 34 +++++++++++++++++----------------- src/app/robots.ts | 7 +++++-- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 89db50fc..e7c711fb 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -16,23 +16,23 @@ export const metadata = { manifest: "/manifest.json", viewport: "minimum-scale=1.0, initial-scale=1.0, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover", - // openGraph: { - // title: "Echoes", - // description: - // "Collaborative Platform for Researchers. Designed for Humans and AIs.", - // url: "https://echoes.team", - // siteName: "Echoes", - // images: [ - // { - // url: `/api/og?title=Collaborative Platform for Researchers. Designed for Humans and AIs.`, - // width: 1800, - // height: 1600, - // alt: "Echoes", - // }, - // ], - // locale: "en_US", - // type: "website", - // }, + openGraph: { + title: "Echoes", + description: + "Collaborative Platform for Researchers. Designed for Humans and AIs.", + url: "https://echoes.team", + siteName: "Echoes", + images: [ + { + url: `/api/og?title=Collaborative Platform for Researchers. Designed for Humans and AIs.`, + width: 1800, + height: 1600, + alt: "Echoes", + }, + ], + locale: "en_US", + type: "website", + }, }; export default function RootLayout({ diff --git a/src/app/robots.ts b/src/app/robots.ts index 74fed238..19f4580b 100644 --- a/src/app/robots.ts +++ b/src/app/robots.ts @@ -1,11 +1,14 @@ import { MetadataRoute } from "next"; export default function robots(): MetadataRoute.Robots { + const sitemap = "https://acme.com/sitemap.xml" + + console.log("sitemap", sitemap); return { rules: { userAgent: "*", - allow: "/", + allow: "/dashboard/[slug]/chat/[chatid]/page.tsx", }, - // sitemap: 'https://acme.com/sitemap.xml', + sitemap: 'https://acme.com/sitemap.xml', }; } From 64fa14157b834e46ad9634b08b0eaf93a49be7dc Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Wed, 17 Apr 2024 12:03:18 +0530 Subject: [PATCH 37/43] changed path again allow: "/dashboard/[slug]/chat/[chatid]", --- src/app/robots.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/robots.ts b/src/app/robots.ts index 19f4580b..e45ade2c 100644 --- a/src/app/robots.ts +++ b/src/app/robots.ts @@ -7,7 +7,7 @@ export default function robots(): MetadataRoute.Robots { return { rules: { userAgent: "*", - allow: "/dashboard/[slug]/chat/[chatid]/page.tsx", + allow: "/dashboard/[slug]/chat/[chatid]", }, sitemap: 'https://acme.com/sitemap.xml', }; From c09c76cbb2e8a576a7f922a196880a2ca31f9189 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Wed, 17 Apr 2024 12:28:02 +0530 Subject: [PATCH 38/43] chnaged in robost.ts allow:"*", // Allow crawling by any bot --- src/app/robots.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/robots.ts b/src/app/robots.ts index e45ade2c..78b12d51 100644 --- a/src/app/robots.ts +++ b/src/app/robots.ts @@ -7,7 +7,7 @@ export default function robots(): MetadataRoute.Robots { return { rules: { userAgent: "*", - allow: "/dashboard/[slug]/chat/[chatid]", + allow:"*", // Allow crawling by any bot }, sitemap: 'https://acme.com/sitemap.xml', }; From 935802d526279d65fc339992c605ec6c4c3f3351 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Wed, 17 Apr 2024 12:50:05 +0530 Subject: [PATCH 39/43] add more url to allow --- src/app/robots.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/robots.ts b/src/app/robots.ts index 78b12d51..74154098 100644 --- a/src/app/robots.ts +++ b/src/app/robots.ts @@ -1,14 +1,17 @@ import { MetadataRoute } from "next"; export default function robots(): MetadataRoute.Robots { - const sitemap = "https://acme.com/sitemap.xml" + const sitemap = "https://acme.com/sitemap.xml"; console.log("sitemap", sitemap); return { rules: { userAgent: "*", - allow:"*", // Allow crawling by any bot + allow: [ + "/dashboard/[slug]/chat/[chatid]", + "/dashboard/testtest/chat/3918", + ], }, - sitemap: 'https://acme.com/sitemap.xml', + sitemap: "https://acme.com/sitemap.xml", }; } From ee9af151180b4830931100230306876456c2f76e Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Wed, 17 Apr 2024 12:55:05 +0530 Subject: [PATCH 40/43] again replace --- src/app/robots.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/robots.ts b/src/app/robots.ts index 74154098..7f20155e 100644 --- a/src/app/robots.ts +++ b/src/app/robots.ts @@ -9,8 +9,7 @@ export default function robots(): MetadataRoute.Robots { userAgent: "*", allow: [ "/dashboard/[slug]/chat/[chatid]", - "/dashboard/testtest/chat/3918", - ], + "/dashboard/[slug]/chat/[chatid]/page",], }, sitemap: "https://acme.com/sitemap.xml", }; From 01af17cd7b28772460e6bc27db89e7eb8d0c42a9 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Wed, 17 Apr 2024 18:37:08 +0530 Subject: [PATCH 41/43] lint fixed --- src/app/robots.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/robots.ts b/src/app/robots.ts index 7f20155e..03d4d4f0 100644 --- a/src/app/robots.ts +++ b/src/app/robots.ts @@ -9,7 +9,8 @@ export default function robots(): MetadataRoute.Robots { userAgent: "*", allow: [ "/dashboard/[slug]/chat/[chatid]", - "/dashboard/[slug]/chat/[chatid]/page",], + "/dashboard/[slug]/chat/[chatid]/page", + ], }, sitemap: "https://acme.com/sitemap.xml", }; From a512247a9f42f580f81050ff460821ebab98ce35 Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Thu, 18 Apr 2024 12:23:19 +0530 Subject: [PATCH 42/43] added canonical in page.tsx --- src/app/dashboard/[slug]/chat/[chatid]/page.tsx | 4 ++++ src/app/robots.ts | 17 ++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx index 686febf2..0377dffc 100644 --- a/src/app/dashboard/[slug]/chat/[chatid]/page.tsx +++ b/src/app/dashboard/[slug]/chat/[chatid]/page.tsx @@ -40,10 +40,14 @@ export async function generateMetadata( return { title: "Echoes chat", description: "echoes Chat", + alternates: { + canonical: `https://www.echoes.team/dashboard/${sessionClaims?.org_slug}/chat/${params.chatid}`, + }, openGraph: { title: fetchedChat[0]?.title as string, description: "Echoes", type: "website", + images: [ { url: `api/og?title=${fetchedChat[0]?.title as string}`, diff --git a/src/app/robots.ts b/src/app/robots.ts index 03d4d4f0..32482939 100644 --- a/src/app/robots.ts +++ b/src/app/robots.ts @@ -1,17 +1,12 @@ import { MetadataRoute } from "next"; export default function robots(): MetadataRoute.Robots { - const sitemap = "https://acme.com/sitemap.xml"; - - console.log("sitemap", sitemap); return { rules: { - userAgent: "*", - allow: [ - "/dashboard/[slug]/chat/[chatid]", - "/dashboard/[slug]/chat/[chatid]/page", - ], + userAgent: '*', + allow: '/', + disallow: '', // No path is disallowed }, - sitemap: "https://acme.com/sitemap.xml", - }; -} + sitemap: 'https://acme.com/sitemap.xml', + } +} \ No newline at end of file From 83d5dacff7ffbf247893921e24ec35e36ee8a80f Mon Sep 17 00:00:00 2001 From: Rohittomar01 Date: Tue, 23 Apr 2024 01:03:02 +0530 Subject: [PATCH 43/43] lint fixed --- src/app/robots.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/robots.ts b/src/app/robots.ts index 32482939..aa7afb89 100644 --- a/src/app/robots.ts +++ b/src/app/robots.ts @@ -3,10 +3,10 @@ import { MetadataRoute } from "next"; export default function robots(): MetadataRoute.Robots { return { rules: { - userAgent: '*', - allow: '/', - disallow: '', // No path is disallowed + userAgent: "*", + allow: "/", + disallow: "", // No path is disallowed }, - sitemap: 'https://acme.com/sitemap.xml', - } -} \ No newline at end of file + sitemap: "https://acme.com/sitemap.xml", + }; +}