This PR adds the following two features 1. Prompt suggestions to get started with Copilot Chat 2. June events for each action  --------- Co-authored-by: Pranav <pranavrajs@gmail.com>
29 lines
652 B
Ruby
29 lines
652 B
Ruby
require 'openai'
|
|
|
|
class Captain::Llm::AssistantChatService < Captain::Llm::BaseOpenAiService
|
|
include Captain::ChatHelper
|
|
|
|
def initialize(assistant: nil)
|
|
super()
|
|
|
|
@assistant = assistant
|
|
@messages = [system_message]
|
|
@response = ''
|
|
end
|
|
|
|
def generate_response(input, previous_messages = [], role = 'user')
|
|
@messages += previous_messages
|
|
@messages << { role: role, content: input } if input.present?
|
|
request_chat_completion
|
|
end
|
|
|
|
private
|
|
|
|
def system_message
|
|
{
|
|
role: 'system',
|
|
content: Captain::Llm::SystemPromptsService.assistant_response_generator(@assistant.config['product_name'])
|
|
}
|
|
end
|
|
end
|