chat_manager 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +20 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +6 -0
- data/app/assets/stylesheets/chat_manager/application.css +15 -0
- data/app/assets/stylesheets/chat_manager/chat.css +131 -0
- data/app/controllers/chat_manager/application_controller.rb +4 -0
- data/app/helpers/chat_manager/application_helper.rb +4 -0
- data/app/jobs/chat_manager/application_job.rb +4 -0
- data/app/mailers/chat_manager/application_mailer.rb +6 -0
- data/app/models/chat_manager/application_record.rb +5 -0
- data/app/views/chat_manager/_chat_card.html.erb +29 -0
- data/app/views/chat_manager/_chat_list.html.erb +25 -0
- data/app/views/layouts/chat_manager/application.html.erb +17 -0
- data/config/routes.rb +2 -0
- data/lib/chat_manager/chat_manageable.rb +20 -0
- data/lib/chat_manager/csv_downloadable.rb +43 -0
- data/lib/chat_manager/engine.rb +33 -0
- data/lib/chat_manager/helpers.rb +7 -0
- data/lib/chat_manager/title_generatable.rb +27 -0
- data/lib/chat_manager/version.rb +3 -0
- data/lib/chat_manager.rb +10 -0
- data/lib/generators/chat_manager/modeling/modeling_generator.rb +19 -0
- data/lib/generators/chat_manager/modeling/templates/db/migrate/create_chat_manager_chat.rb +12 -0
- data/lib/tasks/chat_manager_tasks.rake +4 -0
- metadata +100 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 657c0a813d68c57d94d7a4583a690bca52696bb46057504e63516b1b84e7c05d
|
|
4
|
+
data.tar.gz: 1a1b07a2d9e997c0fa4b8e6748639bb2325d35bbcf6d74691f29758e5306cc09
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e3b1677ea4441b6c23edac0730dd9fc31dbdd91e46fd0d293704d1f7210aabb086bdd190ce8376b1cc1ca4f7296ba6511286198fa9c120aaa18ee40b14d52023
|
|
7
|
+
data.tar.gz: b7cb2b4b5c9dda1c5dce2e9479dca145adedfc6c0b202a730b1ffeb58433d6f7f4764d027e424a553e8e03f6da466b4f05078d37da4a40edfdfc6f1540bbeaf3
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-02-26
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Chat management module (`ChatManageable`) for controller integration with duplicate and nil prevention
|
|
13
|
+
- Automatic chat title generation from initial prompts (`TitleGeneratable`)
|
|
14
|
+
- CSV export for individual and bulk chat downloads (`CsvDownloadable`)
|
|
15
|
+
- Chat list and chat card UI components with Stimulus-powered inline title editing
|
|
16
|
+
- View helper (`chat_list`) for rendering chat lists with customizable paths
|
|
17
|
+
- Database migration generator (`chat_manager:modeling`)
|
|
18
|
+
- CSS styling for chat interface with active state highlighting and hover effects
|
|
19
|
+
- Turbolinks/Turbo safety on CSV download links
|
|
20
|
+
- Rails 8.1+ support with `csv` gem dependency for Ruby 3.4+ compatibility
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright dhq_boiler
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# ChatManager
|
|
2
|
+
Short description and motivation.
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
How to use my plugin.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
```ruby
|
|
11
|
+
gem "chat_manager"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
And then execute:
|
|
15
|
+
```bash
|
|
16
|
+
$ bundle
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
```bash
|
|
21
|
+
$ gem install chat_manager
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Contributing
|
|
25
|
+
Contribution directions go here.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
.chat-stack {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 8px;
|
|
6
|
+
padding-left: 32px; /* space for arrows */
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.chat-card {
|
|
10
|
+
background: #fff;
|
|
11
|
+
border: 1px solid #ddd;
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
padding: 8px 10px;
|
|
14
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
|
|
15
|
+
position: relative;
|
|
16
|
+
z-index: 1;
|
|
17
|
+
transition:
|
|
18
|
+
box-shadow 0.15s ease,
|
|
19
|
+
transform 0.15s ease;
|
|
20
|
+
|
|
21
|
+
&.is-active {
|
|
22
|
+
border-color: #007bff;
|
|
23
|
+
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&:hover {
|
|
27
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
|
|
28
|
+
transform: translateY(-2px);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.chat-card-link {
|
|
33
|
+
display: grid;
|
|
34
|
+
grid-template-columns: auto 1fr auto;
|
|
35
|
+
grid-gap: 8px;
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
color: #333;
|
|
38
|
+
align-items: center;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.chat-card-number {
|
|
42
|
+
font-size: 12px;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
color: #555;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.chat-card-prompt {
|
|
48
|
+
font-size: 12px;
|
|
49
|
+
line-height: 1.3;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
display: -webkit-box;
|
|
52
|
+
-webkit-line-clamp: 2;
|
|
53
|
+
-webkit-box-orient: vertical;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.chat-card-row {
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 4px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.chat-card-row .chat-card-link {
|
|
63
|
+
flex: 1;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.chat-card-download {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
width: 24px;
|
|
72
|
+
height: 24px;
|
|
73
|
+
border-radius: 4px;
|
|
74
|
+
color: #888;
|
|
75
|
+
text-decoration: none;
|
|
76
|
+
flex-shrink: 0;
|
|
77
|
+
transition: color 0.15s ease, background-color 0.15s ease;
|
|
78
|
+
|
|
79
|
+
&:hover {
|
|
80
|
+
color: #007bff;
|
|
81
|
+
background-color: rgba(0, 123, 255, 0.1);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
i {
|
|
85
|
+
font-size: 12px;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.chat-download-all {
|
|
90
|
+
margin-top: 12px;
|
|
91
|
+
padding-left: 32px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.chat-download-all-link {
|
|
95
|
+
display: inline-flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
gap: 6px;
|
|
98
|
+
font-size: 12px;
|
|
99
|
+
color: #555;
|
|
100
|
+
text-decoration: none;
|
|
101
|
+
padding: 6px 10px;
|
|
102
|
+
border: 1px solid #ddd;
|
|
103
|
+
border-radius: 6px;
|
|
104
|
+
transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
|
|
105
|
+
|
|
106
|
+
&:hover {
|
|
107
|
+
color: #007bff;
|
|
108
|
+
border-color: #007bff;
|
|
109
|
+
background-color: rgba(0, 123, 255, 0.05);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
i {
|
|
113
|
+
font-size: 12px;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.chat-card-title-input {
|
|
118
|
+
font-size: 12px;
|
|
119
|
+
line-height: 1.3;
|
|
120
|
+
width: 100%;
|
|
121
|
+
padding: 2px 4px;
|
|
122
|
+
border: 1px solid #ccc;
|
|
123
|
+
border-radius: 4px;
|
|
124
|
+
box-sizing: border-box;
|
|
125
|
+
outline: none;
|
|
126
|
+
|
|
127
|
+
&:focus {
|
|
128
|
+
border-color: #007bff;
|
|
129
|
+
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<%
|
|
2
|
+
ann = locals[:ann]
|
|
3
|
+
is_active = locals[:is_active]
|
|
4
|
+
card_path = locals[:card_path]
|
|
5
|
+
download_csv_path = locals[:download_csv_path]
|
|
6
|
+
%>
|
|
7
|
+
|
|
8
|
+
<div class="chat-card<%= ' is-active' if is_active %>"
|
|
9
|
+
data-chat-target="cards"
|
|
10
|
+
data-uuid="<%= ann.uuid %>"
|
|
11
|
+
data-controller="chat-title-edit"
|
|
12
|
+
data-chat-title-edit-uuid-value="<%= ann.uuid %>"
|
|
13
|
+
data-chat-title-edit-full-title-value="<%= ann.title.to_s %>"
|
|
14
|
+
data-chat-title-edit-update-url-value="<%= main_app.update_title_chat_path(ann.uuid) %>">
|
|
15
|
+
<div class="chat-card-row">
|
|
16
|
+
<%= link_to card_path.call(ann.uuid), class: "chat-card-link", data: { "chat-title-edit-target": "link" } do %>
|
|
17
|
+
<div class="chat-card-prompt" data-chat-title-edit-target="display"><%= truncate(ann.title.to_s, length: 30) %></div>
|
|
18
|
+
<% end %>
|
|
19
|
+
<% if download_csv_path %>
|
|
20
|
+
<%= link_to download_csv_path.call(ann.uuid), class: "chat-card-download", title: "Download CSV", data: { turbo: false } do %>
|
|
21
|
+
<i class="bi bi-download"></i>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% end %>
|
|
24
|
+
</div>
|
|
25
|
+
<input type="text" class="chat-card-title-input"
|
|
26
|
+
data-chat-title-edit-target="input"
|
|
27
|
+
data-action="keydown->chat-title-edit#handleKeydown blur->chat-title-edit#save"
|
|
28
|
+
style="display: none;" />
|
|
29
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<%
|
|
2
|
+
active_uuid = locals[:active_uuid]
|
|
3
|
+
card_path = locals[:card_path]
|
|
4
|
+
download_csv_path = locals[:download_csv_path]
|
|
5
|
+
download_all_csv_path = locals[:download_all_csv_path]
|
|
6
|
+
titled_chats = @chats.select { |c| c.title.present? }
|
|
7
|
+
%>
|
|
8
|
+
|
|
9
|
+
<h2>chat</h2>
|
|
10
|
+
<% if titled_chats.present? %>
|
|
11
|
+
<div class="chat-stack" data-controller="chat">
|
|
12
|
+
<% titled_chats.each_with_index do |ann, idx| %>
|
|
13
|
+
<%= render 'chat_manager/chat_card', locals: { ann: ann, next_ann: titled_chats[idx + 1], is_active: ann.id == active_uuid, card_path: card_path, download_csv_path: download_csv_path } %>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
16
|
+
<% if download_all_csv_path %>
|
|
17
|
+
<div class="chat-download-all">
|
|
18
|
+
<%= link_to download_all_csv_path, class: "chat-download-all-link", data: { turbo: false } do %>
|
|
19
|
+
<i class="bi bi-download"></i> Download All Chats CSV
|
|
20
|
+
<% end %>
|
|
21
|
+
</div>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% else %>
|
|
24
|
+
<p class="chat-empty">No chat yet</p>
|
|
25
|
+
<% end %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Chat manager</title>
|
|
5
|
+
<%= csrf_meta_tags %>
|
|
6
|
+
<%= csp_meta_tag %>
|
|
7
|
+
|
|
8
|
+
<%= yield :head %>
|
|
9
|
+
|
|
10
|
+
<%= stylesheet_link_tag "chat_manager/application", media: "all" %>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
|
|
14
|
+
<%= yield %>
|
|
15
|
+
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ChatManager
|
|
4
|
+
module ChatManageable
|
|
5
|
+
extend ActiveSupport::Concern
|
|
6
|
+
|
|
7
|
+
def initialize_chat(chats)
|
|
8
|
+
@chats = chats.to_a
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def set_active_chat_uuid(uuid)
|
|
12
|
+
@active_chat_uuid = uuid
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def add_chat(chat)
|
|
16
|
+
return if chat.nil? || @chats.include?(chat)
|
|
17
|
+
@chats << chat
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "csv"
|
|
4
|
+
|
|
5
|
+
module ChatManager
|
|
6
|
+
module CsvDownloadable
|
|
7
|
+
extend ActiveSupport::Concern
|
|
8
|
+
|
|
9
|
+
CSV_HEADERS = [ "Chat Title", "Role", "Message Content", "Sent At", "Model" ].freeze
|
|
10
|
+
|
|
11
|
+
def download_csv
|
|
12
|
+
chat = current_user.chats.includes(messages: :prompt_manager_prompt_execution).find_by!(uuid: params[:id])
|
|
13
|
+
|
|
14
|
+
csv_data = generate_csv_for_chats([ chat ])
|
|
15
|
+
|
|
16
|
+
filename = "chat_#{chat.title.to_s.parameterize.presence || chat.uuid}_#{Date.today}.csv"
|
|
17
|
+
send_data csv_data, filename: filename, type: "text/csv"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def download_all_csv
|
|
21
|
+
chats = current_user.chats.includes(messages: :prompt_manager_prompt_execution)
|
|
22
|
+
|
|
23
|
+
csv_data = generate_csv_for_chats(chats)
|
|
24
|
+
|
|
25
|
+
send_data csv_data, filename: "all_chats_#{Date.today}.csv", type: "text/csv"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def generate_csv_for_chats(chats)
|
|
31
|
+
CSV.generate do |csv|
|
|
32
|
+
csv << CSV_HEADERS
|
|
33
|
+
chats.each do |chat|
|
|
34
|
+
chat.ordered_messages.each do |msg|
|
|
35
|
+
pe = msg.prompt_manager_prompt_execution
|
|
36
|
+
content = msg.role == "user" ? pe&.prompt : pe&.response
|
|
37
|
+
csv << [ chat.title, msg.role, content, msg.created_at, chat.model ]
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module ChatManager
|
|
2
|
+
class Engine < ::Rails::Engine
|
|
3
|
+
isolate_namespace ChatManager
|
|
4
|
+
|
|
5
|
+
initializer "chat_manager.helpers" do
|
|
6
|
+
ActiveSupport.on_load(:action_view) do
|
|
7
|
+
include ChatManager::Helpers
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
initializer "chat_manager.controllers" do
|
|
12
|
+
ActiveSupport.on_load(:action_controller) do
|
|
13
|
+
include ChatManager::ChatManageable
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Configure asset paths for the engine
|
|
18
|
+
# This ensures that JavaScript and CSS files are properly loaded
|
|
19
|
+
initializer "chat_manager.assets", before: "sprockets.environment" do |app|
|
|
20
|
+
# Add asset paths
|
|
21
|
+
app.config.assets.paths << root.join("app/assets/stylesheets").to_s
|
|
22
|
+
app.config.assets.paths << root.join("app/javascript").to_s
|
|
23
|
+
|
|
24
|
+
# Precompile assets
|
|
25
|
+
if app.config.respond_to?(:assets)
|
|
26
|
+
app.config.assets.precompile += %w[
|
|
27
|
+
chat_manager/chat.css
|
|
28
|
+
chat_manager/application.css
|
|
29
|
+
]
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
module ChatManager
|
|
2
|
+
module Helpers
|
|
3
|
+
def chat_list(card_path, active_uuid: nil, download_csv_path: nil, download_all_csv_path: nil)
|
|
4
|
+
render "chat_manager/chat_list", locals: { card_path: card_path, active_uuid: active_uuid, download_csv_path: download_csv_path, download_all_csv_path: download_all_csv_path }
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ChatManager
|
|
4
|
+
module TitleGeneratable
|
|
5
|
+
extend ActiveSupport::Concern
|
|
6
|
+
|
|
7
|
+
# Generate a title for the chat by summarizing the user's prompt.
|
|
8
|
+
# Delegates the actual summarization to `summarize_for_title`,
|
|
9
|
+
# which must be implemented by the including model.
|
|
10
|
+
def generate_title(prompt_text, jwt_token)
|
|
11
|
+
return if title.present?
|
|
12
|
+
|
|
13
|
+
summary = summarize_for_title(prompt_text, jwt_token)
|
|
14
|
+
update!(title: summary.truncate(255)) if summary.present?
|
|
15
|
+
rescue StandardError => e
|
|
16
|
+
Rails.logger.error "Failed to generate chat title: #{e.class} - #{e.message}"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
# Override this method in your model to provide the actual summarization logic.
|
|
22
|
+
# Should return a short title string.
|
|
23
|
+
def summarize_for_title(_prompt_text, _jwt_token)
|
|
24
|
+
raise NotImplementedError, "#{self.class} must implement #summarize_for_title"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
data/lib/chat_manager.rb
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require "chat_manager/version"
|
|
2
|
+
require "chat_manager/engine"
|
|
3
|
+
require "chat_manager/helpers"
|
|
4
|
+
require "chat_manager/chat_manageable"
|
|
5
|
+
require "chat_manager/csv_downloadable"
|
|
6
|
+
require "chat_manager/title_generatable"
|
|
7
|
+
|
|
8
|
+
module ChatManager
|
|
9
|
+
# Your code goes here...
|
|
10
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
module ChatManager
|
|
3
|
+
module Generators
|
|
4
|
+
class ModelingGenerator < Rails::Generators::Base
|
|
5
|
+
include Rails::Generators::Migration
|
|
6
|
+
|
|
7
|
+
source_root File.expand_path("templates", __dir__)
|
|
8
|
+
|
|
9
|
+
def self.next_migration_number(dirname)
|
|
10
|
+
next_migration_number = current_migration_number(dirname) + 1
|
|
11
|
+
ActiveRecord::Migration.next_migration_number(next_migration_number)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def add_migrations
|
|
15
|
+
migration_template "db/migrate/create_chat_manager_chat.rb", "db/migrate/create_chat_manager_chat.rb"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: chat_manager
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- dhq_boiler
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: rails
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 8.1.2
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 8.1.2
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: csv
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
description: ChatManager is a Rails engine that provides chat management, automatic
|
|
41
|
+
title generation from initial prompts, and CSV export for individual or bulk chat
|
|
42
|
+
downloads. It includes UI components with Stimulus-powered inline title editing
|
|
43
|
+
and a database migration generator.
|
|
44
|
+
email:
|
|
45
|
+
- dhq_boiler@live.jp
|
|
46
|
+
executables: []
|
|
47
|
+
extensions: []
|
|
48
|
+
extra_rdoc_files: []
|
|
49
|
+
files:
|
|
50
|
+
- CHANGELOG.md
|
|
51
|
+
- MIT-LICENSE
|
|
52
|
+
- README.md
|
|
53
|
+
- Rakefile
|
|
54
|
+
- app/assets/stylesheets/chat_manager/application.css
|
|
55
|
+
- app/assets/stylesheets/chat_manager/chat.css
|
|
56
|
+
- app/controllers/chat_manager/application_controller.rb
|
|
57
|
+
- app/helpers/chat_manager/application_helper.rb
|
|
58
|
+
- app/jobs/chat_manager/application_job.rb
|
|
59
|
+
- app/mailers/chat_manager/application_mailer.rb
|
|
60
|
+
- app/models/chat_manager/application_record.rb
|
|
61
|
+
- app/views/chat_manager/_chat_card.html.erb
|
|
62
|
+
- app/views/chat_manager/_chat_list.html.erb
|
|
63
|
+
- app/views/layouts/chat_manager/application.html.erb
|
|
64
|
+
- config/routes.rb
|
|
65
|
+
- lib/chat_manager.rb
|
|
66
|
+
- lib/chat_manager/chat_manageable.rb
|
|
67
|
+
- lib/chat_manager/csv_downloadable.rb
|
|
68
|
+
- lib/chat_manager/engine.rb
|
|
69
|
+
- lib/chat_manager/helpers.rb
|
|
70
|
+
- lib/chat_manager/title_generatable.rb
|
|
71
|
+
- lib/chat_manager/version.rb
|
|
72
|
+
- lib/generators/chat_manager/modeling/modeling_generator.rb
|
|
73
|
+
- lib/generators/chat_manager/modeling/templates/db/migrate/create_chat_manager_chat.rb
|
|
74
|
+
- lib/tasks/chat_manager_tasks.rake
|
|
75
|
+
homepage: https://github.com/jdkim/chat_manager
|
|
76
|
+
licenses:
|
|
77
|
+
- MIT
|
|
78
|
+
metadata:
|
|
79
|
+
allowed_push_host: https://rubygems.org
|
|
80
|
+
homepage_uri: https://github.com/jdkim/chat_manager
|
|
81
|
+
source_code_uri: https://github.com/jdkim/chat_manager
|
|
82
|
+
changelog_uri: https://github.com/jdkim/chat_manager/blob/main/CHANGELOG.md
|
|
83
|
+
rdoc_options: []
|
|
84
|
+
require_paths:
|
|
85
|
+
- lib
|
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - ">="
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: '0'
|
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
96
|
+
requirements: []
|
|
97
|
+
rubygems_version: 3.6.9
|
|
98
|
+
specification_version: 4
|
|
99
|
+
summary: A Rails engine for managing LLM chat conversations with CSV export and auto-titling.
|
|
100
|
+
test_files: []
|