Module: LlamaBotRails
- Defined in:
- lib/llama_bot_rails/agent_auth_2.rb,
lib/llama_bot_rails.rb,
lib/llama_bot_rails/engine.rb,
lib/llama_bot_rails/railtie.rb,
lib/llama_bot_rails/version.rb,
lib/llama_bot_rails/llama_bot.rb,
lib/llama_bot_rails/agent_auth.rb,
lib/llama_bot_rails/route_helper.rb,
lib/llama_bot_rails/agent_state_builder.rb,
app/jobs/llama_bot_rails/application_job.rb,
app/channels/llama_bot_rails/chat_channel.rb,
lib/llama_bot_rails/controller_extensions.rb,
lib/llama_bot_rails/tools/rails_console_tool.rb,
app/models/llama_bot_rails/application_record.rb,
app/helpers/llama_bot_rails/application_helper.rb,
app/controllers/llama_bot_rails/agent_controller.rb,
app/channels/llama_bot_rails/application_cable/channel.rb,
app/controllers/llama_bot_rails/application_controller.rb,
lib/generators/llama_bot_rails/install/install_generator.rb,
app/channels/llama_bot_rails/application_cable/connection.rb
Overview
llama_bot_rails/app/channels/llama_bot_rails/application_cable/connection.rb
Defined Under Namespace
Modules: AgentAuth, ApplicationCable, ApplicationHelper, ControllerExtensions, Generators, RouteHelper, Tools Classes: AgentController, AgentStateBuilder, ApplicationController, ApplicationJob, ApplicationRecord, ChatChannel, Engine, LlamaBot, Railtie
Constant Summary collapse
- VERSION =
"0.1.16"
Class Attribute Summary collapse
-
.current_user_resolver ⇒ Object
Returns the value of attribute current_user_resolver.
-
.sign_in_method ⇒ Object
Returns the value of attribute sign_in_method.
-
.user_resolver ⇒ Object
Returns the value of attribute user_resolver.
Class Method Summary collapse
- .add_instruction_to_agent_prompt!(str) ⇒ Object
-
.agent_prompt_path ⇒ Object
—————————————————————— Prompt helpers ——————————————————————.
- .agent_prompt_text ⇒ Object
-
.config ⇒ Object
Convenience helper for host-app initializers.
-
.send_agent_message(params) ⇒ Object
—————————————————————— Bridge to backend service ——————————————————————.
Class Attribute Details
.current_user_resolver ⇒ Object
Returns the value of attribute current_user_resolver.
21 22 23 |
# File 'lib/llama_bot_rails.rb', line 21 def current_user_resolver @current_user_resolver end |
.sign_in_method ⇒ Object
Returns the value of attribute sign_in_method.
23 24 25 |
# File 'lib/llama_bot_rails.rb', line 23 def sign_in_method @sign_in_method end |
.user_resolver ⇒ Object
Returns the value of attribute user_resolver.
20 21 22 |
# File 'lib/llama_bot_rails.rb', line 20 def user_resolver @user_resolver end |
Class Method Details
.add_instruction_to_agent_prompt!(str) ⇒ Object
69 70 71 72 |
# File 'lib/llama_bot_rails.rb', line 69 def self.add_instruction_to_agent_prompt!(str) FileUtils.mkdir_p(agent_prompt_path.dirname) File.write(agent_prompt_path, "\n#{str}", mode: "a") end |
.agent_prompt_path ⇒ Object
Prompt helpers
63 |
# File 'lib/llama_bot_rails.rb', line 63 def self.agent_prompt_path = Rails.root.join("app", "llama_bot", "prompts", "agent_prompt.txt") |
.agent_prompt_text ⇒ Object
65 66 67 |
# File 'lib/llama_bot_rails.rb', line 65 def self.agent_prompt_text File.exist?(agent_prompt_path) ? File.read(agent_prompt_path) : "You are LlamaBot, a helpful assistant." end |
.config ⇒ Object
Convenience helper for host-app initializers
58 |
# File 'lib/llama_bot_rails.rb', line 58 def self.config = Rails.application.config.llama_bot_rails |
.send_agent_message(params) ⇒ Object
Bridge to backend service
77 |
# File 'lib/llama_bot_rails.rb', line 77 def self.(params) = LlamaBot.(params) |