fix: message response
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user