Spaces:
Sleeping
Sleeping
ashishMenon05 commited on
Commit ·
68fba27
1
Parent(s): 26f67bb
fix(frontend): correct syntax errors in SettingsView for Tailwind v4 compatibility
Browse files
frontend/src/views/SettingsView.jsx
CHANGED
|
@@ -292,19 +292,32 @@ const SettingsView = () => {
|
|
| 292 |
setAgents(prev => prev.filter((_, i) => i !== index));
|
| 293 |
};
|
| 294 |
|
| 295 |
-
const ProviderToggle = ({ agent, index }) =>
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
|
| 309 |
return (
|
| 310 |
<div className="space-y-12 animate-in fade-in duration-500">
|
|
@@ -323,14 +336,9 @@ const SettingsView = () => {
|
|
| 323 |
</div>
|
| 324 |
</section>
|
| 325 |
|
| 326 |
-
<div className="md:
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
<div className="flex-1 h-px bg-primary/10"></div>
|
| 330 |
-
</div>
|
| 331 |
-
<div className="grid grid-cols-1 md:grid-cols-12 gap-6 items-stretch max-h-[1200px] overflow-y-auto pr-2 custom-scrollbar p-1">
|
| 332 |
-
{/* N-Agents Render */}
|
| 333 |
-
{agents.map((agent, index) => {
|
| 334 |
const isPrimary = index % 2 === 0;
|
| 335 |
const accentColor = isPrimary ? 'primary' : 'secondary';
|
| 336 |
const titleColor = isPrimary ? 'text-primary' : 'text-secondary';
|
|
@@ -378,7 +386,7 @@ const SettingsView = () => {
|
|
| 378 |
<div className="space-y-2">
|
| 379 |
<label className="font-mono text-[10px] tracking-widest text-slate-400 uppercase">OpenAI API Key</label>
|
| 380 |
<input
|
| 381 |
-
className={
|
| 382 |
placeholder="sk-..."
|
| 383 |
type="password"
|
| 384 |
value={openaiKey}
|
|
@@ -388,7 +396,7 @@ const SettingsView = () => {
|
|
| 388 |
<div className="space-y-2">
|
| 389 |
<label className="font-mono text-[10px] tracking-widest text-slate-400 uppercase">OpenAI Model Name</label>
|
| 390 |
<input
|
| 391 |
-
className={
|
| 392 |
placeholder="gpt-4o"
|
| 393 |
type="text"
|
| 394 |
value={agent.openaiModel}
|
|
@@ -403,7 +411,7 @@ const SettingsView = () => {
|
|
| 403 |
<span className={`font-mono text-xs ${titleColor} font-bold`}>{agent.temp.toFixed(1)}</span>
|
| 404 |
</div>
|
| 405 |
<input
|
| 406 |
-
className=
|
| 407 |
max="1" min="0" step="0.1" type="range"
|
| 408 |
value={agent.temp}
|
| 409 |
onChange={e => handleUpdateAgent(index, a => ({ ...a, temp: parseFloat(e.target.value) }))}
|
|
@@ -412,7 +420,7 @@ const SettingsView = () => {
|
|
| 412 |
<div className="space-y-4 pt-4 border-t border-white/5">
|
| 413 |
<label className="font-mono text-[10px] tracking-widest text-slate-400 uppercase">Operational Role</label>
|
| 414 |
<select
|
| 415 |
-
className={
|
| 416 |
value={agent.role}
|
| 417 |
onChange={e => handleUpdateAgent(index, a => ({ ...a, role: e.target.value }))}
|
| 418 |
>
|
|
@@ -428,7 +436,7 @@ const SettingsView = () => {
|
|
| 428 |
placeholder="e.g. DATABASE NINJA"
|
| 429 |
value={agent.customRoleName}
|
| 430 |
onChange={e => handleUpdateAgent(index, a => ({ ...a, customRoleName: e.target.value }))}
|
| 431 |
-
className={
|
| 432 |
/>
|
| 433 |
</div>
|
| 434 |
<div className="space-y-2">
|
|
@@ -439,7 +447,7 @@ const SettingsView = () => {
|
|
| 439 |
placeholder="You are an elite expert... Your objective is to..."
|
| 440 |
value={agent.customPrompt}
|
| 441 |
onChange={e => handleUpdateAgent(index, a => ({ ...a, customPrompt: e.target.value }))}
|
| 442 |
-
className={`w-full h-32 bg-surface-container-lowest ${titleColor} font-mono text-[10px] p-3 rounded border border-white/5 focus:
|
| 443 |
/>
|
| 444 |
</div>
|
| 445 |
</div>
|
|
@@ -449,15 +457,14 @@ const SettingsView = () => {
|
|
| 449 |
</div>
|
| 450 |
);
|
| 451 |
})}
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
<
|
| 459 |
-
|
| 460 |
-
</div>
|
| 461 |
|
| 462 |
{/* Execution Environment */}
|
| 463 |
<div className="md:col-span-12 glass-panel rounded-xl p-8 refractive-edge">
|
|
@@ -600,7 +607,7 @@ const SettingsView = () => {
|
|
| 600 |
<div className="flex items-center gap-4">
|
| 601 |
<button
|
| 602 |
onClick={() => {
|
| 603 |
-
setAgents([{ id: '
|
| 604 |
setMaxSteps(12);
|
| 605 |
}}
|
| 606 |
className="px-8 py-3 bg-surface-container-high text-on-surface-variant font-headline font-bold text-sm tracking-widest rounded hover:bg-surface-container-highest hover:text-white transition-all uppercase"
|
|
|
|
| 292 |
setAgents(prev => prev.filter((_, i) => i !== index));
|
| 293 |
};
|
| 294 |
|
| 295 |
+
const ProviderToggle = ({ agent, index }) => {
|
| 296 |
+
const getButtonClass = (p) => {
|
| 297 |
+
if (agent.provider === p) {
|
| 298 |
+
return index % 2 === 0 ? 'flex-1 py-1 px-3 rounded text-[10px] font-mono font-bold uppercase transition-all bg-primary text-black' : 'flex-1 py-1 px-3 rounded text-[10px] font-mono font-bold uppercase transition-all bg-secondary text-black';
|
| 299 |
+
}
|
| 300 |
+
return 'flex-1 py-1 px-3 rounded text-[10px] font-mono font-bold uppercase transition-all text-outline-variant hover:text-white';
|
| 301 |
+
};
|
| 302 |
+
const getProviderLabel = (p) => {
|
| 303 |
+
if (p === 'ollama') return 'Local Ollama';
|
| 304 |
+
if (p === 'hf') return 'Hugging Face';
|
| 305 |
+
return 'OpenAI';
|
| 306 |
+
};
|
| 307 |
+
return (
|
| 308 |
+
<div className="flex gap-2 p-1 bg-surface-container-highest rounded-lg border border-white/5">
|
| 309 |
+
{['ollama', 'hf', 'openai'].map(p => (
|
| 310 |
+
<button
|
| 311 |
+
key={p}
|
| 312 |
+
onClick={() => handleUpdateAgent(index, a => ({ ...a, provider: p }))}
|
| 313 |
+
className={getButtonClass(p)}
|
| 314 |
+
>
|
| 315 |
+
{getProviderLabel(p)}
|
| 316 |
+
</button>
|
| 317 |
+
))}
|
| 318 |
+
</div>
|
| 319 |
+
);
|
| 320 |
+
};
|
| 321 |
|
| 322 |
return (
|
| 323 |
<div className="space-y-12 animate-in fade-in duration-500">
|
|
|
|
| 336 |
</div>
|
| 337 |
</section>
|
| 338 |
|
| 339 |
+
<div className="grid grid-cols-1 md:grid-cols-12 gap-6 items-stretch">
|
| 340 |
+
{/* N-Agents Render */}
|
| 341 |
+
{agents.map((agent, index) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
const isPrimary = index % 2 === 0;
|
| 343 |
const accentColor = isPrimary ? 'primary' : 'secondary';
|
| 344 |
const titleColor = isPrimary ? 'text-primary' : 'text-secondary';
|
|
|
|
| 386 |
<div className="space-y-2">
|
| 387 |
<label className="font-mono text-[10px] tracking-widest text-slate-400 uppercase">OpenAI API Key</label>
|
| 388 |
<input
|
| 389 |
+
className={isPrimary ? 'w-full bg-transparent border-0 border-b border-primary/30 py-2 font-mono text-on-surface focus:outline-none focus:border-primary transition-all placeholder:text-slate-700' : 'w-full bg-transparent border-0 border-b border-secondary/30 py-2 font-mono text-on-surface focus:outline-none focus:border-secondary transition-all placeholder:text-slate-700'}
|
| 390 |
placeholder="sk-..."
|
| 391 |
type="password"
|
| 392 |
value={openaiKey}
|
|
|
|
| 396 |
<div className="space-y-2">
|
| 397 |
<label className="font-mono text-[10px] tracking-widest text-slate-400 uppercase">OpenAI Model Name</label>
|
| 398 |
<input
|
| 399 |
+
className={isPrimary ? 'w-full bg-transparent border-0 border-b border-primary/30 py-2 font-mono text-on-surface focus:outline-none focus:border-primary transition-all placeholder:text-slate-700' : 'w-full bg-transparent border-0 border-b border-secondary/30 py-2 font-mono text-on-surface focus:outline-none focus:border-secondary transition-all placeholder:text-slate-700'}
|
| 400 |
placeholder="gpt-4o"
|
| 401 |
type="text"
|
| 402 |
value={agent.openaiModel}
|
|
|
|
| 411 |
<span className={`font-mono text-xs ${titleColor} font-bold`}>{agent.temp.toFixed(1)}</span>
|
| 412 |
</div>
|
| 413 |
<input
|
| 414 |
+
className="w-full h-1.5 rounded-lg appearance-none cursor-pointer bg-surface-container-highest"
|
| 415 |
max="1" min="0" step="0.1" type="range"
|
| 416 |
value={agent.temp}
|
| 417 |
onChange={e => handleUpdateAgent(index, a => ({ ...a, temp: parseFloat(e.target.value) }))}
|
|
|
|
| 420 |
<div className="space-y-4 pt-4 border-t border-white/5">
|
| 421 |
<label className="font-mono text-[10px] tracking-widest text-slate-400 uppercase">Operational Role</label>
|
| 422 |
<select
|
| 423 |
+
className={isPrimary ? 'w-full bg-surface-container-lowest border-b border-primary/30 py-2 font-mono text-sm text-on-surface focus:outline-none focus:border-primary transition-all cursor-pointer' : 'w-full bg-surface-container-lowest border-b border-secondary/30 py-2 font-mono text-sm text-on-surface focus:outline-none focus:border-secondary transition-all cursor-pointer'}
|
| 424 |
value={agent.role}
|
| 425 |
onChange={e => handleUpdateAgent(index, a => ({ ...a, role: e.target.value }))}
|
| 426 |
>
|
|
|
|
| 436 |
placeholder="e.g. DATABASE NINJA"
|
| 437 |
value={agent.customRoleName}
|
| 438 |
onChange={e => handleUpdateAgent(index, a => ({ ...a, customRoleName: e.target.value }))}
|
| 439 |
+
className={isPrimary ? 'w-full bg-transparent border-0 border-b border-primary/30 py-2 font-mono text-sm text-on-surface focus:outline-none focus:border-primary transition-all placeholder:text-slate-700' : 'w-full bg-transparent border-0 border-b border-secondary/30 py-2 font-mono text-sm text-on-surface focus:outline-none focus:border-secondary transition-all placeholder:text-slate-700'}
|
| 440 |
/>
|
| 441 |
</div>
|
| 442 |
<div className="space-y-2">
|
|
|
|
| 447 |
placeholder="You are an elite expert... Your objective is to..."
|
| 448 |
value={agent.customPrompt}
|
| 449 |
onChange={e => handleUpdateAgent(index, a => ({ ...a, customPrompt: e.target.value }))}
|
| 450 |
+
className={`w-full h-32 bg-surface-container-lowest ${titleColor} font-mono text-[10px] p-3 rounded border border-white/5 focus:outline-none leading-relaxed`}
|
| 451 |
/>
|
| 452 |
</div>
|
| 453 |
</div>
|
|
|
|
| 457 |
</div>
|
| 458 |
);
|
| 459 |
})}
|
| 460 |
+
{(
|
| 461 |
+
<div className="md:col-span-12 flex justify-center mt-4">
|
| 462 |
+
<button onClick={addAgent} className="flex items-center gap-2 px-8 py-3 rounded-xl border border-dashed border-outline-variant/30 text-outline-variant font-mono text-xs uppercase hover:bg-surface-container-highest hover:text-white transition-all">
|
| 463 |
+
<span className="material-symbols-outlined text-[16px]">add</span>
|
| 464 |
+
<span>Add Agent Node</span>
|
| 465 |
+
</button>
|
| 466 |
+
</div>
|
| 467 |
+
)}
|
|
|
|
| 468 |
|
| 469 |
{/* Execution Environment */}
|
| 470 |
<div className="md:col-span-12 glass-panel rounded-xl p-8 refractive-edge">
|
|
|
|
| 607 |
<div className="flex items-center gap-4">
|
| 608 |
<button
|
| 609 |
onClick={() => {
|
| 610 |
+
setAgents([{ id: 'agent_a', provider: 'ollama', model: '', temp: 0.7, role: 'INVESTIGATOR' }]);
|
| 611 |
setMaxSteps(12);
|
| 612 |
}}
|
| 613 |
className="px-8 py-3 bg-surface-container-high text-on-surface-variant font-headline font-bold text-sm tracking-widest rounded hover:bg-surface-container-highest hover:text-white transition-all uppercase"
|