feat: improve Gradio agent runtime

#2
by themva - opened
Files changed (2) hide show
  1. .claude/settings.local.json +21 -0
  2. src/App.tsx +35 -26
.claude/settings.local.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(grep -v '^$')",
5
+ "Bash(curl -s -m 12 -A 'Mozilla/5.0 \\(Windows NT 10.0; Win64; x64\\) AppleWebKit/537.36 \\(KHTML, like Gecko\\) Chrome/120.0.0.0 Safari/537.36' https://www.mojeek.com/search?q=East+York+Toronto+apartment+for+rent)",
6
+ "Bash(curl -s -m 25 \"https://s.jina.ai/?q=East%20York%20Toronto%201%20bedroom%20apartment%20for%20rent\" -H \"Accept: application/json\" -H \"X-Respond-With: no-content\")",
7
+ "Bash(echo \"=== exit:$? ===\")",
8
+ "Bash(curl -s -m 25 \"https://r.jina.ai/https://rentals.ca/toronto/east-york\")",
9
+ "Bash(node server/open-websearch-mcp.mjs)",
10
+ "Bash(python3 -c ' *)",
11
+ "Bash(command -v llama-server)",
12
+ "Bash(echo \"llama-server: $\\(command -v llama-server || echo MISSING\\)\")",
13
+ "Bash(command -v brew)",
14
+ "Bash(echo \"brew: $\\(command -v brew || echo MISSING\\)\")",
15
+ "Bash(python3 -c 'import llama_cpp; print\\(\"yes\"\\)')",
16
+ "Bash(brew install *)",
17
+ "Bash(llama-server --version)",
18
+ "Bash(curl -s -m 20 \"https://huggingface.co/api/models?author=openbmb&search=GGUF&limit=30\")"
19
+ ]
20
+ }
21
+ }
src/App.tsx CHANGED
@@ -115,6 +115,7 @@ const SUGGESTED_PROMPTS: Array<{ label: string; prompt: string }> = [
115
 
116
  export default function App() {
117
  const [prompt, setPrompt] = useState("");
 
118
  const [parsed, setParsed] = useState<ParsedPrompt>(initialParsed);
119
  const [ranked, setRanked] = useState<RankedNeighborhood[]>(initialRanked);
120
  const [selectedId, setSelectedId] = useState(initialRanked[0].id);
@@ -156,7 +157,10 @@ export default function App() {
156
  );
157
 
158
  const activeLayer = activeLayerFromNav(navMode);
159
- const showRail = phase === "running" || agentPanelOpen;
 
 
 
160
  const tourFocusName = tourFocusId
161
  ? ranked.find((neighborhood) => neighborhood.id === tourFocusId)?.name
162
  : null;
@@ -183,6 +187,7 @@ export default function App() {
183
 
184
  clearSchedules();
185
  // The prompt is in flight; clear the composer so the next ask starts from a blank box.
 
186
  setPrompt("");
187
  setParsed(nextParsed);
188
  setRanked(nextRanked);
@@ -359,8 +364,8 @@ export default function App() {
359
  return (
360
  <main className={`app-shell ${mapFocus ? "map-focus" : ""}`}>
361
  <MapCanvas
362
- ranked={ranked}
363
- selectedId={selected.id}
364
  researchTour={researchTour}
365
  tourFocusId={tourFocusId}
366
  activeLayer={activeLayer}
@@ -432,29 +437,33 @@ export default function App() {
432
  </div>
433
  </section>
434
 
435
- <div className={`active-layer-chip ${phase === "running" ? "running" : ""}`}>
436
- <span />
437
- <small>{activeChipLead}</small>
438
- <strong>{activeChipDetail}</strong>
439
- </div>
 
 
440
 
441
- <div className="top-actions">
442
- <button type="button" onClick={() => setMapFocus((current) => !current)}>
443
- {mapFocus ? <Maximize2 size={16} /> : <Minimize2 size={16} />}
444
- {mapFocus ? "Panels" : "Map"}
445
- </button>
446
- <button type="button">
447
- <SlidersHorizontal size={16} />
448
- Filters
449
- </button>
450
- <button type="button" onClick={() => setCompareOpen(true)}>
451
- <Heart size={16} />
452
- Saved
453
- <b>{compare.length}</b>
454
- </button>
455
- </div>
 
 
456
 
457
- {mapFocus ? (
458
  <button type="button" className="collapsed-panel-tab left" onClick={() => setMapFocus(false)}>
459
  <Layers size={16} />
460
  <span>Areas</span>
@@ -498,7 +507,7 @@ export default function App() {
498
  </aside>
499
  )}
500
 
501
- {mapFocus ? (
502
  <button type="button" className="collapsed-panel-tab right" onClick={() => setMapFocus(false)}>
503
  {showRail ? <Users size={16} /> : <Shield size={16} />}
504
  <span>{showRail ? "Agents" : selected.name}</span>
@@ -527,7 +536,7 @@ export default function App() {
527
  />
528
  )}
529
 
530
- {compareOpen && (
531
  <CompareModal
532
  ranked={ranked}
533
  selectedId={selected.id}
 
115
 
116
  export default function App() {
117
  const [prompt, setPrompt] = useState("");
118
+ const [hasRun, setHasRun] = useState(false);
119
  const [parsed, setParsed] = useState<ParsedPrompt>(initialParsed);
120
  const [ranked, setRanked] = useState<RankedNeighborhood[]>(initialRanked);
121
  const [selectedId, setSelectedId] = useState(initialRanked[0].id);
 
157
  );
158
 
159
  const activeLayer = activeLayerFromNav(navMode);
160
+ const panelsVisible = hasRun || phase === "running";
161
+ const visibleRanked = panelsVisible ? ranked : [];
162
+ const visibleSelectedId = panelsVisible ? selected.id : "";
163
+ const showRail = panelsVisible && (phase === "running" || agentPanelOpen);
164
  const tourFocusName = tourFocusId
165
  ? ranked.find((neighborhood) => neighborhood.id === tourFocusId)?.name
166
  : null;
 
187
 
188
  clearSchedules();
189
  // The prompt is in flight; clear the composer so the next ask starts from a blank box.
190
+ setHasRun(true);
191
  setPrompt("");
192
  setParsed(nextParsed);
193
  setRanked(nextRanked);
 
364
  return (
365
  <main className={`app-shell ${mapFocus ? "map-focus" : ""}`}>
366
  <MapCanvas
367
+ ranked={visibleRanked}
368
+ selectedId={visibleSelectedId}
369
  researchTour={researchTour}
370
  tourFocusId={tourFocusId}
371
  activeLayer={activeLayer}
 
437
  </div>
438
  </section>
439
 
440
+ {panelsVisible ? (
441
+ <>
442
+ <div className={`active-layer-chip ${phase === "running" ? "running" : ""}`}>
443
+ <span />
444
+ <small>{activeChipLead}</small>
445
+ <strong>{activeChipDetail}</strong>
446
+ </div>
447
 
448
+ <div className="top-actions">
449
+ <button type="button" onClick={() => setMapFocus((current) => !current)}>
450
+ {mapFocus ? <Maximize2 size={16} /> : <Minimize2 size={16} />}
451
+ {mapFocus ? "Panels" : "Map"}
452
+ </button>
453
+ <button type="button">
454
+ <SlidersHorizontal size={16} />
455
+ Filters
456
+ </button>
457
+ <button type="button" onClick={() => setCompareOpen(true)}>
458
+ <Heart size={16} />
459
+ Saved
460
+ <b>{compare.length}</b>
461
+ </button>
462
+ </div>
463
+ </>
464
+ ) : null}
465
 
466
+ {!panelsVisible ? null : mapFocus ? (
467
  <button type="button" className="collapsed-panel-tab left" onClick={() => setMapFocus(false)}>
468
  <Layers size={16} />
469
  <span>Areas</span>
 
507
  </aside>
508
  )}
509
 
510
+ {!panelsVisible ? null : mapFocus ? (
511
  <button type="button" className="collapsed-panel-tab right" onClick={() => setMapFocus(false)}>
512
  {showRail ? <Users size={16} /> : <Shield size={16} />}
513
  <span>{showRail ? "Agents" : selected.name}</span>
 
536
  />
537
  )}
538
 
539
+ {panelsVisible && compareOpen && (
540
  <CompareModal
541
  ranked={ranked}
542
  selectedId={selected.id}