prompt: adds ls, help, mark
This commit is contained in:
@@ -54,11 +54,21 @@ func (s *Server) Conversations() []model.Conversation {
|
||||
return s.conversations
|
||||
}
|
||||
|
||||
func (s *Server) SortedConversations() []model.Conversation {
|
||||
conversations := s.Conversations()
|
||||
sort.Slice(conversations, func(i, j int) bool {
|
||||
return conversations[i].Date.After(conversations[j].Date)
|
||||
})
|
||||
|
||||
return conversations
|
||||
}
|
||||
|
||||
func (s *Server) ConversationForGUID(guid string) (*model.Conversation, error) {
|
||||
var conversation *model.Conversation = nil
|
||||
for _, c := range s.conversations {
|
||||
for i := range s.conversations {
|
||||
c := &s.conversations[i]
|
||||
if c.Guid == guid {
|
||||
conversation = &c
|
||||
conversation = c
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -119,7 +129,7 @@ func (s *Server) CheckBearerToken(token string) bool {
|
||||
return s.authenticateToken(token)
|
||||
}
|
||||
|
||||
func (s *Server) MessagesForConversation(conversation model.Conversation) []model.Message {
|
||||
func (s *Server) MessagesForConversation(conversation *model.Conversation) []model.Message {
|
||||
messages := s.messageStore[conversation.Guid]
|
||||
sort.Slice(messages, func(i int, j int) bool {
|
||||
return messages[i].Date.Before(messages[j].Date)
|
||||
|
||||
Reference in New Issue
Block a user