walkthrough_awanllm 0.1.20 → 0.2.12
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 +4 -4
- data/README.md +7 -3
- data/lib/walkthrough_awanllm/version.rb +1 -1
- data/lib/walkthrough_awanllm.rb +76 -11
- data/walkthrough_awanllm.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b76c11f4c34ccc7a844c06185e914b47051ebf39d0a854f936dc01f6cde6466
|
4
|
+
data.tar.gz: af9165c374930e086281ff113bebb931d555bf84a9bd2bb9e512d66827fadac6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdddb7addbbe2ce894a03983573afa05fd1a4a713b4d4b3b0306eff67957db6b60b777efbe2cbe64f1215c59f70e596ac620c1cd7abf1bb865d9f3b7a45dc728
|
7
|
+
data.tar.gz: a82152fe5b7c7b08b759eaa37dc924c0192e24e58b7027dcf534aa71ed0d02fd78893d9c828ec724c122589ac0621e93fe55a4e46792966ac2f25d376ba95e10
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
Here's an updated README for your gem `walkthrough_awanllm`, including all necessary installation and usage instructions, as well as development and contributing guidelines.
|
1
|
+
Here's an updated README for your gem `walkthrough_awanllm`, including all necessary installation and usage instructions, as well as development and contributing guidelines. All credits for AwanLLM goes to the orginal creators of API for offering a free tier.
|
2
2
|
|
3
|
+
### Email: contact.awanllm@gmail.com
|
4
|
+
### https://www.awanllm.com/
|
3
5
|
```markdown
|
4
6
|
# WalkthroughAwanllm
|
5
7
|
|
@@ -30,9 +32,11 @@ $ gem install walkthrough_awanllm
|
|
30
32
|
After installing the gem, you need to configure it by running the setup script. This will prompt you for your AwanLLM API key and the model name you wish to use.
|
31
33
|
|
32
34
|
```sh
|
33
|
-
$ ruby ./vendor/bundle/ruby/YOUR_VERSION/gems/walkthrough_awanllm-0.
|
35
|
+
$ ruby ./vendor/bundle/ruby/YOUR_VERSION/gems/walkthrough_awanllm-0.2.12/bin/setup_awanllm.rb
|
34
36
|
```
|
35
37
|
|
38
|
+
Get API key from https://www.awanllm.com/
|
39
|
+
|
36
40
|
## Usage
|
37
41
|
|
38
42
|
|
@@ -45,7 +49,7 @@ rails console
|
|
45
49
|
> awanllm = WalkthroughAwanllm::AwanLLM.new
|
46
50
|
> awanllm.generate_walkthrough
|
47
51
|
```
|
48
|
-
|
52
|
+
(IF ABOVE IS NOT WORKING) by running :
|
49
53
|
```ruby
|
50
54
|
rails awanllm:generate_walkthrough
|
51
55
|
```
|
data/lib/walkthrough_awanllm.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require 'json'
|
3
|
+
require 'fileutils'
|
3
4
|
require_relative "walkthrough_awanllm/cli"
|
4
5
|
require_relative "walkthrough_awanllm/version"
|
5
6
|
require_relative "walkthrough_awanllm/railtie" if defined?(Rails)
|
@@ -42,20 +43,83 @@ module WalkthroughAwanllm
|
|
42
43
|
|
43
44
|
def generate_walkthrough
|
44
45
|
activities = File.read("log/awanllm_activity.log")
|
45
|
-
|
46
|
+
commits = split_by_commits(activities)
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
# Read the last processed commit hash from file
|
49
|
+
last_commit_file = "last_processed_commit.txt"
|
50
|
+
last_processed_commit = read_last_processed_commit(last_commit_file)
|
51
|
+
|
52
|
+
# Find the index of the last processed commit
|
53
|
+
start_index = commits.index { |commit| commit.include?(last_processed_commit) }
|
54
|
+
start_index = start_index.nil? ? 0 : start_index + 1 # Start from the next commit
|
55
|
+
|
56
|
+
# Extract new commits
|
57
|
+
new_commits = commits[start_index..-1] || []
|
58
|
+
return if new_commits.empty?
|
59
|
+
|
60
|
+
prompt_template = <<~PROMPT
|
61
|
+
Here is a log of activities for a specific git commit: {{commit}}.
|
62
|
+
Using this log, generate a detailed walkthrough for this commit. This walkthrough should be narrated from the first-person perspective of the developer, resembling a personal diary or story. It must include the following:
|
63
|
+
- Personal Insights: Capture the developer's thoughts, decisions, and reflections during this commit.
|
64
|
+
- Challenges: Describe any difficulties or obstacles faced and how they were resolved or worked around.
|
65
|
+
- Technical Details: Provide detailed explanations of the technical aspects and steps involved, including relevant code snippets.
|
66
|
+
- Reasoning: Explain the reasoning behind major decisions during this commit, such as choosing specific tools, technologies, or methods.
|
67
|
+
- Step-by-Step Process: Offer a structured guide through the entire commit process.
|
68
|
+
- Lessons Learned: Conclude with insights or lessons learned from this commit, including what could be done differently in future commits.
|
69
|
+
Ensure the walkthrough is thorough, engaging, and informative, offering a deep dive into the developer's journey during this commit.
|
70
|
+
PROMPT
|
71
|
+
|
72
|
+
walkthrough = ""
|
52
73
|
|
53
|
-
|
54
|
-
|
74
|
+
new_commits.each do |commit|
|
75
|
+
prompt = prompt_template.gsub("{{commit}}", commit)
|
76
|
+
options = {
|
77
|
+
temperature: 0.7,
|
78
|
+
top_p: 0.9,
|
79
|
+
max_tokens: 2048 # Adjust if your model supports more tokens
|
80
|
+
}
|
55
81
|
|
56
|
-
|
57
|
-
|
82
|
+
response = generate_content(nil, prompt, options)
|
83
|
+
commit_walkthrough = response['choices'][0]['text']
|
84
|
+
|
85
|
+
walkthrough += commit_walkthrough + "\n\n"
|
58
86
|
end
|
87
|
+
|
88
|
+
# Append to the file only if it exists
|
89
|
+
if File.exist?("walkthrough.md")
|
90
|
+
File.open("walkthrough.md", "a") do |file|
|
91
|
+
file.puts("\n")
|
92
|
+
file.puts(walkthrough)
|
93
|
+
end
|
94
|
+
else
|
95
|
+
File.write("walkthrough.md", walkthrough)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Update the last processed commit hash
|
99
|
+
update_last_processed_commit(last_commit_file, extract_commit_hash(new_commits.last))
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
# Method to split the log by git commits
|
104
|
+
def split_by_commits(log_content)
|
105
|
+
log_content.scan(/#### Commit Details:.*?(?=(### \[|\z))/m).map(&:strip)
|
106
|
+
end
|
107
|
+
|
108
|
+
# Read the last processed commit from file
|
109
|
+
def read_last_processed_commit(file)
|
110
|
+
return nil unless File.exist?(file)
|
111
|
+
File.read(file).strip
|
112
|
+
end
|
113
|
+
|
114
|
+
# Update the last processed commit in file
|
115
|
+
def update_last_processed_commit(file, commit_hash)
|
116
|
+
File.write(file, commit_hash)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Extract the commit hash from a commit section
|
120
|
+
def extract_commit_hash(commit_section)
|
121
|
+
match = commit_section.match(/#### Commit Details: (\w+)/)
|
122
|
+
match[1] if match
|
59
123
|
end
|
60
124
|
|
61
125
|
def self.activate!
|
@@ -67,7 +131,7 @@ module WalkthroughAwanllm
|
|
67
131
|
puts 'Walkthrough_AwanLLM gem is already configured.'
|
68
132
|
else
|
69
133
|
ruby_version = RUBY_VERSION.split('.').first(3).join('.')
|
70
|
-
path_to_script = "./vendor/bundle/ruby/#{ruby_version}/gems/walkthrough_awanllm-0.
|
134
|
+
path_to_script = "./vendor/bundle/ruby/#{ruby_version}/gems/walkthrough_awanllm-0.2.12/bin/setup_awanllm.rb"
|
71
135
|
system("ruby #{path_to_script}")
|
72
136
|
end
|
73
137
|
end
|
@@ -85,5 +149,6 @@ module WalkthroughAwanllm
|
|
85
149
|
raise "Error: #{response.code} - #{error_message}"
|
86
150
|
end
|
87
151
|
end
|
152
|
+
|
88
153
|
end
|
89
154
|
end
|
data/walkthrough_awanllm.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["mrudulmathews@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = "A Ruby gem to Generate Project Development Walkthrough with the AwanLLM API."
|
12
|
-
spec.description = "
|
12
|
+
spec.description = "A Ruby gem to generate a walkthrough the project lifecycle with the AwanLLM API for generating and retrieving content. Please feel free to update the gem with your updates"
|
13
13
|
spec.homepage = "https://github.com/mruduljohn/Walkthrough_awanllm_gem"
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = ">= 3.0.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: walkthrough_awanllm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mrudul John
|
@@ -80,8 +80,9 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '5.0'
|
83
|
-
description:
|
84
|
-
|
83
|
+
description: A Ruby gem to generate a walkthrough the project lifecycle with the AwanLLM
|
84
|
+
API for generating and retrieving content. Please feel free to update the gem with
|
85
|
+
your updates
|
85
86
|
email:
|
86
87
|
- mrudulmathews@gmail.com
|
87
88
|
executables:
|
@@ -110,7 +111,7 @@ metadata:
|
|
110
111
|
post_install_message: |2
|
111
112
|
Thank you for installing the Walkthrough_AwanLLM gem!
|
112
113
|
To complete the setup, please run the following command:
|
113
|
-
ruby ./vendor/bundle/ruby/3.3.0/gems/walkthrough_awanllm-0.
|
114
|
+
ruby ./vendor/bundle/ruby/3.3.0/gems/walkthrough_awanllm-0.2.12/bin/setup_awanllm.rb
|
114
115
|
rdoc_options: []
|
115
116
|
require_paths:
|
116
117
|
- lib
|