diff options
| author | yxshv <[email protected]> | 2024-04-11 16:37:46 +0530 |
|---|---|---|
| committer | yxshv <[email protected]> | 2024-04-11 16:37:46 +0530 |
| commit | 539f50367d2964579dbb6aa62876fab973b17840 (patch) | |
| tree | a071ab8c30d2448207bc68c92a57d5663dd73724 /apps/web/src/components/ChatMessage.tsx | |
| parent | merge pls (diff) | |
| parent | Merge branch 'main' of https://github.com/Dhravya/supermemory (diff) | |
| download | supermemory-539f50367d2964579dbb6aa62876fab973b17840.tar.xz supermemory-539f50367d2964579dbb6aa62876fab973b17840.zip | |
Merge branch 'main' of https://github.com/dhravya/supermemory
Diffstat (limited to 'apps/web/src/components/ChatMessage.tsx')
| -rw-r--r-- | apps/web/src/components/ChatMessage.tsx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/apps/web/src/components/ChatMessage.tsx b/apps/web/src/components/ChatMessage.tsx index d25c9c48..db0778c4 100644 --- a/apps/web/src/components/ChatMessage.tsx +++ b/apps/web/src/components/ChatMessage.tsx @@ -37,7 +37,7 @@ export function ChatAnswer({ href={source} > <Globe className="h-4 w-4" /> - {source} + {cleanUrl(source)} </a> ))} </div> @@ -103,3 +103,17 @@ function MessageSkeleton() { </div> ); } + +function cleanUrl(url: string) { + if (url.startsWith("https://")) { + url = url.slice(8); + } else if (url.startsWith("http://")) { + url = url.slice(7); + } + + if (url.endsWith("/")) { + url = url.slice(0, -1); + } + + return url; +} |