autonomous-app 0.2.17__tar.gz → 0.2.18__tar.gz

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.
Files changed (43) hide show
  1. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/PKG-INFO +1 -1
  2. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/__init__.py +1 -1
  3. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/ai/oaiagent.py +1 -1
  4. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/storage/imagestorage.py +37 -18
  5. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous_app.egg-info/PKG-INFO +1 -1
  6. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/LICENSE +0 -0
  7. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/README.md +0 -0
  8. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/pyproject.toml +0 -0
  9. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/requirements.txt +0 -0
  10. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/setup.cfg +0 -0
  11. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/setup.py +0 -0
  12. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/ai/__init__.py +0 -0
  13. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/auth/__init__.py +0 -0
  14. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/auth/autoauth.py +0 -0
  15. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/auth/github.py +0 -0
  16. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/auth/google.py +0 -0
  17. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/auth/user.py +0 -0
  18. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/cli.py +0 -0
  19. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/db/__init__.py +0 -0
  20. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/db/autodb.py +0 -0
  21. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/db/table.py +0 -0
  22. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/errors/__init__.py +0 -0
  23. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/errors/danglingreferenceerror.py +0 -0
  24. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/logger.py +0 -0
  25. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/model/__init__.py +0 -0
  26. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/model/autoattribute.py +0 -0
  27. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/model/automodel.py +0 -0
  28. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/model/orm.py +0 -0
  29. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/model/serializer.py +0 -0
  30. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/storage/__init__.py +0 -0
  31. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/storage/localstorage.py +0 -0
  32. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/storage/markdown.py +0 -0
  33. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/storage/version_control/GHCallbacks.py +0 -0
  34. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/storage/version_control/GHOrganization.py +0 -0
  35. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/storage/version_control/GHRepo.py +0 -0
  36. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/storage/version_control/GHVersionControl.py +0 -0
  37. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/storage/version_control/__init__.py +0 -0
  38. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/tasks/__init__.py +0 -0
  39. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous/tasks/autotask.py +0 -0
  40. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous_app.egg-info/SOURCES.txt +0 -0
  41. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous_app.egg-info/dependency_links.txt +0 -0
  42. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous_app.egg-info/requires.txt +0 -0
  43. {autonomous_app-0.2.17 → autonomous_app-0.2.18}/src/autonomous_app.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autonomous-app
3
- Version: 0.2.17
3
+ Version: 0.2.18
4
4
  Summary: Containerized application framework built on Flask with additional libraries and tools for rapid development of web applications.
5
5
  Author-email: Steven A Moore <samoore@binghamton.edu>
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- __version__ = "0.2.17"
1
+ __version__ = "0.2.18"
2
2
 
3
3
  from .logger import log
4
4
  from .model.automodel import AutoModel
@@ -194,7 +194,7 @@ class OAIAgent(AutoModel):
194
194
  },
195
195
  {"role": "user", "content": text},
196
196
  ]
197
- response = self.client.chat.completions.create(model="gpt-4", messages=message)
197
+ response = self.client.chat.completions.create(model="gpt-4o", messages=message)
198
198
  try:
199
199
  result = response.choices[0].message.content
200
200
  except Exception as e:
@@ -3,7 +3,7 @@ import os
3
3
  import shutil
4
4
  import uuid
5
5
 
6
- from PIL import Image
6
+ from PIL import Image, UnidentifiedImageError
7
7
 
8
8
  from autonomous import log
9
9
 
@@ -24,13 +24,17 @@ class ImageStorage:
24
24
  def _resize_image(self, asset_id, max_size=1024):
25
25
  # log("Resizing image", asset_id, max_size)
26
26
  file_path = f"{self.get_path(asset_id)}/orig.webp"
27
- with Image.open(file_path) as img:
28
- resized_img = img.copy()
29
- max_size = self._sizes.get(max_size) or int(max_size)
30
- resized_img.thumbnail((max_size, max_size))
31
- img_byte_arr = io.BytesIO()
32
- resized_img.save(img_byte_arr, format="WEBP")
33
- return img_byte_arr.getvalue()
27
+ try:
28
+ with Image.open(file_path) as img:
29
+ resized_img = img.copy()
30
+ max_size = self._sizes.get(max_size) or int(max_size)
31
+ resized_img.thumbnail((max_size, max_size))
32
+ img_byte_arr = io.BytesIO()
33
+ resized_img.save(img_byte_arr, format="WEBP")
34
+ return img_byte_arr.getvalue()
35
+ except UnidentifiedImageError as e:
36
+ log(f"Error resizing image: {e}")
37
+ return None
34
38
 
35
39
  def _convert_image(self, raw, crop=False):
36
40
  with Image.open(io.BytesIO(raw)) as img:
@@ -66,25 +70,40 @@ class ImageStorage:
66
70
  original_path = f"{self.get_path(asset_id)}"
67
71
  # log(f"Getting image: {asset_id}.{size}", original_path)
68
72
  if not os.path.exists(original_path):
69
- # log(f"Original image not found: {original_path}")
73
+ log(f"Original image not found: {original_path}")
70
74
  return ""
71
75
  file_path = f"{original_path}/{size}.webp"
72
76
  # log(file_path)
77
+ result_url = f"/{file_path}"
78
+ # log(
79
+ # f"{asset_id}",
80
+ # size,
81
+ # os.path.exists(original_path),
82
+ # os.path.exists(file_path),
83
+ # )
73
84
  if (
74
85
  size != "orig"
75
86
  and os.path.exists(original_path)
76
87
  and not os.path.exists(file_path)
77
88
  ):
78
89
  # If the file doesn't exist, create it
79
- result = self._resize_image(asset_id, size)
80
- with open(file_path, "wb") as asset:
81
- asset.write(result)
82
- result_url = (
83
- f"/{file_path}"
84
- if not full_url
85
- else f"{os.environ.get('APP_BASE_URL', '')}/{file_path}"
86
- )
87
- # log(f"Returning image url: {result_url}")
90
+ if result := self._resize_image(asset_id, size):
91
+ with open(file_path, "wb") as asset:
92
+ asset.write(result)
93
+ result_url = (
94
+ f"/{file_path}"
95
+ if not full_url
96
+ else f"{os.environ.get('APP_BASE_URL', '')}/{file_path}"
97
+ )
98
+ else:
99
+ log(
100
+ f"Error resizing image: {asset_id}",
101
+ size,
102
+ os.path.exists(original_path),
103
+ os.path.exists(file_path),
104
+ )
105
+ self.remove(asset_id)
106
+ # log(f"Returning image: {result_url}")
88
107
  return result_url
89
108
 
90
109
  def get_path(self, asset_id):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autonomous-app
3
- Version: 0.2.17
3
+ Version: 0.2.18
4
4
  Summary: Containerized application framework built on Flask with additional libraries and tools for rapid development of web applications.
5
5
  Author-email: Steven A Moore <samoore@binghamton.edu>
6
6
  License: MIT License
File without changes