diff --git a/core/state/pool.go b/core/state/pool.go index 2f9212e..1e31bb8 100644 --- a/core/state/pool.go +++ b/core/state/pool.go @@ -72,12 +72,18 @@ func NewAgentPool( connectors func(*AgentConfig) []Connector, promptBlocks func(*AgentConfig) []PromptBlock, timeout string, + withLogs bool, ) (*AgentPool, error) { // if file exists, try to load an existing pool. // if file does not exist, create a new pool. poolfile := filepath.Join(directory, "pool.json") + conversationPath := "" + if withLogs { + conversationPath = filepath.Join(directory, "conversations") + } + if _, err := os.Stat(poolfile); err != nil { // file does not exist, create a new pool return &AgentPool{ @@ -95,7 +101,7 @@ func NewAgentPool( availableActions: availableActions, promptBlocks: promptBlocks, timeout: timeout, - conversationLogs: filepath.Join(directory, "conversations"), + conversationLogs: conversationPath, }, nil } @@ -118,7 +124,7 @@ func NewAgentPool( promptBlocks: promptBlocks, availableActions: availableActions, timeout: timeout, - conversationLogs: filepath.Join(directory, "conversations"), + conversationLogs: conversationPath, }, nil } diff --git a/main.go b/main.go index 455f6c0..ce1c309 100644 --- a/main.go +++ b/main.go @@ -16,6 +16,7 @@ var apiKey = os.Getenv("API_KEY") var timeout = os.Getenv("TIMEOUT") var stateDir = os.Getenv("STATE_DIR") var localRAG = os.Getenv("LOCAL_RAG") +var withLogs = os.Getenv("ENABLE_CONVERSATIONS_LOGGING") == "true" func init() { if testModel == "" { @@ -52,6 +53,7 @@ func main() { services.Connectors, services.PromptBlocks, timeout, + withLogs, ) if err != nil { panic(err)