Module: Chat
- Defined in:
- lib/train.rb
Overview
Train::Chat::INPUT for interactive terminal loop
Constant Summary collapse
- INPUT =
:__interactive__
Class Method Summary collapse
Class Method Details
.start(model) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/train.rb', line 35 def self.start(model) puts "🚂 Ruby AI Train Interactive Mode" puts "Type a message. Empty input or Ctrl+C to exit.\n\n" loop do print "Prompt: " prompt = $stdin.gets&.chomp break if prompt.nil? || prompt.strip.empty? puts "AI Answer: #{model.chat(prompt)}\n\n" end rescue Interrupt puts "\nGoodbye!" end |