5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/boxcars/station/chat_controller.rb', line 5
def index
session[:qa] ||= []
if params[:textcommand]
boxcar_models = Boxcars::Station.configuration.active_record_models
read_only = Boxcars::Station.configuration.read_only
ar_boxcar = Boxcars::ActiveRecord.new models: boxcar_models, read_only: read_only
@question = params[:textcommand]
@answer = ar_boxcar.run @question
@qa = [@question, @answer, Time.now]
session[:qa] = [@qa] + session[:qa].first(4)
puts session[:qa]
end
@qalist = session[:qa]
respond_to do |format|
format.html
format.turbo_stream
end
end
|