fix: message response

This commit is contained in:
Shivam Mishra
2025-04-04 22:56:28 +05:30
parent 94b81b49f9
commit 6a54124f38
2 changed files with 3 additions and 10 deletions
@@ -9,11 +9,7 @@ class Captain::Llm::AssistantChatService < Llm::BaseService
def generate_response(input, previous_messages = [], _role = 'user')
previous_messages.each do |msg|
if msg[:role] == 'system'
@chat.with_instructions(msg[:content])
else
@chat.add_message(role: msg[:role], content: msg[:content])
end
@chat.add_message(role: msg[:role], content: msg[:content])
end
response = @chat.ask(input) if input.present?
@@ -35,10 +31,7 @@ class Captain::Llm::AssistantChatService < Llm::BaseService
begin
::JSON.parse(content)
rescue ::JSON::ParserError
{
'reasoning' => '',
'response' => content
}
content
end
end
end
@@ -10,7 +10,7 @@ class Captain::Tools::DocumentationSearch < RubyLLM::Tool
@assistant = assistant
end
def execute(query:)
def execute(query)
@assistant
.responses
.approved