small fixups
This commit is contained in:
@@ -27,15 +27,16 @@ type AgentConfig struct {
|
||||
Connector []ConnectorConfig `json:"connectors" form:"connectors" `
|
||||
Actions []ActionsConfig `json:"actions" form:"actions"`
|
||||
// This is what needs to be part of ActionsConfig
|
||||
Model string `json:"model" form:"model"`
|
||||
Name string `json:"name" form:"name"`
|
||||
HUD bool `json:"hud" form:"hud"`
|
||||
Debug bool `json:"debug" form:"debug"`
|
||||
StandaloneJob bool `json:"standalone_job" form:"standalone_job"`
|
||||
RandomIdentity bool `json:"random_identity" form:"random_identity"`
|
||||
IdentityGuidance string `json:"identity_guidance" form:"identity_guidance"`
|
||||
PeriodicRuns string `json:"periodic_runs" form:"periodic_runs"`
|
||||
PermanentGoal string `json:"permanent_goal" form:"permanent_goal"`
|
||||
Model string `json:"model" form:"model"`
|
||||
Name string `json:"name" form:"name"`
|
||||
HUD bool `json:"hud" form:"hud"`
|
||||
Debug bool `json:"debug" form:"debug"`
|
||||
StandaloneJob bool `json:"standalone_job" form:"standalone_job"`
|
||||
RandomIdentity bool `json:"random_identity" form:"random_identity"`
|
||||
InitiateConversations bool `json:"initiate_conversations" form:"initiate_conversations"`
|
||||
IdentityGuidance string `json:"identity_guidance" form:"identity_guidance"`
|
||||
PeriodicRuns string `json:"periodic_runs" form:"periodic_runs"`
|
||||
PermanentGoal string `json:"permanent_goal" form:"permanent_goal"`
|
||||
}
|
||||
|
||||
type AgentPool struct {
|
||||
@@ -260,6 +261,9 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
|
||||
if config.StandaloneJob {
|
||||
opts = append(opts, EnableStandaloneJob)
|
||||
}
|
||||
if config.InitiateConversations {
|
||||
opts = append(opts, EnableInitiateConversations)
|
||||
}
|
||||
if config.RandomIdentity {
|
||||
if config.IdentityGuidance != "" {
|
||||
opts = append(opts, WithRandomIdentity(config.IdentityGuidance))
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
)
|
||||
|
||||
type Telegram struct {
|
||||
Token string
|
||||
Conttext context.Context
|
||||
Token string
|
||||
lastChatID int64
|
||||
}
|
||||
|
||||
// Send any text message to the bot after the bot has been started
|
||||
@@ -45,6 +45,7 @@ func (t *Telegram) Start(a *agent.Agent) {
|
||||
ChatID: update.Message.Chat.ID,
|
||||
Text: res.Response,
|
||||
})
|
||||
t.lastChatID = update.Message.Chat.ID
|
||||
}),
|
||||
}
|
||||
|
||||
@@ -53,6 +54,18 @@ func (t *Telegram) Start(a *agent.Agent) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
go func() {
|
||||
for m := range a.ConversationChannel() {
|
||||
if t.lastChatID == 0 {
|
||||
continue
|
||||
}
|
||||
b.SendMessage(ctx, &bot.SendMessageParams{
|
||||
ChatID: t.lastChatID,
|
||||
Text: m.Content,
|
||||
})
|
||||
}
|
||||
}()
|
||||
|
||||
b.Start(ctx)
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,9 @@
|
||||
<label for="standalone_job" class="block text-lg font-medium text-gray-400">Standalone Job</label>
|
||||
<input type="checkbox" name="standalone_job" id="standalone_job" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md bg-gray-700 text-white">
|
||||
|
||||
<label for="initiate_conversations" class="block text-lg font-medium text-gray-400">Initiate conversations</label>
|
||||
<input type="checkbox" name="random_identity" id="initiate_conversations" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md bg-gray-700 text-white">
|
||||
|
||||
<label for="random_identity" class="block text-lg font-medium text-gray-400">Random Identity</label>
|
||||
<input type="checkbox" name="random_identity" id="random_identity" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md bg-gray-700 text-white">
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user