Skip to content

Commit abf9cf5

Browse files
Fix system tests
1 parent bb32de5 commit abf9cf5

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

app/controllers/assistants_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ def set_assistant
4646
end
4747

4848
def assistant_params
49-
params.require(:assistant).permit(:user_id, :model, :name, :description, :instructions, :tools)
49+
params.require(:assistant).permit(:user_id, :language_model_id, :name, :description, :instructions, :tools)
5050
end
5151
end

app/views/assistants/_form.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
</div>
1818

1919
<div class="my-5">
20-
<%= form.label :model %>
21-
<%= form.text_field :model, value: "gpt-4", class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
20+
<%= form.label :language_model_id %><br/>
21+
<%= form.select :language_model_id, LanguageModel.order(:description).all.pluck(:description, :id), class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full dark:text-black" %>
2222
</div>
2323

2424
<div class="my-5">

test/system/assistants_test.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,33 @@ class AssistantsTest < ApplicationSystemTestCase
1111
# assert_selector "h1", text: "Assistants"
1212
# end
1313

14-
test "should create assistant" do
14+
test "should create Assistant" do
1515
visit new_assistant_url
1616

1717
fill_in "Description", with: @assistant.description
1818
fill_in "Instructions", with: @assistant.instructions
19-
fill_in "Model", with: @assistant.model
19+
find('#assistant_language_model_id').find(:xpath, 'option[1]').select_option
2020
fill_in "Name", with: @assistant.name
2121
fill_in "User", with: @assistant.user_id
2222
click_text "Create Assistant"
2323

2424
assert_text "Assistant was successfully created"
25+
assert_text "claude-3-opus-20240229 from fixtures"
2526
click_text "Back"
2627
end
2728

2829
test "should update Assistant" do
2930
visit assistant_url(@assistant)
3031
click_text "Edit this assistant", match: :first
31-
3232
fill_in "Description", with: @assistant.description
3333
fill_in "Instructions", with: @assistant.instructions
34-
fill_in "Model", with: @assistant.model
34+
find('#assistant_language_model_id').find(:xpath, 'option[2]').select_option
3535
fill_in "Name", with: @assistant.name
3636
fill_in "User", with: @assistant.user_id
3737
click_text "Update Assistant"
3838

3939
assert_text "Assistant was successfully updated"
40+
assert_text "claude-3-sonnet-20240229 from fixtures"
4041
click_text "Back"
4142
end
4243

0 commit comments

Comments
 (0)