Skip to content

Commit

Permalink
quick nit
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Jan 22, 2025
1 parent 0d24cc0 commit cf0e63d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion web/src/app/assistants/mine/AssistantModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default function AssistantModal({
heightOverride={`${height}px`}
onOutsideClick={hideModal}
removeBottomPadding
className={`max-w-4xl max-h-[90vh] ${height} w-[95%] overflow-hidden`}
className={`max-w-4xl pb-4 max-h-[90vh] ${height} w-[95%] overflow-hidden`}
>
<div className="flex flex-col h-full">
<div className="flex bg-background flex-col sticky top-0 z-10">
Expand Down
17 changes: 16 additions & 1 deletion web/src/app/chat/message/MemoizedTextComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,24 @@ export const MemoizedLink = memo((props: any) => {
);
}

const handleMouseDown = () => {
let url = rest.href || rest.children?.toString();
if (url && !url.startsWith("http://") && !url.startsWith("https://")) {
// Try to construct a valid URL
const httpsUrl = `https://${url}`;
try {
new URL(httpsUrl);
url = httpsUrl;
} catch {
// If not a valid URL, don't modify original url
}
}
window.open(url, "_blank");
};

return (
<a
onMouseDown={() => rest.href && window.open(rest.href, "_blank")}
onMouseDown={handleMouseDown}
className="cursor-pointer text-link hover:text-link-hover"
>
{rest.children}
Expand Down

0 comments on commit cf0e63d

Please sign in to comment.