Enhance logging
This commit is contained in:
@@ -82,10 +82,13 @@ func New(opts ...Option) (*Agent, error) {
|
||||
// xlog = xlog.New(h)
|
||||
//programLevel.Set(a.options.logLevel)
|
||||
|
||||
xlog.Info("Agent in Debug mode", "agent", a.Character.Name)
|
||||
xlog.Info("Character", "agent", a.Character.Name, "character", a.Character.String())
|
||||
xlog.Info("State", "agent", a.Character.Name, "state", a.State().String())
|
||||
xlog.Info("Permanent goal", "agent", a.Character.Name, "goal", a.options.permanentGoal)
|
||||
xlog.Info(
|
||||
"Agent created",
|
||||
"agent", a.Character.Name,
|
||||
"character", a.Character.String(),
|
||||
"state", a.State().String(),
|
||||
"goal", a.options.permanentGoal,
|
||||
)
|
||||
|
||||
return a, nil
|
||||
}
|
||||
|
||||
@@ -37,14 +37,11 @@ func (a *AgentConfig) availableActions(ctx context.Context) []Action {
|
||||
actions := []Action{}
|
||||
|
||||
for _, action := range a.Actions {
|
||||
xlog.Info("Set Action", action)
|
||||
|
||||
var config map[string]string
|
||||
if err := json.Unmarshal([]byte(action.Config), &config); err != nil {
|
||||
xlog.Info("Error unmarshalling action config", err)
|
||||
continue
|
||||
}
|
||||
xlog.Info("Config", config)
|
||||
|
||||
switch action.Name {
|
||||
case ActionSearch:
|
||||
|
||||
@@ -141,15 +141,28 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
|
||||
|
||||
connectors := config.availableConnectors()
|
||||
|
||||
xlog.Info("Creating agent", name)
|
||||
xlog.Info("Model", model)
|
||||
xlog.Info("API URL", a.apiURL)
|
||||
|
||||
actions := config.availableActions(ctx)
|
||||
|
||||
stateFile, characterFile := a.stateFiles(name)
|
||||
|
||||
xlog.Info("Actions", actions)
|
||||
actionsLog := []string{}
|
||||
for _, action := range actions {
|
||||
actionsLog = append(actionsLog, action.Definition().Name.String())
|
||||
}
|
||||
connectorLog := []string{}
|
||||
for _, connector := range connectors {
|
||||
connectorLog = append(connectorLog, fmt.Sprintf("%+v", connector))
|
||||
}
|
||||
|
||||
xlog.Info(
|
||||
"Creating agent",
|
||||
"name", name,
|
||||
"model", model,
|
||||
"api_url", a.apiURL,
|
||||
"actions", actionsLog,
|
||||
"connectors", connectorLog,
|
||||
)
|
||||
|
||||
opts := []Option{
|
||||
WithModel(model),
|
||||
WithLLMAPIURL(a.apiURL),
|
||||
|
||||
@@ -35,15 +35,11 @@ func (a *AgentConfig) availableConnectors() []Connector {
|
||||
connectors := []Connector{}
|
||||
|
||||
for _, c := range a.Connector {
|
||||
xlog.Info("Set Connector", c)
|
||||
|
||||
var config map[string]string
|
||||
if err := json.Unmarshal([]byte(c.Config), &config); err != nil {
|
||||
xlog.Info("Error unmarshalling connector config", err)
|
||||
continue
|
||||
}
|
||||
xlog.Info("Config", config)
|
||||
|
||||
switch c.Type {
|
||||
case ConnectorTelegram:
|
||||
cc, err := connector.NewTelegramConnector(config)
|
||||
|
||||
Reference in New Issue
Block a user