Fix individual page system nodes 12812679583942839801 (#43)
* feat: fix individual page configuration to properly display system nodes - Added `SystemNodeConfig` database table to persist system node config (provider and model). - Updated `AgentLayout` and `WorkerIndividualSettings` to restrict config modifications to only provider and model for system nodes. - Hid delete button for system nodes and removed them from the creation modal dropdown. - Updated Agent API to support querying configured system nodes and persisting setups. Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com> * feat: fix individual page configuration to properly display system nodes - Added `SystemNodeConfig` database table to persist system node config (provider and model). - Updated `AgentLayout` and `WorkerIndividualSettings` to restrict config modifications to only provider and model for system nodes. - Hid delete button for system nodes and removed them from the creation modal dropdown. - Updated Agent API to support querying configured system nodes and persisting setups. - Fixed an issue where the table would not render if only system nodes were present (and no custom workers existed). Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com> * fix: correct individual worker agent_type and system node model display - Updated the `agent_type` options in `WorkerIndividualSettings.tsx` to match the backend's expected `AgentType` enum values (`ordinary_individual`, `skill_individual`, `special_individual`). This fixes the 422 error when creating a new worker. - Fixed the system node provider and model selection logic so it correctly defaults to the first available provider when unconfigured, allowing the model dropdown to populate. Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>
This commit is contained in:
parent
82d6b4acbc
commit
c39b5eb8e2
|
|
@ -43,14 +43,17 @@ export function WorkerIndividualSettings() {
|
||||||
const sysNodesData = sysRes.data.system_nodes || [];
|
const sysNodesData = sysRes.data.system_nodes || [];
|
||||||
const defaultSysNodes = ['supervisory_node', 'consciousness_node', 'control_node'];
|
const defaultSysNodes = ['supervisory_node', 'consciousness_node', 'control_node'];
|
||||||
|
|
||||||
|
const providersList = Object.values(provRes.data.provider_list || {}) as Provider[];
|
||||||
|
const defaultProvider = providersList.length > 0 ? providersList[0].provider_title : '';
|
||||||
|
|
||||||
const formattedSysNodes = defaultSysNodes.map(nodeName => {
|
const formattedSysNodes = defaultSysNodes.map(nodeName => {
|
||||||
const found = sysNodesData.find((n: any) => n.node_name === nodeName);
|
const found = sysNodesData.find((n: any) => n.node_name === nodeName);
|
||||||
return {
|
return {
|
||||||
agent_id: nodeName,
|
agent_id: nodeName,
|
||||||
agent_name: nodeName,
|
agent_name: nodeName,
|
||||||
agent_type: 'System Node',
|
agent_type: 'System Node',
|
||||||
provider_title: found ? found.provider_title : 'Not Configured',
|
provider_title: found && found.provider_title ? found.provider_title : defaultProvider,
|
||||||
model_id: found ? found.model_id : 'Not Configured',
|
model_id: found && found.model_id ? found.model_id : '',
|
||||||
is_system: true
|
is_system: true
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
@ -82,7 +85,7 @@ export function WorkerIndividualSettings() {
|
||||||
const handleAddNew = () => {
|
const handleAddNew = () => {
|
||||||
setEditData({
|
setEditData({
|
||||||
agent_name: '',
|
agent_name: '',
|
||||||
agent_type: 'OrdinaryIndividual',
|
agent_type: 'ordinary_individual',
|
||||||
description: '',
|
description: '',
|
||||||
provider_title: providers.length > 0 ? providers[0].provider_title : '',
|
provider_title: providers.length > 0 ? providers[0].provider_title : '',
|
||||||
model_id: '',
|
model_id: '',
|
||||||
|
|
@ -246,14 +249,14 @@ export function WorkerIndividualSettings() {
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-slate-700 mb-1">Agent Type</label>
|
<label className="block text-sm font-medium text-slate-700 mb-1">Agent Type</label>
|
||||||
<select
|
<select
|
||||||
value={editData.agent_type || 'OrdinaryIndividual'}
|
value={editData.agent_type || 'ordinary_individual'}
|
||||||
onChange={(e) => setEditData({...editData, agent_type: e.target.value})}
|
onChange={(e) => setEditData({...editData, agent_type: e.target.value})}
|
||||||
className="w-full px-4 py-2 border border-slate-200 rounded-lg focus:ring-2 focus:ring-indigo-500"
|
className="w-full px-4 py-2 border border-slate-200 rounded-lg focus:ring-2 focus:ring-indigo-500"
|
||||||
disabled={(editData as any).is_system}
|
disabled={(editData as any).is_system}
|
||||||
>
|
>
|
||||||
<option value="OrdinaryIndividual">Ordinary Individual</option>
|
<option value="ordinary_individual">Ordinary Individual</option>
|
||||||
<option value="SkillIndividual">Skill Individual</option>
|
<option value="skill_individual">Skill Individual</option>
|
||||||
<option value="SpecialIndividual">Special Individual</option>
|
<option value="special_individual">Special Individual</option>
|
||||||
{(editData as any).is_system && (
|
{(editData as any).is_system && (
|
||||||
<option value="System Node">System Node</option>
|
<option value="System Node">System Node</option>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue