cycls 0.0.2.45__tar.gz → 0.0.2.47__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.45
3
+ Version: 0.0.2.47
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.
@@ -69,8 +69,16 @@ class Agent:
69
69
  copy.update({i:i for i in self.copy})
70
70
  copy.update({i:f"a/{i}" for i in self.copy_public})
71
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)
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],
@@ -379,4 +379,4 @@ File type: ${ot.mime||"unknown"}`});return{role:wt,content:Ve}}),Re=new AbortCon
379
379
  File URL: ${ot.url}
380
380
  File type: ${ot.mime||"unknown"}`});return{role:wt,content:Ve}}),Re=new AbortController;U.current=Re;let Tt=!1;const nt=setTimeout(()=>{U.current&&(Tt=!0,U.current.abort())},12e4);try{const st={"Content-Type":"application/json"};if(n&&(Z!=null&&Z.getToken))try{const rt=await Z.getToken({template:"template"});if(rt&&(st.Authorization=`Bearer ${rt}`),ee!=null&&ee.setActive&&a)try{await ee.setActive({organization:a})}catch{}}catch{}const Ye=await fetch("/chat/completions",{method:"POST",headers:st,body:JSON.stringify({messages:qe,stream:!0}),signal:Re.signal});if(clearTimeout(nt),!Ye.ok){let rt="server",Ke=`Server returned ${Ye.status}`;if(Ye.status===429){rt="rate_limit";const Ve=Ye.headers.get("Retry-After");Ke=Ve?`Too many requests. Please try again in ${Ve} seconds.`:"Too many requests. Please wait a moment and try again."}else Ye.status>=500?Ke="Server error. Please try again later.":(Ye.status===401||Ye.status===403)&&(Ke="Authentication error. Please refresh and try again.");throw{type:rt,status:Ye.status,message:Ke}}await fm(Ye,rt=>{const Ke=hm(rt);o(Ve=>{const ot=[...Ve];return ot[X].content=Ke,ot})},{signal:Re.signal}),ae&&o(rt=>{const Ke=[...rt];return mn.updateChat(ae,Ke),te(mn.getAllChats()),Ke}),p(!1),D(null),f(!0)}catch(st){clearTimeout(nt);let Ye={type:"server",message:"An unexpected error occurred",status:null};if(st.name==="AbortError")if(Tt)Ye={type:"timeout",message:"Request timed out. The server took too long to respond."};else{console.log("Retry stopped by user"),o(wt=>{const rt=[...wt];return rt[X].content+=`
381
381
 
382
- *[Generation stopped]*`,ae&&(mn.updateChat(ae,rt),te(mn.getAllChats())),rt}),p(!1),D(null),f(!0);return}else st instanceof TypeError&&st.message.includes("fetch")?Ye={type:"network",message:"Network error. Please check your connection and try again."}:st.type&&(Ye=st);console.error("Retry error:",st),o(wt=>{const rt=[...wt];return rt[X].error=Ye,rt}),p(!1),D(null),f(!0)}}},[l,n,a,Z==null?void 0:Z.getToken,ee==null?void 0:ee.setActive,ae]),x=l.length===0;return G.jsxs("div",{className:"min-h-screen",children:[G.jsx(PB,{isOpen:j,onClose:()=>B(!1),chats:Q,activeChat:ae,onSelectChat:$,onNewChat:me,onDeleteChat:fe}),G.jsx("button",{onClick:()=>B(!j),className:"fixed top-4 left-4 z-30 p-2 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors shadow-sm","aria-label":"Toggle chat history",children:G.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[G.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),G.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),G.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),G.jsxs("div",{className:"mx-auto max-w-3xl min-h-screen px-4 pb-[200px] md:pb-[180px]",children:[b&&G.jsx(MB,{fileName:b.fileName,progress:b.progress}),G.jsx("div",{className:"prose m-2 mx-auto max-w-3xl p-2 prose-pre:p-0",children:G.jsx(mm,{markdown:e,onSend:pe})}),!x&&G.jsx(G.Fragment,{children:G.jsxs("div",{className:`transition-opacity duration-500 ${v?"opacity-100":"opacity-0"}`,children:[G.jsx(DB,{messages:l,onSend:pe,onRegenerate:Ee,onRetry:He,retryingIndex:C,isGenerating:h}),G.jsx("div",{ref:J})]})}),x&&!v&&t&&t.trim()!==""&&G.jsx("div",{className:"mx-auto max-w-3xl prose prose-sm prose-pre:p-0",children:G.jsx(mm,{markdown:t,onSend:pe})}),G.jsx(RB,{onSend:pe,isLoading:h,onStop:ue})]})]})},A6=({meta:e})=>{const t=!!e.prod,n=!!e.auth,a=String(e.header??""),s=String(e.intro??""),l=String(e.title??"AI Agent"),o=t?e.pk_live:e.pk_test,d=e.org||void 0,f=typeof window<"u"?`${window.location.origin}`:"/",h=t?{isSatellite:!0,domain:"cycls.ai",signInUrl:"https://accounts.cycls.com/sign-in",fallbackRedirectUrl:f,forceRedirectUrl:f}:{fallbackRedirectUrl:f,forceRedirectUrl:f};return n?G.jsxs(N7,{publishableKey:o,...h,children:[G.jsxs(wL,{children:[G.jsx("div",{className:"fixed right-2 top-2 z-50",children:G.jsx(cB,{})}),G.jsx(x6,{HEADER:a,INTRO:s,AUTH:n,ORG:d})]}),G.jsx(kL,{children:G.jsx(CL,{redirectUrl:f})})]}):G.jsx(x6,{HEADER:a,INTRO:s,AUTH:n,ORG:d,TITLE:l})},UB=document.getElementById("root"),zB=zv.createRoot(UB);zB.render(G.jsx(BB,{}));
382
+ *[Generation stopped]*`,ae&&(mn.updateChat(ae,rt),te(mn.getAllChats())),rt}),p(!1),D(null),f(!0);return}else st instanceof TypeError&&st.message.includes("fetch")?Ye={type:"network",message:"Network error. Please check your connection and try again."}:st.type&&(Ye=st);console.error("Retry error:",st),o(wt=>{const rt=[...wt];return rt[X].error=Ye,rt}),p(!1),D(null),f(!0)}}},[l,n,a,Z==null?void 0:Z.getToken,ee==null?void 0:ee.setActive,ae]),x=l.length===0;return G.jsxs("div",{className:"min-h-screen",children:[G.jsx(PB,{isOpen:j,onClose:()=>B(!1),chats:Q,activeChat:ae,onSelectChat:$,onNewChat:me,onDeleteChat:fe}),G.jsx("button",{onClick:()=>B(!j),className:"fixed top-4 left-4 z-30 p-2 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors shadow-sm","aria-label":"Toggle chat history",children:G.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[G.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),G.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),G.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),G.jsxs("div",{className:"mx-auto max-w-3xl min-h-screen px-4 pb-[200px] md:pb-[180px]",children:[b&&G.jsx(MB,{fileName:b.fileName,progress:b.progress}),G.jsx("div",{className:"prose m-2 mx-auto max-w-3xl p-2 prose-pre:p-0",children:G.jsx(mm,{markdown:e,onSend:pe})}),!x&&G.jsx(G.Fragment,{children:G.jsxs("div",{className:`transition-opacity duration-500 ${v?"opacity-100":"opacity-0"}`,children:[G.jsx(DB,{messages:l,onSend:pe,onRegenerate:Ee,onRetry:He,retryingIndex:C,isGenerating:h}),G.jsx("div",{ref:J})]})}),x&&!v&&t&&t.trim()!==""&&G.jsx("div",{className:"mx-auto max-w-3xl prose prose-sm prose-pre:p-0",children:G.jsx(mm,{markdown:t,onSend:pe})}),G.jsx(RB,{onSend:pe,isLoading:h,onStop:ue})]})]})},A6=({meta:e})=>{const t=!!e.prod,n=!!e.auth,a=String(e.header??""),s=String(e.intro??""),l=String(e.title??"AI Agent"),o=t?e.pk_live:e.pk_test,d=e.org||void 0,f=typeof window<"u"?`${window.location.origin}`:"/",h=t?{isSatellite:!1,domain:"cycls.ai",signInUrl:"https://accounts.cycls.ai/sign-in",fallbackRedirectUrl:f,forceRedirectUrl:f}:{fallbackRedirectUrl:f,forceRedirectUrl:f};return n?G.jsxs(N7,{publishableKey:o,...h,children:[G.jsxs(wL,{children:[G.jsx("div",{className:"fixed right-2 top-2 z-50",children:G.jsx(cB,{})}),G.jsx(x6,{HEADER:a,INTRO:s,AUTH:n,ORG:d})]}),G.jsx(kL,{children:G.jsx(CL,{redirectUrl:f})})]}):G.jsx(x6,{HEADER:a,INTRO:s,AUTH:n,ORG:d,TITLE:l})},UB=document.getElementById("root"),zB=zv.createRoot(UB);zB.render(G.jsx(BB,{}));
@@ -13,7 +13,7 @@
13
13
  rel="stylesheet"
14
14
  href="https://esm.sh/katex@0.16.8/dist/katex.min.css"
15
15
  />
16
- <script type="module" crossorigin src="/assets/index-TWKaaEBt.js"></script>
16
+ <script type="module" crossorigin src="/assets/index-CJ_4y8Hq.js"></script>
17
17
  </head>
18
18
  <body style="overflow-x: hidden">
19
19
  <div id="root"></div>
@@ -115,7 +115,7 @@ def web(func, public_path="", prod=False, org=None, api_token=None, header="", i
115
115
  prod=prod,
116
116
  auth=auth,
117
117
  org=org,
118
- pk_live="pk_live_Y2xlcmsuY3ljbHMuY29tJA",
118
+ pk_live="pk_live_Y2xlcmsuY3ljbHMuYWkk",
119
119
  pk_test="pk_test_c2VsZWN0LXNsb3RoLTU4LmNsZXJrLmFjY291bnRzLmRldiQ"
120
120
  )
121
121
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cycls"
3
- version = "0.0.2.45"
3
+ version = "0.0.2.47"
4
4
 
5
5
  packages = [{ include = "cycls" }]
6
6
  include = ["cycls/theme/**/*"]
File without changes
File without changes