File size: 1,341 Bytes
20ec4ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { useLocalStorage } from "react-use";
import agentsJson from "../../../agents.json";

export default function AgentConfig() {
  const [cfg, setCfg] = useLocalStorage("agentsConfig", agentsJson);

  const updateModel = (id: string, model: string) => {
    setCfg(
      (cfg as any[]).map((a) =>
        a.id === id
          ? {
              ...a,
              model,
            }
          : a
      )
    );
  };

  return (
    <div className="h-full overflow-auto bg-gray-900 text-gray-200 p-4">
      <h2 className="text-lg font-semibold mb-4">Configuração de Agentes</h2>
      {(cfg as any[]).map((a: any) => (
        <div key={a.id} className="mb-6">
          <h3 className="font-medium">{a.name}</h3>
          <label className="block mt-2">
            <span>Modelo</span>
            <select
              value={a.model}
              onChange={(e) => updateModel(a.id, e.target.value)}
              className="mt-1 block w-full bg-gray-800 p-2 rounded text-white"
            >
              <option value="deepsite">DeepSeek (grátis)</option>
              <option value="gpt-4o-mini">ChatGPT 4O</option>
              <option value="text-bison-001">Gemini</option>
              <option value="claude-3.7">Claude 3.7</option>
            </select>
          </label>
        </div>
      ))}
    </div>
  );
}