Skip to content

Commit bd031fd

Browse files
Merge pull request #39 from jd-apprentice/develop
Develop
2 parents 452b143 + baefe5b commit bd031fd

File tree

12 files changed

+53
-17
lines changed

12 files changed

+53
-17
lines changed

DEBIAN/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: dbn-tools
2-
Version: 0.0.9
2+
Version: 0.1.0
33
Section: utils
44
Priority: optional
55
Architecture: all

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM ubuntu:jammy
55
RUN apt-get update
66
RUN apt-get install -y --no-install-recommends wget=1.21.2-2ubuntu1 git=1:2.34.1-1ubuntu1.6 curl=7.81.0-1ubuntu1.7 net-tools=1.60+git20181103.0eebece-1ubuntu5 python3-dev=3.10.6-1~22.04 python3-pip=22.0.2+dfsg-1ubuntu0.1
77
RUN pip3 install requests==2.28.2 \
8-
yt-dlp==2023.1.6
8+
yt-dlp==2023.1.6 \ openai==0.27.2
99

1010
# We download the app and install it - These values are default, use the version you want to download in the .env file
1111
ARG DOWNLOAD_URL=https://github.com/jd-apprentice/dbn-tools/releases/download/0.0.6/0.6-dbn-tools.deb

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ We use codacy here is the [DASHBOARD](https://app.codacy.com/gh/jd-apprentice/db
8989

9090
- Bash
9191
- Git
92-
- Debtap (Arch)
92+
- Debtap [Repository](https://github.com/helixarch/debtap)
9393
- Python 3
9494

9595
## 🐍 Python dependencies
9696

97-
- Requests
97+
- Requests [Requests](https://pypi.org/project/requests/)
98+
- Openai [GPT-3](https://pypi.org/project/openai/)
9899

99100
## 🐛 Troubleshot
100101

@@ -106,6 +107,14 @@ For more information, check the [TROUBLESHOT](./TROUBLESHOT.md) file
106107
| -------------- | --------------------------------------------------------------------------------------------- |
107108
| `DOWNLOAD_URL` | URL to download a package get it from here -> https://github.com/jd-apprentice/dbn-tools/tags |
108109
| `PACKAGE_NAME` | Name of the package being downloaded (is the name of the file from the other variable) |
110+
| `GPT_KEY` | Key to use GPT-3 API - Add it on your shell configuration |
111+
112+
```bash
113+
## For the `GPT_KEY` we are reading it from .bashrc or .zshrc depending on your shell
114+
## Add a line like this:
115+
116+
GPT_KEY='YOUR_KEY'
117+
```
109118

110119
## 📁 Install
111120

usr/bin/constants/help.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ export descriptions=(
1414
"10 Download YT Video - Downloads a video from youtube with the best possible size and quality by default"
1515
"11) Search for a file - Searches for a file by name or wildcard pattern."
1616
"12) USR-ARS Pair - Ask the value of the USD Dolar against the argentine PESO"
17-
"13) Exit - Exit the application"
17+
"13) Ask GPT 3 - Ask anythig to the GPT 3 AI"
18+
"14) Exit - Exit the application"
1819
)

usr/bin/constants/menu-esp.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ export menu_options_spanish=(
1313
"10) Descargar Video YT"
1414
"11) Buscar archivo"
1515
"12) Dolar a pesos"
16-
"13) Salir"
16+
"13) Pregunta a GPT 3"
17+
"14) Salir"
1718
)

usr/bin/constants/menu.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ export menu_options=(
1313
"10) Download YT Video"
1414
"11) Search for a file"
1515
"12) USD-ARS Pair"
16-
"13) Exit"
16+
"13) Ask GPT 3"
17+
"14) Exit"
1718
)

usr/bin/functions/ask-gpt-3.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
3+
from time import sleep
4+
from random import uniform
5+
import os
6+
import openai
7+
8+
openai.api_key = os.environ['GPT_KEY']
9+
10+
prompt = input("Enter your prompt \n -> ")
11+
12+
completion = openai.ChatCompletion.create(
13+
model="gpt-3.5-turbo",
14+
messages=[
15+
{"role": "user", "content": prompt},
16+
]
17+
)
18+
19+
response = completion.choices[0].message.content
20+
21+
for x in response:
22+
print(x, end='', flush=True)
23+
sleep(uniform(0, 0.1))

usr/bin/functions/read-arguments.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
function ReadArguments() {
44
# Python functions (soon to be moved out)
55
UsdArs="/usr/bin/functions/usd-ars.py"
6+
AskGPT3="/usr/bin/functions/ask-gpt-3.py"
67

78
# Base options when no arguments is passed
8-
export options=(DiskUsage DeleteTemporary EmptyRecycleBin UninstallPackage SystemInfo MemoryUsage Uptime OpenPorts GetWeather DownloadVideo FindFile $UsdArs exit)
9+
export options=(DiskUsage DeleteTemporary EmptyRecycleBin UninstallPackage SystemInfo MemoryUsage Uptime OpenPorts GetWeather DownloadVideo FindFile $UsdArs $AskGPT3 exit)
910

1011
local arguments="$1"
1112
for arg in "$arguments"; do

usr/bin/functions/unistall-package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
function UninstallPackage() {
55
read -p "Enter the name of the program to uninstall: " program
66
echo "Uninstalling $program..."
7-
sudo dpkg --purge $program
7+
sudo dpkg --purge "$program"
88
}
99

1010
export -f UninstallPackage

usr/bin/functions/usd-ars.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ def print_table(data):
2828
def main():
2929
getData(dolarAPI)
3030
table_data = [["💱 Currency", "💸 Value"],
31-
["💵 Official", sackEmoji + str(arrData[0]["value_avg"]) + arsLabel],
31+
["💵 Real", sackEmoji + str(arrData[0]["value_avg"]) + arsLabel],
3232
["💵 Blue", sackEmoji + str(arrData[1]["value_avg"]) + arsLabel],
33-
["💶 Official_Euro", sackEmoji + str(arrData[2]["value_avg"]) + arsLabel],
33+
["💶 Real_Euro", sackEmoji + str(arrData[2]["value_avg"]) + arsLabel],
3434
["💶 Blue_Euro", sackEmoji + str(arrData[3]["value_avg"]) + arsLabel]]
3535
print_table(table_data)
3636

3737
# Init application
38-
main()
38+
main()

0 commit comments

Comments
 (0)