diff --git a/frontend/src/pages/Admin/Agents/index.jsx b/frontend/src/pages/Admin/Agents/index.jsx index 7d550601..b07e3162 100644 --- a/frontend/src/pages/Admin/Agents/index.jsx +++ b/frontend/src/pages/Admin/Agents/index.jsx @@ -7,55 +7,57 @@ import CTAButton from "@/components/lib/CTAButton"; import AgentWebSearchSelection from "./WebSearchSelection"; import AgentSQLConnectorSelection from "./SQLConnectorSelection"; import GenericSkill from "./GenericSkill"; +import { CaretRight, Robot } from "@phosphor-icons/react"; -const skillComponents = { - "web-search": AgentWebSearchSelection, - "sql-connector": AgentSQLConnectorSelection, - "rag-memory": GenericSkill, - "view-summarize": GenericSkill, - "scrape-websites": GenericSkill, - "create-chart": GenericSkill, - "save-file": GenericSkill, -}; - -const skillSettings = { - "web-search": { - title: "Web Search", - }, - "sql-connector": { - title: "SQL Connector", - }, +const defaultSkills = { "rag-memory": { title: "RAG & long-term memory", description: 'Allow the agent to leverage your local documents to answer a query or ask the agent to "remember" pieces of content for long-term memory retrieval.', enabled: true, - disabled: true, + component: GenericSkill, }, "view-summarize": { title: "View & summarize documents", description: "Allow the agent to list and summarize the content of workspace files currently embedded.", enabled: true, - disabled: true, + component: GenericSkill, }, "scrape-websites": { title: "Scrape websites", description: "Allow the agent to visit and scrape the content of websites.", enabled: true, - disabled: true, + component: GenericSkill, + }, +}; + +const configurableSkills = { + "web-search": { + title: "Web Search", + component: AgentWebSearchSelection, + enabled: true, + }, + "sql-connector": { + title: "SQL Connector", + component: AgentSQLConnectorSelection, + enabled: true, }, "create-chart": { title: "Generate charts", description: "Enable the default agent to generate various types of charts from data provided or given in chat.", skill: "create-chart", + component: GenericSkill, + enabled: true, }, "save-file": { title: "Generate & save files to browser", description: "Enable the default agent to generate and write to files that save and can be downloaded in your browser.", skill: "save-file-to-browser", + component: GenericSkill, + enabled: true, }, }; @@ -63,7 +65,7 @@ export default function AdminAgents() { const [saving, setSaving] = useState(false); const [hasChanges, setHasChanges] = useState(false); const [settings, setSettings] = useState({}); - const [selectedSkill, setSelectedSkill] = useState("web-search"); + const [selectedSkill, setSelectedSkill] = useState(""); const [agentSkills, setAgentSkills] = useState([]); const handleSubmit = async (e) => { @@ -82,6 +84,7 @@ export default function AdminAgents() { async function fetchSettings() { const _settings = await Admin.systemPreferences(); setSettings(_settings?.settings ?? {}); + console.log("default_agent_skills", _settings?.settings); setAgentSkills(_settings?.settings?.default_agent_skills ?? []); } fetchSettings(); @@ -96,66 +99,108 @@ export default function AdminAgents() { }); } - const SelectedSkillComponent = skillComponents[selectedSkill]; + const SelectedSkillComponent = + configurableSkills[selectedSkill]?.component || + defaultSkills[selectedSkill]?.component; return (
-
-
-
-

- Available Agents -

+
+ {/* Skill settings nav */} +
+
+ +

Agent Skills

-

- Improve the natural abilities of the default agent with these - pre-built skills. This setup applies to all workspaces. -

-
- {hasChanges && ( -
- - {saving ? "Saving..." : "Save changes"} - -
- )} -
-
- {Object.keys(skillComponents).map((skill) => ( - +
{settings.title}
+ +
))}
-
-
- + + {/* Configurable skills */} +
+ {Object.entries(configurableSkills).map( + ([skill, settings], index) => ( +
setSelectedSkill(skill)} + > +
{settings.title}
+
+
+ {settings.enabled ? "On" : "Off"} +
+ + +
+
+ ) + )}
- + + {/* Selected agent skill */} +
+
+ {SelectedSkillComponent ? ( + + ) : ( +
+ +

Select an agent skill

+
+ )} +
+
+
);