Skip to content
Merged
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
8 changes: 7 additions & 1 deletion app/config/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"openai": "",
"anthropic": "",
"google": "",
"byteplus": "6aa60576-c6ef-4835-a77a-f7e51d0637ef"
"byteplus": ""
},
"endpoints": {
"remote_model_url": "",
Expand Down Expand Up @@ -64,5 +64,11 @@
"browser": {
"port": 7926,
"startup_ui": false
},
"api_keys_configured": {
"openai": false,
"anthropic": false,
"google": true,
"byteplus": true
}
}
82 changes: 50 additions & 32 deletions app/ui_layer/browser/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/ui_layer/browser/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
},
"dependencies": {
"@tanstack/react-virtual": "^3.10.0",
"lucide-react": "^0.344.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
14 changes: 11 additions & 3 deletions app/ui_layer/browser/frontend/src/components/layout/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { IconButton } from '../ui'
import { useTheme } from '../../contexts/ThemeContext'
import { useWebSocket } from '../../contexts/WebSocketContext'
import { StatusIndicator } from '../ui/StatusIndicator'
import { useDerivedAgentStatus } from '../../hooks'
import styles from './TopBar.module.css'

// Simple Discord icon component since lucide-react doesn't have it
Expand All @@ -18,7 +19,14 @@ function DiscordIcon() {

export function TopBar() {
const { theme, toggleTheme } = useTheme()
const { connected, status } = useWebSocket()
const { connected, actions, messages } = useWebSocket()

// Derive agent status from actions and messages
const derivedStatus = useDerivedAgentStatus({
actions,
messages,
connected,
})

return (
<header className={styles.topBar}>
Expand All @@ -32,12 +40,12 @@ export function TopBar() {
</div>
<div className={styles.status}>
<StatusIndicator
status={connected ? status.state : 'error'}
status={derivedStatus.state}
size="sm"
variant="dot"
/>
<span className={styles.statusText}>
{connected ? status.message : 'Disconnected'}
{derivedStatus.message}
</span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { memo } from 'react'
import ReactMarkdown from 'react-markdown'
import remarkGfm from 'remark-gfm'
import remarkBreaks from 'remark-breaks'
Expand All @@ -9,12 +9,12 @@ interface MarkdownContentProps {
className?: string
}

export function MarkdownContent({ content, className = '' }: MarkdownContentProps) {
export const MarkdownContent = memo(function MarkdownContent({ content, className = '' }: MarkdownContentProps) {
return (
<div className={`${styles.markdown} ${className}`}>
<ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]}>
{content}
</ReactMarkdown>
</div>
)
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
.dot_working,
.dot_thinking,
.dot_running {
background: var(#ff4f18, #ff9878);
background: #ff4f18;
}

.dot_error,
Expand Down
34 changes: 34 additions & 0 deletions app/ui_layer/browser/frontend/src/contexts/WebSocketContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ interface WebSocketState {
onboardingStep: OnboardingStep | null
onboardingError: string | null
onboardingLoading: boolean
// Unread message tracking
lastSeenMessageId: string | null
}

interface WebSocketContextType extends WebSocketState {
Expand All @@ -42,6 +44,17 @@ interface WebSocketContextType extends WebSocketState {
submitOnboardingStep: (value: string | string[]) => void
skipOnboardingStep: () => void
goBackOnboardingStep: () => void
// Unread message tracking
markMessagesAsSeen: () => void
}

// Initialize lastSeenMessageId from localStorage
const getInitialLastSeenMessageId = (): string | null => {
try {
return localStorage.getItem('lastSeenMessageId')
} catch {
return null
}
}

const defaultState: WebSocketState = {
Expand Down Expand Up @@ -71,6 +84,8 @@ const defaultState: WebSocketState = {
onboardingStep: null,
onboardingError: null,
onboardingLoading: false,
// Unread message tracking
lastSeenMessageId: getInitialLastSeenMessageId(),
}

const WebSocketContext = createContext<WebSocketContextType | undefined>(undefined)
Expand Down Expand Up @@ -524,6 +539,24 @@ export function WebSocketProvider({ children }: { children: ReactNode }) {
}
}, [])

// Mark all current messages as seen
const markMessagesAsSeen = useCallback(() => {
setState(prev => {
if (prev.messages.length > 0) {
const lastId = prev.messages[prev.messages.length - 1].messageId
if (lastId && lastId !== prev.lastSeenMessageId) {
try {
localStorage.setItem('lastSeenMessageId', lastId)
} catch {
// localStorage may be unavailable
}
return { ...prev, lastSeenMessageId: lastId }
}
}
return prev
})
}, [])

return (
<WebSocketContext.Provider
value={{
Expand All @@ -539,6 +572,7 @@ export function WebSocketProvider({ children }: { children: ReactNode }) {
submitOnboardingStep,
skipOnboardingStep,
goBackOnboardingStep,
markMessagesAsSeen,
}}
>
{children}
Expand Down
1 change: 1 addition & 0 deletions app/ui_layer/browser/frontend/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { useConfirmModal } from './useConfirmModal'
export type { ConfirmModalState, ConfirmOptions } from './useConfirmModal'
export { useDerivedAgentStatus } from './useDerivedAgentStatus'
Loading