Spaces:
Runtime error
Runtime error
Download frontend-react/src/components/workflow/ScenarioComposer.jsx from Amitkasar/ai-api-testing: direct link, hf CLI and curl.
- Browser
- Download file 2.34 kB
-
https://huggingface.co/spaces/Amitkasar/ai-api-testing/resolve/main/frontend-react/src/components/workflow/ScenarioComposer.jsx
- Command line
-
hf download hf://spaces/Amitkasar/ai-api-testing/frontend-react/src/components/workflow/ScenarioComposer.jsx
-
curl -L -o ScenarioComposer.jsx https://huggingface.co/spaces/Amitkasar/ai-api-testing/resolve/main/frontend-react/src/components/workflow/ScenarioComposer.jsx
2.34 kB
| import React from 'react'; | |
| import { RefreshCw, Sparkles, FilePlus } from 'lucide-react'; | |
| export default function ScenarioComposer({ | |
| scenario, setScenario, | |
| activeSpecId, activeSpecName, | |
| isPlanning, | |
| onGenerate, | |
| onNewPlan, | |
| hasPlan, | |
| }) { | |
| return ( | |
| <div style={{ borderTop: '1px solid var(--line-1)', background: 'var(--bg-1)', flexShrink: 0 }}> | |
| <div style={{ maxWidth: 900, margin: '0 auto', padding: '14px 32px' }}> | |
| <div className="composer"> | |
| <div className="composer-head"> | |
| <span className="dot"/> | |
| <span>scenario.txt</span> | |
| {activeSpecName && activeSpecName !== 'None' && ( | |
| <><span style={{ color: 'var(--fg-4)' }}>·</span><span style={{ color: 'var(--fg-3)' }}>{activeSpecName}</span></> | |
| )} | |
| </div> | |
| <textarea | |
| rows={2} | |
| placeholder={activeSpecId | |
| ? "Describe a test scenario, e.g. 'Sign in, create an order, charge it, verify paid'" | |
| : "Load a spec from the sidebar to begin"} | |
| disabled={!activeSpecId || isPlanning} | |
| value={scenario} | |
| onChange={e => setScenario(e.target.value)} | |
| onKeyDown={e => { | |
| if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') { | |
| e.preventDefault(); | |
| onGenerate(); | |
| } | |
| }} | |
| /> | |
| <div className="composer-foot"> | |
| <div className="hint"> | |
| <kbd>⌘</kbd><kbd>↵</kbd> generate plan | |
| </div> | |
| {hasPlan && onNewPlan && ( | |
| <button className="btn btn-ghost" onClick={onNewPlan} title="Clear current plan and start fresh"> | |
| <FilePlus size={13}/> New Plan | |
| </button> | |
| )} | |
| <button className="btn btn-ghost" onClick={() => setScenario('')}>Clear</button> | |
| <button | |
| onClick={onGenerate} | |
| disabled={!activeSpecId || isPlanning || !scenario.trim()} | |
| className="btn btn-primary" | |
| > | |
| {isPlanning | |
| ? <><RefreshCw size={13} style={{ animation: 'spin 1s linear infinite' }}/> Planning…</> | |
| : <><Sparkles size={13}/> Generate plan</>} | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| } | |