correctly store conversation

This commit is contained in:
mudler
2024-04-02 17:32:27 +02:00
parent 8e3a1fcbe5
commit 9417c5ca8f
3 changed files with 27 additions and 13 deletions

View File

@@ -72,6 +72,18 @@ func (a *Agent) Ask(opts ...JobOption) []ActionState {
return j.Result.WaitResult()
}
func (a *Agent) CurrentConversation() []openai.ChatCompletionMessage {
a.Lock()
defer a.Unlock()
return a.currentConversation
}
func (a *Agent) ResetConversation() {
a.Lock()
defer a.Unlock()
a.currentConversation = []openai.ChatCompletionMessage{}
}
var ErrContextCanceled = fmt.Errorf("context canceled")
func (a *Agent) Stop() {
@@ -109,7 +121,7 @@ func (a *Agent) Run() error {
// before clearing it out
// Clear the conversation
a.currentConversation = []openai.ChatCompletionMessage{}
// a.currentConversation = []openai.ChatCompletionMessage{}
}
}
}