Skip to content

Commit

Permalink
Fix issue #5676: [Bug]: Frontend Hyperlink in Chat window should open…
Browse files Browse the repository at this point in the history
… link in a new tab (#5677)

Co-authored-by: Xingyao Wang <[email protected]>
  • Loading branch information
openhands-agent and xingyaoww authored Dec 19, 2024
1 parent 3876f4a commit 2a66439
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions frontend/src/components/features/chat/chat-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { code } from "../markdown/code";
import { cn } from "#/utils/utils";
import { ul, ol } from "../markdown/list";
import { CopyToClipboardButton } from "#/components/shared/buttons/copy-to-clipboard-button";
import { anchor } from "../markdown/anchor";

interface ChatMessageProps {
type: "user" | "assistant";
Expand Down Expand Up @@ -62,6 +63,7 @@ export function ChatMessage({
code,
ul,
ol,
a: anchor,
}}
remarkPlugins={[remarkGfm]}
>
Expand Down
20 changes: 20 additions & 0 deletions frontend/src/components/features/markdown/anchor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import { ExtraProps } from "react-markdown";

export function anchor({
href,
children,
}: React.ClassAttributes<HTMLAnchorElement> &
React.AnchorHTMLAttributes<HTMLAnchorElement> &
ExtraProps) {
return (
<a
className="text-blue-500 hover:underline"
href={href}
target="_blank"
rel="noopener noreferrer"
>
{children}
</a>
);
}
1 change: 1 addition & 0 deletions openhands/server/session/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ async def _cleanup_detached_conversations(self):
except Exception:
logger.warning('error_cleaning_detached_conversations', exc_info=True)
await asyncio.sleep(15)

async def init_or_join_session(
self, sid: str, connection_id: str, session_init_data: SessionInitData
):
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ reportlab = "*"
[tool.coverage.run]
concurrency = ["gevent"]


[tool.poetry.group.runtime.dependencies]
jupyterlab = "*"
notebook = "*"
Expand Down Expand Up @@ -129,6 +130,7 @@ ignore = ["D1"]
[tool.ruff.lint.pydocstyle]
convention = "google"


[tool.poetry.group.evaluation.dependencies]
streamlit = "*"
whatthepatch = "*"
Expand Down

0 comments on commit 2a66439

Please sign in to comment.