diff --git a/src/pages/agent-office/assets/agent_insta.png b/src/pages/agent-office/assets/agent_insta.png deleted file mode 100644 index 39bb0e8..0000000 Binary files a/src/pages/agent-office/assets/agent_insta.png and /dev/null differ diff --git a/src/pages/agent-office/assets/agent_lotto.png b/src/pages/agent-office/assets/agent_lotto.png deleted file mode 100644 index 63ccb1c..0000000 Binary files a/src/pages/agent-office/assets/agent_lotto.png and /dev/null differ diff --git a/src/pages/agent-office/assets/agent_music.png b/src/pages/agent-office/assets/agent_music.png deleted file mode 100644 index 63ae064..0000000 Binary files a/src/pages/agent-office/assets/agent_music.png and /dev/null differ diff --git a/src/pages/agent-office/assets/agent_realestate.png b/src/pages/agent-office/assets/agent_realestate.png deleted file mode 100644 index b4c90f2..0000000 Binary files a/src/pages/agent-office/assets/agent_realestate.png and /dev/null differ diff --git a/src/pages/agent-office/assets/agent_stock.png b/src/pages/agent-office/assets/agent_stock.png deleted file mode 100644 index 1ea220f..0000000 Binary files a/src/pages/agent-office/assets/agent_stock.png and /dev/null differ diff --git a/src/pages/agent-office/assets/agent_undetermined.png b/src/pages/agent-office/assets/agent_undetermined.png deleted file mode 100644 index 14f532e..0000000 Binary files a/src/pages/agent-office/assets/agent_undetermined.png and /dev/null differ diff --git a/src/pages/agent-office/components/CommandTab.jsx b/src/pages/agent-office/components/CommandTab.jsx index 4e6806d..aebf86e 100644 --- a/src/pages/agent-office/components/CommandTab.jsx +++ b/src/pages/agent-office/components/CommandTab.jsx @@ -5,7 +5,7 @@ import { sendAgentCommand, approveAgentTask } from '../../../api'; const QUICK_ACTIONS = { stock: [{ action: 'fetch_news', label: 'Fetch News' }, { action: 'test_telegram', label: 'Test Telegram' }], music: [{ action: 'credits', label: 'Check Credits' }], - blog: [{ action: 'list_trend_keywords', label: 'List Keywords' }], + insta: [{ action: 'extract', label: 'Extract News' }, { action: 'collect_trends', label: 'Collect Trends' }], realestate: [{ action: 'dashboard', label: 'Dashboard' }], lotto: [{ action: 'status', label: 'Status' }, { action: 'curate_now', label: 'Curate Now' }] }; @@ -13,7 +13,7 @@ const QUICK_ACTIONS = { const PARAM_ACTIONS = { stock: { action: 'add_alert', label: 'Add Alert', placeholder: '{"symbol":"005930","target_price":70000,"direction":"above"}' }, music: { action: 'compose', label: 'Compose', placeholder: 'jazzy lo-fi piano beat' }, - blog: { action: 'research', label: 'Research', placeholder: 'keyword to research' }, + insta: { action: 'render', label: 'Render Slate', placeholder: 'keyword_id (예: 42)' }, realestate: { action: 'fetch_matches', label: 'Fetch Matches', placeholder: '' }, lotto: null }; @@ -46,6 +46,8 @@ export default function CommandTab({ agentId, agentState, pendingTask, onCommand params = { prompt: paramInput }; } else if (paramAction.action === 'research') { params = { keyword: paramInput }; + } else if (paramAction.action === 'render') { + params = { keyword_id: parseInt(paramInput, 10) }; } else { try { params = JSON.parse(paramInput); } catch { params = { value: paramInput }; } } @@ -87,7 +89,7 @@ export default function CommandTab({ agentId, agentState, pendingTask, onCommand return (
{/* 승인 대기 UI */} - {agentState === 'waiting' && pendingTask && ( + {agentState === 'waiting_approval' && pendingTask && (
Awaiting Approval
{pendingTask.task_type}: {pendingTask.detail || JSON.stringify(pendingTask.input_data)}
diff --git a/src/pages/agent-office/components/CommandTab.test.jsx b/src/pages/agent-office/components/CommandTab.test.jsx new file mode 100644 index 0000000..d64a658 --- /dev/null +++ b/src/pages/agent-office/components/CommandTab.test.jsx @@ -0,0 +1,51 @@ +import { describe, it, expect, vi } from 'vitest'; +import { render, screen } from '@testing-library/react'; +import CommandTab from './CommandTab.jsx'; + +vi.mock('../../../api', () => ({ + sendAgentCommand: vi.fn(), + approveAgentTask: vi.fn(), +})); + +describe('CommandTab approval card', () => { + const samplePendingTask = { + id: 'task-123', + task_type: 'lotto_briefing', + input_data: { draw_no: 1234 }, + }; + + it('agentState가 waiting_approval이고 pendingTask가 있으면 승인 카드를 표시', () => { + render( + + ); + expect(screen.getByText('Awaiting Approval')).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Approve' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Reject' })).toBeInTheDocument(); + }); + + it('agentState가 working이면 승인 카드를 표시하지 않음', () => { + render( + + ); + expect(screen.queryByText('Awaiting Approval')).toBeNull(); + }); + + it('pendingTask가 null이면 waiting_approval이어도 승인 카드를 표시하지 않음', () => { + render( + + ); + expect(screen.queryByText('Awaiting Approval')).toBeNull(); + }); +});