Answer a question again by forking at its answer's snapshot

This commit is contained in:
Ian Gulliver
2026-10-19 17:46:44 -07:00
parent 101041fc87
commit ec390958e9
11 changed files with 517 additions and 316 deletions
+24 -21
View File
@@ -38,28 +38,9 @@ func (m *Manager) Respond(ctx context.Context, user string, creates []api.InboxR
return nil, err
}
attachments := []api.Attachment{}
if create.Attachments != nil {
attachments = *create.Attachments
}
images := []string{}
if create.Images != nil {
images = *create.Images
}
resolutions = append(resolutions, store.Resolution{
State: state,
Response: api.InboxResponse{
Id: store.NewID(),
ItemId: item.Id,
User: user,
Type: create.Type,
Options: create.Options,
Text: create.Text,
Images: images,
Attachments: attachments,
CreatedAt: time.Now().UTC(),
},
State: state,
Response: newResponse(item.Id, user, create),
})
if !slices.Contains(sessions, item.AgentSessionId) {
sessions = append(sessions, item.AgentSessionId)
@@ -98,6 +79,28 @@ func (m *Manager) Respond(ctx context.Context, user string, creates []api.InboxR
return items, nil
}
func newResponse(itemID, user string, create api.InboxResponseCreate) api.InboxResponse {
attachments := []api.Attachment{}
if create.Attachments != nil {
attachments = *create.Attachments
}
images := []string{}
if create.Images != nil {
images = *create.Images
}
return api.InboxResponse{
Id: store.NewID(),
ItemId: itemID,
User: user,
Type: create.Type,
Options: create.Options,
Text: create.Text,
Images: images,
Attachments: attachments,
CreatedAt: time.Now().UTC(),
}
}
func (m *Manager) Dismiss(ctx context.Context, user, itemID string) (api.InboxItem, error) {
item, err := m.store.GetInboxItem(ctx, itemID)
if err != nil {