Class: Envoy::Conversation

Inherits:
ApplicationRecord show all
Defined in:
app/models/envoy/conversation.rb

Instance Method Summary collapse

Instance Method Details

#effective_system_promptObject

Per-conversation ad-hoc instructions, appended last by Runner.



36
37
38
# File 'app/models/envoy/conversation.rb', line 36

def effective_system_prompt
  system_prompt.presence
end

#prompt_bodyObject



25
26
27
28
# File 'app/models/envoy/conversation.rb', line 25

def prompt_body
  return surface.prompt_body if surface
  prompt_key.present? ? Envoy.prompt(prompt_key).full_body : nil
end

#read_only?Boolean

A surface may pin a chat read-only; so may the conversation's own status.

Returns:

  • (Boolean)


31
32
33
# File 'app/models/envoy/conversation.rb', line 31

def read_only?
  status == "read_only" || !!surface&.read_only?
end

#resolved_model_idObject



21
22
23
# File 'app/models/envoy/conversation.rb', line 21

def resolved_model_id
  surface&.model_id || model_id || Envoy.config.default_model
end

#surfaceObject

Embed conversations resolve everything through their surface, so editing a surface reaches chats that already exist. Console conversations have no surface and fall back to their own columns.



13
14
15
# File 'app/models/envoy/conversation.rb', line 13

def surface
  surface_key.present? ? Envoy.surface(surface_key) : nil
end

#toolsetObject



17
18
19
# File 'app/models/envoy/conversation.rb', line 17

def toolset
  Envoy.toolset(surface&.toolset_key || toolset_key)
end