Skip to content

Commit

Permalink
Merge pull request #1114 from TransformerOptimus/github_add_file
Browse files Browse the repository at this point in the history
made changes to github helper
  • Loading branch information
Tarraann committed Aug 25, 2023
2 parents 1d5d066 + 2fb1fe1 commit 5360f01
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions superagi/helper/github_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ def add_file(self, repository_owner, repository_name, file_name, folder_path, he
Returns:
None
"""
body = self._get_file_content(file_name, agent_id, agent_execution_id, session)
body = self._get_file_contents(file_name, agent_id, agent_execution_id, session)
body_bytes = body.encode("ascii")
base64_bytes = base64.b64encode(body_bytes)
file_content = base64_bytes.decode("ascii")
file_path = self.get_file_path(file_name, folder_path)
file_url = f'https://api.github.com/repos/{self.github_username}/{repository_name}/contents/{file_path}'
file_url = f'https://api.github.com/repos/{repository_owner}/{repository_name}/contents/{file_path}'
file_params = {
'message': commit_message,
'content': file_content,
Expand Down Expand Up @@ -328,6 +328,7 @@ def _get_file_contents(self, file_name, agent_id, agent_execution_id, session):
agent=Agent.get_agent_from_id(session, agent_id),
agent_execution=AgentExecution.get_agent_execution_from_id(
session, agent_execution_id))

if StorageType.get_storage_type(get_config("STORAGE_TYPE", StorageType.FILE.value)) == StorageType.S3:
attachment_data = S3Helper().read_from_s3(final_path)
else:
Expand Down

0 comments on commit 5360f01

Please sign in to comment.