Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/http/react-ui/e2e/agents.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,13 @@ test.describe('Agents page', () => {
// when the render won, swinging total UI coverage ~1pp run-to-run.
await expect(page.getByRole('heading', { name: 'Create Agent' })).toBeVisible()
})

test('opens agent status without leaving an active chat', async ({ page }) => {
await page.goto('/app/agents/demo/chat?user_id=test-user')

const status = page.getByRole('link', { name: 'Status' })
await expect(status).toHaveAttribute('href', '/app/agents/demo/status?user_id=test-user')
await expect(status).toHaveAttribute('target', '_blank')
await expect(page).toHaveURL(/\/app\/agents\/demo\/chat\?user_id=test-user$/)
})
})
13 changes: 9 additions & 4 deletions core/http/react-ui/src/pages/AgentChat.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useEffect, useRef, useCallback, useMemo } from 'react'
import { useParams, useNavigate, useOutletContext, useSearchParams } from 'react-router-dom'
import { useParams, useOutletContext, useSearchParams } from 'react-router-dom'
import { agentsApi } from '../utils/api'
import { apiUrl } from '../utils/basePath'
import { renderMarkdown, highlightAll, enhanceCodeBlocks } from '../utils/markdown'
Expand Down Expand Up @@ -72,7 +72,6 @@ function AgentActivityGroup({ items }) {

export default function AgentChat() {
const { name } = useParams()
const navigate = useNavigate()
const { addToast } = useOutletContext()
const [searchParams] = useSearchParams()
const userId = searchParams.get('user_id') || undefined
Expand Down Expand Up @@ -600,9 +599,15 @@ export default function AgentChat() {
<i className="fas fa-layer-group" /> {artifacts.length}
</button>
)}
<button className="btn btn-secondary btn-sm" onClick={() => navigate(`/app/agents/${encodeURIComponent(name)}/status${userId ? `?user_id=${encodeURIComponent(userId)}` : ''}`)} title="View status & observables">
<a
className="btn btn-secondary btn-sm"
href={`/app/agents/${encodeURIComponent(name)}/status${userId ? `?user_id=${encodeURIComponent(userId)}` : ''}`}
target="_blank"
rel="noopener noreferrer"
title="View status & observables in a new tab"
>
<i className="fas fa-chart-bar" /> Status
</button>
</a>
<button className="btn btn-secondary btn-sm" onClick={() => clearMessages()} disabled={messages.length === 0} title="Clear chat history">
<i className="fas fa-eraser" /> Clear
</button>
Expand Down
Loading