autonomous-app 0.2.17__tar.gz → 0.2.19__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.
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/PKG-INFO +1 -1
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/__init__.py +1 -1
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/ai/oaiagent.py +1 -1
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/logger.py +2 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/model/automodel.py +15 -6
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/storage/imagestorage.py +37 -18
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous_app.egg-info/PKG-INFO +1 -1
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/LICENSE +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/README.md +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/pyproject.toml +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/requirements.txt +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/setup.cfg +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/setup.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/ai/__init__.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/auth/__init__.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/auth/autoauth.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/auth/github.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/auth/google.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/auth/user.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/cli.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/db/__init__.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/db/autodb.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/db/table.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/errors/__init__.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/errors/danglingreferenceerror.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/model/__init__.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/model/autoattribute.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/model/orm.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/model/serializer.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/storage/__init__.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/storage/localstorage.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/storage/markdown.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/storage/version_control/GHCallbacks.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/storage/version_control/GHOrganization.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/storage/version_control/GHRepo.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/storage/version_control/GHVersionControl.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/storage/version_control/__init__.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/tasks/__init__.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/tasks/autotask.py +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous_app.egg-info/SOURCES.txt +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous_app.egg-info/dependency_links.txt +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous_app.egg-info/requires.txt +0 -0
- {autonomous_app-0.2.17 → autonomous_app-0.2.19}/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.
|
|
3
|
+
Version: 0.2.19
|
|
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
|
|
@@ -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-
|
|
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:
|
|
@@ -28,6 +28,8 @@ class Logger:
|
|
|
28
28
|
level = os.environ.get("LOG_LEVEL") or self.logger.level
|
|
29
29
|
self.logger.setLevel(log_levels.get(level, "DEBUG"))
|
|
30
30
|
self.enabled = True
|
|
31
|
+
if not os.path.exists("logs"):
|
|
32
|
+
os.makedirs("logs")
|
|
31
33
|
self.logfile = "logs/current_run_error_log.log"
|
|
32
34
|
self.logarchive = (
|
|
33
35
|
f"logs/error_log-{datetime.datetime.now().strftime('%Y-%m-%d')}.log"
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
# default : Optional[str] = "value" # for default values
|
|
3
3
|
import copy
|
|
4
4
|
import importlib
|
|
5
|
-
import json
|
|
6
5
|
from abc import ABC
|
|
7
6
|
from datetime import datetime
|
|
8
7
|
|
|
@@ -119,12 +118,18 @@ class AutoModel(ABC):
|
|
|
119
118
|
v = v.default
|
|
120
119
|
setattr(obj, k, result.get(k, copy.deepcopy(v)))
|
|
121
120
|
obj.pk = pk
|
|
121
|
+
for key, val in list(kwargs.items()):
|
|
122
|
+
if (
|
|
123
|
+
getattr(cls, key, None)
|
|
124
|
+
and getattr(cls, key).fset
|
|
125
|
+
and f"_{key}" in cls.attributes
|
|
126
|
+
):
|
|
127
|
+
kwargs[f"_{key}"] = kwargs.pop(key)
|
|
122
128
|
obj.__dict__ |= kwargs
|
|
123
129
|
# breakpoint()
|
|
124
130
|
obj.__dict__ = AutoDecoder.decode(obj.__dict__)
|
|
125
131
|
obj._automodel = obj.model_name(qualified=True)
|
|
126
132
|
obj.last_updated = datetime.now()
|
|
127
|
-
|
|
128
133
|
return obj
|
|
129
134
|
|
|
130
135
|
def __getattribute__(self, name):
|
|
@@ -249,20 +254,24 @@ class AutoModel(ABC):
|
|
|
249
254
|
val = getattr(self, key)
|
|
250
255
|
if vattr.type == "TEXT":
|
|
251
256
|
if not isinstance(val, str):
|
|
252
|
-
raise TypeError(
|
|
257
|
+
raise TypeError(
|
|
258
|
+
f"{key} value must be a string, not {type(val)}"
|
|
259
|
+
)
|
|
253
260
|
elif vattr.type == "NUMERIC":
|
|
254
261
|
if not isinstance(val, (int, float)):
|
|
255
|
-
raise TypeError(
|
|
262
|
+
raise TypeError(
|
|
263
|
+
f"{key} value must be a number, not {type(val)}"
|
|
264
|
+
)
|
|
256
265
|
elif vattr.type == "MODEL":
|
|
257
266
|
# log(isinstance(val, (AutoModel, DelayedModel)), type(val))
|
|
258
267
|
if val is not None and not isinstance(
|
|
259
268
|
val, (AutoModel, DelayedModel)
|
|
260
269
|
):
|
|
261
270
|
raise TypeError(
|
|
262
|
-
f"
|
|
271
|
+
f"{key} value must be an AutoModel or None, not {type(val)}"
|
|
263
272
|
)
|
|
264
273
|
else:
|
|
265
|
-
raise ValueError(f"Invalid type {self.type}")
|
|
274
|
+
raise ValueError(f"{key}: Invalid type {self.type}")
|
|
266
275
|
|
|
267
276
|
if vattr.required and val is None:
|
|
268
277
|
raise ValueError(f"{key} is required")
|
|
@@ -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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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.
|
|
3
|
+
Version: 0.2.19
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/errors/danglingreferenceerror.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/storage/version_control/GHRepo.py
RENAMED
|
File without changes
|
|
File without changes
|
{autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous/storage/version_control/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{autonomous_app-0.2.17 → autonomous_app-0.2.19}/src/autonomous_app.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|