-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EN-7354 rename openai_assistant_configuration to openai_assistant
- Loading branch information
1 parent
c7b238b
commit f295d99
Showing
15 changed files
with
108 additions
and
103 deletions.
There are no files selected for viewing
45 changes: 0 additions & 45 deletions
45
app/controllers/admin/openai_assistant_configurations_controller.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
module Admin | ||
class OpenaiAssistantsController < Admin::BaseController | ||
layout 'admin_large' | ||
|
||
before_action :set_openai_assistant, only: [:edit, :update] | ||
|
||
def index | ||
@openai_assistants = OpenaiAssistant.all | ||
.order(:version) | ||
.page(page) | ||
.per(per) | ||
end | ||
|
||
def edit | ||
end | ||
|
||
def update | ||
@openai_assistant.assign_attributes(openai_assistant_params) | ||
|
||
if @openai_assistant.save | ||
redirect_to edit_admin_openai_assistant_path(@openai_assistant) | ||
else | ||
render :edit | ||
end | ||
end | ||
|
||
private | ||
|
||
def set_openai_assistant | ||
@openai_assistant = OpenaiAssistant.find(params[:id]) | ||
end | ||
|
||
def openai_assistant_params | ||
params.require(:openai_assistant).permit(:prompt, :days_for_actions, :days_for_outings, :poi_from_file, :resource_from_file) | ||
end | ||
|
||
def page | ||
params[:page] || 1 | ||
end | ||
|
||
def per | ||
params[:per] || 25 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class OpenaiAssistant < ApplicationRecord | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
app/views/admin/openai_assistant_configurations/_edit_header.html.erb
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
app/views/admin/openai_assistant_configurations/index.html.erb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="row"> | ||
<ol class="breadcrumb"> | ||
<li><%= link_to "openai_assistants", admin_openai_assistants_path %></li> | ||
<li class="active">Modifier</li> | ||
<li style="float: right;"> | ||
Version <%= @openai_assistant.version %> | ||
</li> | ||
</ol> | ||
|
||
<h2> | ||
<span class="text-muted"># Version <%= @openai_assistant.version %></span> | ||
</h2> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<div class="container"> | ||
<div style="margin: auto"> | ||
<h1>openai_assistant</h1> | ||
|
||
<div class="row"> | ||
<% unless @openai_assistants.none? %> | ||
<table class="table custom-table"> | ||
<thead> | ||
<th>Version</th> | ||
<th>Prompt</th> | ||
<th>poi_from_file</th> | ||
<th>resource_from_file</th> | ||
<th>days_for_actions</th> | ||
<th>days_for_outings</th> | ||
</thead> | ||
<% @openai_assistants.each_with_index do |openai_assistant, i| %> | ||
<% parite = i.even? ? 'pair' : 'impair' %> | ||
|
||
<tr class="above-row row-<%= parite %>"> | ||
<td><%= link_to openai_assistant.version, edit_admin_openai_assistant_path(openai_assistant) %></td> | ||
<td><%= link_to openai_assistant.prompt, edit_admin_openai_assistant_path(openai_assistant) %></td> | ||
<td><%= openai_assistant.poi_from_file %></td> | ||
<td><%= openai_assistant.resource_from_file %></td> | ||
<td><%= openai_assistant.days_for_actions %></td> | ||
<td><%= openai_assistant.days_for_outings %></td> | ||
<% end %> | ||
</table> | ||
<% end %> | ||
</div> | ||
|
||
<%= page_entries_info @openai_assistants, entry_name: 'openai_assistants' %> | ||
<div class="container"> | ||
<%= paginate(@openai_assistants) %> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
db/migrate/20241128165903_rename_openai_assistant_configurations_to_openai_assistants.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class RenameOpenaiAssistantConfigurationsToOpenaiAssistants < ActiveRecord::Migration[6.1] | ||
def change | ||
rename_table :openai_assistant_configurations, :openai_assistants | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters