FromContext returns the chat identity stored on the context.
(ctx context.Context)
| 20 | |
| 21 | // FromContext returns the chat identity stored on the context. |
| 22 | func FromContext(ctx context.Context) (Context, bool) { |
| 23 | chatCtx, ok := ctx.Value(chatContextKey{}).(Context) |
| 24 | if !ok || chatCtx.ID == uuid.Nil { |
| 25 | return Context{}, false |
| 26 | } |
| 27 | return chatCtx, true |
| 28 | } |
| 29 | |
| 30 | // WithContext stores chat identity on the context for downstream logs. |
| 31 | func WithContext(ctx context.Context, chatID uuid.UUID, ancestorIDs []uuid.UUID) context.Context { |