added viewing all assistants

This commit is contained in:
James Dinkel 2025-08-22 00:42:01 -05:00
parent 6c27feb9e7
commit a80ba5bfe0
3 changed files with 46 additions and 9 deletions

10
app.rb
View file

@ -1,8 +1,12 @@
# frozen_string_literal: true
require "roda"
require 'roda'
require 'tilt'
require 'tilt/erubi'
require_relative 'db'
require_relative 'models/assistant'
class App < Roda
plugin :render, escape: true
plugin :route_csrf
@ -12,10 +16,10 @@ class App < Roda
r.root do
@page_title = 'Assistants List'
@subtitle = 'All ASsistants in Database'
@subtitle = 'All Assistants in Database'
@assistants = Assistant.all
# renders index.erb inside layout.erb
view :index
end
end
end

View file

@ -1,4 +1,4 @@
# app/models/assistant.rb
# models/assistant.rb
require 'sequel'
class Assistant < Sequel::Model

View file

@ -1 +1,34 @@
<h2 class="subtitle"><%= @subtitle %></h2>
<% if @assistants.any? %>
<table class="table is-striped is-fullwidth">
<thead>
<tr>
<th>Name</th>
<th>Run Command</th>
<th>Reputation</th>
<th>Context Length</th>
<th>Prompt Rate</th>
<th>Evaluation Rate</th>
<th>Capabilities</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<% @assistants.each do |assistant| %>
<tr>
<td><%= assistant.name %></td>
<td><%= assistant.run_command %></td>
<td><%= assistant.reputation || 'N/A' %></td>
<td><%= assistant.context_length || 'N/A' %></td>
<td><%= assistant.prompt_rate || 'N/A' %></td>
<td><%= assistant.eval_rate || 'N/A' %></td>
<td><%= assistant.capabilities || 'N/A' %></td>
<td><%= assistant.created_at.strftime('%Y-%m-%d %H:%M') if assistant.created_at %></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p>No assistants found in the database.</p>
<% end %>