cycls 0.0.2.46__tar.gz → 0.0.2.48__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cycls
3
- Version: 0.0.2.46
3
+ Version: 0.0.2.48
4
4
  Summary: Cycls SDK
5
5
  Author: Mohammed J. AlRujayi
6
6
  Author-email: mj@cycls.com
@@ -91,7 +91,7 @@ Run it from your terminal:
91
91
  ```bash
92
92
  python main.py
93
93
  ```
94
- This will start a local server. Open your browser to http://127.0.0.1:8000 to interact with your agent.
94
+ This will start a local server. Open your browser to http://localhost:8080 to interact with your agent.
95
95
 
96
96
  ### 2. Cloud Deployment: An OpenAI-Powered Agent
97
97
  This example creates a more advanced agent that calls the OpenAI API. It will be deployed to the cloud with authentication enabled.
@@ -69,7 +69,7 @@ Run it from your terminal:
69
69
  ```bash
70
70
  python main.py
71
71
  ```
72
- This will start a local server. Open your browser to http://127.0.0.1:8000 to interact with your agent.
72
+ This will start a local server. Open your browser to http://localhost:8080 to interact with your agent.
73
73
 
74
74
  ### 2. Cloud Deployment: An OpenAI-Powered Agent
75
75
  This example creates a more advanced agent that calls the OpenAI API. It will be deployed to the cloud with authentication enabled.
@@ -30,7 +30,7 @@ class Agent:
30
30
  def decorator(f):
31
31
  self.registered_functions.append({
32
32
  "func": f,
33
- "config": ["public", False, self.org, self.api_token, header, intro, title, auth],
33
+ "config": ["theme", False, self.org, self.api_token, header, intro, title, auth],
34
34
  # "name": name,
35
35
  "name": name or (f.__name__).replace('_', '-'),
36
36
  "domain": domain or f"{name}.cycls.ai",
@@ -65,12 +65,20 @@ class Agent:
65
65
 
66
66
  i["config"][1] = False
67
67
 
68
- copy={str(self.theme):"public", str(cycls_path)+"/web.py":"web.py"}
68
+ copy={str(self.theme):"theme", str(cycls_path)+"/web.py":"web.py"}
69
69
  copy.update({i:i for i in self.copy})
70
- copy.update({i:f"a/{i}" for i in self.copy_public})
70
+ copy.update({i:f"public/{i}" for i in self.copy_public})
71
+
72
+ def runner(port):
73
+ import uvicorn, logging
74
+ # This one-liner hides the confusing "0.0.0.0" message
75
+ logging.getLogger("uvicorn.error").addFilter(type("F",(),{"filter": lambda s,r: "0.0.0.0" not in r.getMessage()})())
76
+ print(f"\n🚀 Local Link: http://localhost:{port}\n")
77
+ uvicorn.run(__import__("web").web(i["func"], *i["config"]), host="0.0.0.0", port=port)
71
78
 
72
79
  new = Runtime(
73
- func=lambda port: __import__("uvicorn").run(__import__("web").web(i["func"], *i["config"]), host="0.0.0.0", port=port),
80
+ # func=lambda port: __import__("uvicorn").run(__import__("web").web(i["func"], *i["config"]), host="0.0.0.0", port=port),
81
+ func=runner,
74
82
  name=i["name"],
75
83
  apt_packages=self.apt,
76
84
  pip_packages=["fastapi[standard]", "pyjwt", "cryptography", "uvicorn", *self.pip],
@@ -85,10 +93,15 @@ class Agent:
85
93
  image = (modal.Image.debian_slim()
86
94
  .pip_install("fastapi[standard]", "pyjwt", "cryptography", *self.pip)
87
95
  .apt_install(*self.apt)
88
- .add_local_dir(self.theme, "/root/public")
96
+ .add_local_dir(self.theme, "/root/theme")
89
97
  .add_local_file(str(cycls_path)+"/web.py", "/root/web.py"))
98
+
90
99
  for item in self.copy:
91
100
  image = image.add_local_file(item, f"/root/{item}") if "." in item else image.add_local_dir(item, f'/root/{item}')
101
+
102
+ for item in self.copy_public:
103
+ image = image.add_local_file(item, f"/root/public/{item}") if "." in item else image.add_local_dir(item, f'/root/public/{item}')
104
+
92
105
  self.app = modal.App("development", image=image)
93
106
 
94
107
  if not self.registered_functions:
@@ -119,8 +119,8 @@ def web(func, public_path="", prod=False, org=None, api_token=None, header="", i
119
119
  pk_test="pk_test_c2VsZWN0LXNsb3RoLTU4LmNsZXJrLmFjY291bnRzLmRldiQ"
120
120
  )
121
121
 
122
- if Path("a").is_dir():
123
- app.mount("/a", StaticFiles(directory="a", html=True))
122
+ if Path("public").is_dir():
123
+ app.mount("/public", StaticFiles(directory="public", html=True))
124
124
  app.mount("/", StaticFiles(directory=public_path, html=True))
125
125
 
126
126
  return app
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cycls"
3
- version = "0.0.2.46"
3
+ version = "0.0.2.48"
4
4
 
5
5
  packages = [{ include = "cycls" }]
6
6
  include = ["cycls/theme/**/*"]
File without changes
File without changes