appchat 0.0.2 → 0.0.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9bb854d39e8d17f65dcc5ff09269f488e63a50fe080e1c7ae104d9326d8d8b9
|
4
|
+
data.tar.gz: 50c75e1d61f287bd89d865b9dffbd24bd77c5448cc13c6407788117a0c49140f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddecc383090bcb31337e1fab220b510fe62afe86d2763cbd95a837b2ae87c52f7aef7d08130411b02e443c76c5392a70d1481cc1556e4928a29aefbe30c1c91a
|
7
|
+
data.tar.gz: a04b84d8eab498add64fb2e4111a8fd491e6dec1af3a984957dfc713c26c4f55d90acff6a16ca83a0d9806087efb26db87b06ec4f861e77bc6ff338e4ac227d2
|
@@ -24,7 +24,7 @@ class AppchatGenerator < Rails::Generators::Base
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def generate_scaffolds
|
27
|
-
generate "model", "Chat"
|
27
|
+
generate "model", "Chat context:text"
|
28
28
|
route "resources :chats"
|
29
29
|
generate "scaffold", "Message chat:references content:text role:integer"
|
30
30
|
end
|
@@ -45,6 +45,10 @@ class AppchatGenerator < Rails::Generators::Base
|
|
45
45
|
copy_file "models/chat.rb", "app/models/chat.rb", force: true
|
46
46
|
end
|
47
47
|
|
48
|
+
def serialize_context
|
49
|
+
inject_into_class 'app/models/chat.rb', 'Chat', "serialize :context, coder:JSON, type: Array\n"
|
50
|
+
end
|
51
|
+
|
48
52
|
def set_associations
|
49
53
|
inject_into_class 'app/models/chat.rb', 'Chat', " has_many :messages, dependent: :destroy\n"
|
50
54
|
end
|
@@ -76,6 +80,10 @@ class AppchatGenerator < Rails::Generators::Base
|
|
76
80
|
ART
|
77
81
|
end
|
78
82
|
|
83
|
+
def get_started
|
84
|
+
puts "Congratulations on setting up appchat! \n run bin/dev to spin up your app, and visit localhost:3000/chats to start chatting"
|
85
|
+
end
|
86
|
+
|
79
87
|
private
|
80
88
|
|
81
89
|
def gem_exists?(gem_name)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
</style>
|
6
6
|
<div class="flex w-full">
|
7
7
|
<%= turbo_stream_from :chats %>
|
8
|
-
<div class="max-w-sm w-full flex flex-col gap-4 p-2 w-full flex-shrink-0 bg-[#2e2e2e] rounded-lg" id="chats">
|
8
|
+
<div class="max-w-sm w-full h-full flex flex-col gap-4 p-2 w-full flex-shrink-0 bg-[#2e2e2e] rounded-lg" id="chats">
|
9
9
|
<%= link_to chats_path, data: { turbo_method: :post, turbo_frame: :chat }, class: "flex gap-2 justify-center items-center bg-gray-500 text-gray-100 rounded-lg p-2 text-center mr-auto" do %>
|
10
10
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
11
11
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
|
@@ -22,6 +22,7 @@ class GetAiResponseJob < ApplicationJob
|
|
22
22
|
{
|
23
23
|
model: 'llama3.1',
|
24
24
|
prompt: user_prompt,
|
25
|
+
context: chat.context,
|
25
26
|
stream: true,
|
26
27
|
}
|
27
28
|
) do |event, raw|
|
@@ -32,5 +33,6 @@ class GetAiResponseJob < ApplicationJob
|
|
32
33
|
message.update(content: new_content)
|
33
34
|
end
|
34
35
|
end
|
36
|
+
chat.update(context: response.last["context"])
|
35
37
|
end
|
36
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appchat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hackliteracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,7 +88,8 @@ files:
|
|
88
88
|
homepage: https://rubygems.org/gems/appchat
|
89
89
|
licenses:
|
90
90
|
- MIT
|
91
|
-
metadata:
|
91
|
+
metadata:
|
92
|
+
source_code_uri: https://github.com/ktamulonis/appchat
|
92
93
|
post_install_message:
|
93
94
|
rdoc_options: []
|
94
95
|
require_paths:
|