From 61f2b04d2b5fa1b8421c8d4a92e9834a436e79e2 Mon Sep 17 00:00:00 2001 From: Hugo Dutka Date: Wed, 4 Jun 2025 16:52:47 +0200 Subject: [PATCH] fix: embed agentapi chat in the sidebar iframe (#18230) - hardcode a custom pathname (`/chat/embed`) to use in the sidebar iframe. this is a temporary fix so that the agentapi chat displays properly - make the sidebar a bit wider so that the chat fits without line wrapping Screenshot 2025-06-04 at 15 32 30 --- site/src/pages/TaskPage/TaskAppIframe.tsx | 15 ++++++++++++++- site/src/pages/TaskPage/TaskSidebar.tsx | 12 +++++++++--- site/src/pages/TaskPage/constants.ts | 1 + 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/site/src/pages/TaskPage/TaskAppIframe.tsx b/site/src/pages/TaskPage/TaskAppIframe.tsx index 9d11abc82b..5a3d0ed509 100644 --- a/site/src/pages/TaskPage/TaskAppIframe.tsx +++ b/site/src/pages/TaskPage/TaskAppIframe.tsx @@ -8,12 +8,14 @@ type TaskAppIFrameProps = { task: Task; app: WorkspaceApp; active: boolean; + pathname?: string; }; export const TaskAppIFrame: FC = ({ task, app, active, + pathname, }) => { const agent = task.workspace.latest_build.resources .flatMap((r) => r.agents) @@ -29,9 +31,20 @@ export const TaskAppIFrame: FC = ({ workspace: task.workspace, }); + let href = link.href; + try { + const url = new URL(link.href); + if (pathname) { + url.pathname = pathname; + } + href = url.toString(); + } catch (err) { + console.warn(`Failed to parse URL ${link.href} for app ${app.id}`, err); + } + return (