feat(agents): Create group of agents (#82)

* feat(ui): add section to create agents in group

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Enhance UX and do not display first form section

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* fixups

* Small fixups on avatar creation

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto
2025-03-22 21:41:51 +01:00
committed by GitHub
parent 3a921f6241
commit 3a9169bdbe
5 changed files with 648 additions and 13 deletions

View File

@@ -149,6 +149,7 @@ func (a *AgentPool) CreateAgent(name string, agentConfig *AgentConfig) error {
a.Lock()
defer a.Unlock()
name = replaceInvalidChars(name)
agentConfig.Name = name
if _, ok := a.pool[name]; ok {
return fmt.Errorf("agent %s already exists", name)
}
@@ -157,17 +158,17 @@ func (a *AgentPool) CreateAgent(name string, agentConfig *AgentConfig) error {
return err
}
go func() {
go func(ac AgentConfig) {
// Create the agent avatar
if err := a.createAgentAvatar(agentConfig); err != nil {
if err := a.createAgentAvatar(ac); err != nil {
xlog.Error("Failed to create agent avatar", "error", err)
}
}()
}(*agentConfig)
return a.startAgentWithConfig(name, agentConfig)
}
func (a *AgentPool) createAgentAvatar(agent *AgentConfig) error {
func (a *AgentPool) createAgentAvatar(agent AgentConfig) error {
client := llm.NewClient(a.apiKey, a.apiURL+"/v1", "10m")
if a.imageModel == "" {