feat(api): implement stateful responses api (#122)
* feat(api): implement stateful responses api Signed-off-by: mudler <mudler@localai.io> * fix(tests): align client to API changes Signed-off-by: mudler <mudler@localai.io> --------- Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
committed by
GitHub
parent
86cb9f1282
commit
f3c06b1bfb
@@ -73,3 +73,12 @@ func (c *ConversationTracker[K]) AddMessage(key K, message openai.ChatCompletion
|
||||
c.currentconversation[key] = append(c.currentconversation[key], message)
|
||||
c.lastMessageTime[key] = time.Now()
|
||||
}
|
||||
|
||||
func (c *ConversationTracker[K]) SetConversation(key K, messages []openai.ChatCompletionMessage) {
|
||||
// Lock the conversation mutex to update the conversation history
|
||||
c.convMutex.Lock()
|
||||
defer c.convMutex.Unlock()
|
||||
|
||||
c.currentconversation[key] = messages
|
||||
c.lastMessageTime[key] = time.Now()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user