From fa803787e36beda2f1428f8d68cb2c58fc84d3e4 Mon Sep 17 00:00:00 2001
From: Huu Le <39040748+leehuwuj@users.noreply.github.com>
Date: Fri, 25 Oct 2024 14:13:34 +0700
Subject: [PATCH] relative url (#393)

---
 .changeset/smooth-wolves-admire.md                           | 5 +++++
 .../nextjs/app/components/ui/chat/chat-message/markdown.tsx  | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)
 create mode 100644 .changeset/smooth-wolves-admire.md

diff --git a/.changeset/smooth-wolves-admire.md b/.changeset/smooth-wolves-admire.md
new file mode 100644
index 00000000..547187d7
--- /dev/null
+++ b/.changeset/smooth-wolves-admire.md
@@ -0,0 +1,5 @@
+---
+"create-llama": patch
+---
+
+DocumentInfo working with relative URLs
diff --git a/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx b/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx
index 8682a802..9074e208 100644
--- a/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx
+++ b/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx
@@ -134,7 +134,9 @@ export default function Markdown({
               return (
                 <DocumentInfo
                   document={{
-                    url: new URL(decodeURIComponent(href)).href,
+                    url: backend
+                      ? new URL(decodeURIComponent(href)).href
+                      : href,
                     sources: [],
                   }}
                   className="mb-2 mt-2"
-- 
GitLab