Method: OpenAIClient#console

Defined in:
lib/simple-openai-client.rb

#consoleObject

manage copilot from terminal



152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/simple-openai-client.rb', line 152

def console
    puts "Mass-Copilot Console".blue
    puts "Type 'exit' to quit.".blue
    while true
        print "You: ".green
        prompt = gets.chomp
        break if prompt.downcase.strip == 'exit'
        begin
            puts "Mass-Copilot: #{ask(prompt)}".blue
        rescue => e
            puts "Error: #{e.to_console}".red
        end
    end
end