Skip to content

Commit

Permalink
feat: add black formatter (#12)
Browse files Browse the repository at this point in the history
* feat: add black formatter

* Update README.md

Signed-off-by: FortiShield <161459699+FortiShield@users.noreply.github.com>

* Update README.md

Signed-off-by: FortiShield <161459699+FortiShield@users.noreply.github.com>

---------

Signed-off-by: FortiShield <161459699+FortiShield@users.noreply.github.com>
  • Loading branch information
FortiShield authored Jun 8, 2024
1 parent ea2f54a commit 33d753e
Show file tree
Hide file tree
Showing 19 changed files with 308 additions and 274 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# GPT Computer Agent

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/khulnasoft/gpt-computer-agent)

Hi, this is an alternative work for providing ChatGPT MacOS app to Windows and Linux. In this way this is a fresh and stable work. You can easily install as Python library for this time but we will prepare a pipeline to providing native install scripts (.exe).

## Installation && Run
Expand Down
28 changes: 18 additions & 10 deletions bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,51 @@
import sys
import re


def read_version():
with open('gpt_computer_agent/__init__.py', 'r') as file:
with open("gpt_computer_agent/__init__.py", "r") as file:
for line in file:
match = re.search(r"__version__ = '(.*)'", line)
if match:
return match.group(1)


def increment_version(part, version):
major, minor, patch = map(int, version.split('.'))
if part == 'major':
major, minor, patch = map(int, version.split("."))
if part == "major":
major += 1
minor = 0
patch = 0
elif part == 'minor':
elif part == "minor":
minor += 1
patch = 0
elif part == 'patch':
elif part == "patch":
patch += 1
return f'{major}.{minor}.{patch}'
return f"{major}.{minor}.{patch}"


def write_version(version):
with open('gpt_computer_agent/__init__.py', 'r+') as file:
with open("gpt_computer_agent/__init__.py", "r+") as file:
content = file.read()
content = re.sub(r"__version__ = '.*'", f"__version__ = '{version}'", content)
file.seek(0)
file.write(content)


def update_version(version):
files = ['setup.py']
files = ["setup.py"]
for file in files:
with open(file, 'r+') as f:
with open(file, "r+") as f:
content = f.read()
content = re.sub(r' version=".*"', f' version="{version}"', content)
f.seek(0)
f.write(content)


def create_tag(version):
os.system(f"git tag v{version}")


def create_commit(version):
os.system("git add .")
os.system(f"git commit -m 'Changed version number with v{version}'")
Expand All @@ -50,6 +56,7 @@ def push():
os.system("git push")
os.system("git push --tag")


def main():
part = sys.argv[1]
version = read_version()
Expand All @@ -60,5 +67,6 @@ def main():
create_tag(new_version)
push()

if __name__ == '__main__':

if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion gpt_computer_agent/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .start import start


__version__ = '0.1.1'
__version__ = "0.1.1"
9 changes: 2 additions & 7 deletions gpt_computer_agent/agent/agent.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
from ..llm import *




from langgraph.checkpoint.sqlite import SqliteSaver





from langgraph.prebuilt import chat_agent_executor

try:
from upsonic import Tiger

tools = Tiger()
tools.enable_auto_requirements = True
tools = tools.langchain()
except ImportError:
from langchain.agents import Tool
from langchain_experimental.utilities import PythonREPL

python_repl = PythonREPL()
# You can create the tool to pass to an agent
repl_tool = Tool(
Expand All @@ -29,12 +26,10 @@
tools = [repl_tool]



def get_agent_executor():
return chat_agent_executor.create_tool_calling_executor(get_model(), tools)



"""
from langchain.agents import Tool
from langchain_experimental.utilities import PythonREPL
Expand Down
4 changes: 2 additions & 2 deletions gpt_computer_agent/agent/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
llm_history_oiginal = [
SystemMessage(
content="You are a helpful and intelligent agent. But converting your text to the speech process can be long so please make your answers as short as possible. Answer with a maximum of 3 sentences. Also, please feel free to use tools. If you want to make a long answer, use the clipboard tool and say 'I just copied the answer.' Use this method for codes, text fixes. If the user wants to take an action, just make the action and say 'ok.' Like copying to clipboard."
)
]
)
]
5 changes: 2 additions & 3 deletions gpt_computer_agent/agent/chat_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
from ..utils.db import get_history_db



def get_chat_message_history():
print("HISTORY DB", get_history_db())
connection = SQLChatMessageHistory(
session_id="abc123", connection_string=f"sqlite:///{get_history_db()}")
session_id="abc123", connection_string=f"sqlite:///{get_history_db()}"
)
if len(connection.messages) == 0:
connection.add_message(llm_history_oiginal[0])

return connection



def clear_chat_history():
get_chat_message_history().clear()
Expand Down
Loading

0 comments on commit 33d753e

Please sign in to comment.