Let the human ignore an open question in a transcript
This commit is contained in:
@@ -98,6 +98,30 @@ func (m *Manager) Respond(ctx context.Context, user string, creates []api.InboxR
|
||||
return items, nil
|
||||
}
|
||||
|
||||
func (m *Manager) Dismiss(ctx context.Context, user, itemID string) (api.InboxItem, error) {
|
||||
item, err := m.store.GetInboxItem(ctx, itemID)
|
||||
if err != nil {
|
||||
return api.InboxItem{}, err
|
||||
}
|
||||
err = m.store.DismissItem(ctx, itemID, user)
|
||||
if errors.Is(err, store.ErrNotOpen) {
|
||||
return api.InboxItem{}, fmt.Errorf("%w: item %s is %s", ErrConflict, item.Id, item.State)
|
||||
}
|
||||
if err != nil {
|
||||
return api.InboxItem{}, err
|
||||
}
|
||||
slog.Info("inbox item dismissed", "item", itemID, "user", user)
|
||||
|
||||
go func() {
|
||||
err := m.Deliver(context.Background(), item.AgentSessionId)
|
||||
if err != nil {
|
||||
slog.Error("deliver inbox responses", "session", item.AgentSessionId, "err", err)
|
||||
}
|
||||
}()
|
||||
|
||||
return m.store.GetInboxItem(ctx, itemID)
|
||||
}
|
||||
|
||||
func CheckResponse(item api.InboxItem, c api.InboxResponseCreate) (api.InboxState, error) {
|
||||
if item.State != api.Open {
|
||||
return "", fmt.Errorf("%w: item %s is %s", ErrConflict, item.Id, item.State)
|
||||
|
||||
Reference in New Issue
Block a user