Skip to content

Commit

Permalink
Testing the flow of everything.... (#1192)
Browse files Browse the repository at this point in the history
* I hate this, but we need to remind folks.  Appears to only happen with one solr search engine?

* nicer messaging

* wcw is still around @sstults

* Work when no percent provided.

* Nicer form
  • Loading branch information
epugh authored Jan 20, 2025
1 parent c52da4c commit 3c152c8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/assets/templates/views/queries.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@

<div ng-show="searching()" class="alert alert-info search-feedback" role="alert">
<i class="glyphicon glyphicon-refresh spintime"></i> Updating Queries: {{batchPosition}} / {{batchSize}}
<small class="text-muted">If counter stalls, do a hard refresh of web page.</small>
</div>

<!-- let the user know what we're looking at-->
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/books_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def run_judge_judy
number_of_pairs = nil if judge_all

RunJudgeJudyJob.perform_later(@book, ai_judge, number_of_pairs)
redirect_to book_path(@book), flash: { kraken_unleashed: judge_all }, :notice => "Set AI Judge #{ai_judge.name} to work judging query/doc pairs."
redirect_to book_path(@book), flash: { kraken_unleashed: judge_all }, :notice => "AI Judge #{ai_judge.name} will start evaluating query/doc pairs."
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
Expand Down
4 changes: 2 additions & 2 deletions app/views/ai_judges/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ul>
</div>
<% end %>
<p class="card-text">Configure the AI Judge with information Quepid needs to run the judge.</p>
<p class="card-text">Configure the AI Judge with the information Quepid needs to run the judge.</p>

<div class="row mb-3">
<%= form.label :name, class: 'col-sm-2 col-form-label' %>
Expand All @@ -24,7 +24,7 @@
</div>

<div class="row mb-3">
<%= form.label :openai_key, class: 'col-sm-2 col-form-label' %>
<%= form.label :openai_key, "OpenAI Key", class: 'col-sm-2 col-form-label' %>
<div class="col-sm-4">
<%= form.text_field :openai_key %>
</div>
Expand Down
4 changes: 3 additions & 1 deletion app/views/books/_blah.turbo_stream.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
<span id="notification-book-<%= book.id %>">
<% if counter > 0 %>
<div class="alert alert-warning" role="alert" >
<div class="progress" role="progressbar" aria-label="Example with label" aria-valuenow="<%= percent %>" aria-valuemin="0" aria-valuemax="100">
<% if percent %>
<div class="progress" role="progressbar" aria-label="Job Progress" aria-valuenow="<%= percent %>" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width: <%= number_to_percentage(percent, precision: 0) %>"><%= number_to_percentage(percent, precision: 0) %></div>
</div>
<% end %>
Query/Doc Pairs Remaining: <code><%= counter %></code>.
<br/>
<p class="text-truncate">
Expand Down
8 changes: 8 additions & 0 deletions config/initializers/console_commands.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

Rails.application.console do
def wcw val
puts "Val: #{val}"
pp val
end
end
4 changes: 2 additions & 2 deletions test/controllers/books_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BooksControllerTest < ActionDispatch::IntegrationTest
assert_difference 'james_bond_movies.judgements.count' do
patch "/books/#{james_bond_movies.id}/run_judge_judy/#{judge_judy.id}", params: { number_of_pairs: 1 }
follow_redirect!
assert_equal "Set AI Judge #{judge_judy.name} to work judging query/doc pairs.", flash[:notice]
assert_equal "AI Judge #{judge_judy.name} will start evaluating query/doc pairs.", flash[:notice]
end
end
end
Expand All @@ -28,7 +28,7 @@ class BooksControllerTest < ActionDispatch::IntegrationTest
patch "/books/#{james_bond_movies.id}/run_judge_judy/#{judge_judy.id}",
params: { judge_all: 1, number_of_pairs: 1 }
follow_redirect!
assert_equal "Set AI Judge #{judge_judy.name} to work judging query/doc pairs.", flash[:notice]
assert_equal "AI Judge #{judge_judy.name} will start evaluating query/doc pairs.", flash[:notice]
assert_equal james_bond_movies.query_doc_pairs.count, james_bond_movies.judgements.where(user: judge_judy).count
end
end
Expand Down

0 comments on commit 3c152c8

Please sign in to comment.