class RailsAiAdmin::Assistant::Chat
An admin conversation. It belongs to one actor, tenant and security version; a host security change closes it instead of carrying old tool output into a new authority. It never shares rows with host product chats.
Constants
- STATUSES
Public Class Methods
Source
# File lib/rails_ai_admin/assistant/records.rb, line 27 def self.for_owner(context) where(actor_ref: context.actor_ref, tenant_ref: context.tenant_ref) end
Source
# File lib/rails_ai_admin/assistant/records.rb, line 21 def self.owned(context, ref) return unless ref.is_a?(String) && ref.match?(/\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/) chat = find_by(ref: ref, actor_ref: context.actor_ref, tenant_ref: context.tenant_ref) chat if chat && chat.ref == ref && chat.actor_ref == context.actor_ref && chat.tenant_ref == context.tenant_ref end
Byte-exact owner lookup; a non-binary collation cannot widen it.
Public Instance Methods
Source
# File lib/rails_ai_admin/assistant/records.rb, line 35 def context_reference = "raa:chat:#{ref}" end
Source
# File lib/rails_ai_admin/assistant/records.rb, line 31 def current_for?(context) status == "active" && security_version == context.security_version end