Class: Protege::TracesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/protege/traces_controller.rb

Overview

Traces — the review surface for captured inference turns (see Protege::Trace). index lists the turns (newest first, optionally narrowed to the unlabeled review queue) in the sidebar; show renders one turn's request/response/settings snapshot; update applies a human review label so the turn becomes usable training data. Read-and-label only — traces are written by the tracing subscriber, never edited here beyond the verdict.

Instance Method Summary collapse

Instance Method Details

#indexvoid

This method returns an undefined value.

List captured turns, newest first, for the sidebar (search lives on its own page — see Traces::SearchesController). Serves GET /traces.



16
17
18
# File 'app/controllers/protege/traces_controller.rb', line 16

def index
  @traces = Trace.recent
end

#showvoid

This method returns an undefined value.

Show one turn's snapshot and its review form. The sidebar sources its own list via the recent_traces helper (like threads' inbox_threads), so nothing to load here. Serves GET /traces/:id.



25
# File 'app/controllers/protege/traces_controller.rb', line 25

def show; end

#updatevoid

This method returns an undefined value.

Apply a review verdict (label + optional note) to a turn. Serves PATCH /traces/:id.



30
31
32
33
34
# File 'app/controllers/protege/traces_controller.rb', line 30

def update
  @trace.apply_label(label: label_params[:label], annotation: label_params[:annotation])

  redirect_to trace_path(@trace), notice: 'Trace labeled.'
end