Skip to content

Commit 03bbd72

Browse files
committed
add more fields to the GetMessages response
1 parent 8be9375 commit 03bbd72

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/httpapi/models.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package httpapi
22

33
import (
4+
"time"
5+
46
st "github.com/coder/agentapi/lib/screentracker"
57
"github.com/coder/agentapi/lib/util"
68
"github.com/danielgtaylor/huma/v2"
@@ -24,8 +26,10 @@ func (m MessageType) Schema(r huma.Registry) *huma.Schema {
2426

2527
// Message represents a message
2628
type Message struct {
29+
Id int `json:"id" doc:"Unique identifier for the message. This identifier also represents the order of the message in the conversation history."`
2730
Content string `json:"content" example:"Hello world" doc:"Message content"`
2831
Role st.ConversationRole `json:"role" doc:"Role of the message author"`
32+
Time time.Time `json:"time" doc:"Timestamp of the message"`
2933
}
3034

3135
// StatusResponse represents the server status

lib/httpapi/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,10 @@ func (s *Server) getMessages(ctx context.Context, input *struct{}) (*MessagesRes
159159
resp.Body.Messages = make([]Message, len(s.conversation.Messages()))
160160
for i, msg := range s.conversation.Messages() {
161161
resp.Body.Messages[i] = Message{
162+
Id: msg.Id,
162163
Role: msg.Role,
163164
Content: msg.Message,
165+
Time: msg.Time,
164166
}
165167
}
166168

0 commit comments

Comments
 (0)