Merge pull request #33 from waterflier/main

Complete basic ai kernel frame codes
This commit is contained in:
fiatrete
2023-08-23 09:31:14 +08:00
committed by GitHub
27 changed files with 1138 additions and 28 deletions
+8 -1
View File
@@ -13,7 +13,14 @@ This project is still in its very early stages, and there may be significant cha
## **Updates**
I've just refactored Jarvis's code, leveraging the `functions` support from ChatGPT. As a result, Jarvis now responds much faster and has more stable selection for the functional module. I encourage you to checkout the updated code to experience these improvements firsthand.
### 1. Adding Knowledge Base Infrastructure
We're currently working on implementing the infrastructure for the Knowledge Base, aiming to enhance AI agent's access to Personal Data stored on Personal Servers. Leveraging these new features, we want to empower everyone to build their own personal homepage in the AI era using OpenDAN.
### 2. Development Based on SourceDAO Contract
We are in the process of developing the OpenDAN's DAO page, which is based on the SourceDAO contract. The future of OpenDAN should be determined by the community.
### 3. Welcoming waterflier as a Core Contributor
We're excited to officially invite waterflier to join as a core contributor to our community. We recognize and appreciate his innovative ideas and deep insights in the realm of Personal AI OS. Waterflier will be spearheading the development of the MVP version. As a key contributor to the CYFS CoreDev Team, he brings extensive experience in the domain of Personal Servers.
## **Intro video - What is OpenDAN?**
Click the image below for a demo:
+76
View File
@@ -0,0 +1,76 @@
<mxfile host="Electron" modified="2023-08-20T20:43:16.356Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.8 Chrome/114.0.5735.289 Electron/25.5.0 Safari/537.36" etag="kwtbDIrkPfCysRMj32zz" version="21.6.8" type="device">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="914" dy="806" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="ia-fclrWNqMUroYMcw65-37" value="" style="rounded=0;whiteSpace=wrap;html=1;dashed=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="340" y="345" width="290" height="105" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-36" value="" style="rounded=0;whiteSpace=wrap;html=1;dashed=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="90" y="345" width="250" height="105" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-1" value="local compute &lt;br&gt;node" style="shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;fillColor=#6d8764;fontColor=#ffffff;strokeColor=#3A5431;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="90" y="380" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="ia-fclrWNqMUroYMcw65-2" target="ia-fclrWNqMUroYMcw65-28">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-2" value="my device&lt;br&gt;&amp;nbsp;compute &lt;br&gt;node" style="shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;fillColor=#6d8764;fontColor=#ffffff;strokeColor=#3A5431;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="210" y="380" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-3" value="service compute&lt;br&gt;node" style="shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;fillColor=#e3c800;fontColor=#000000;strokeColor=#B09500;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="370" y="380" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-4" value="untruest compute&lt;br&gt;node" style="shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;fillColor=#fa6800;fontColor=#000000;strokeColor=#C73500;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="490" y="380" width="130" height="50" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-18" value="TaskParams:json" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#60a917;fontColor=#ffffff;strokeColor=#2D7600;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="280" y="50" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-19" value="padding input:buffers" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#0050ef;fontColor=#ffffff;strokeColor=#001DBC;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="280" y="130" width="120" height="70" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-22" value="Refer:Name Data" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#6a00ff;fontColor=#ffffff;strokeColor=#3700CC;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="280" y="90" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-23" value="aios_kernel&lt;br&gt;(scheduler)" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="280" y="250" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-24" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="ia-fclrWNqMUroYMcw65-19" target="ia-fclrWNqMUroYMcw65-23">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="430" y="240" as="sourcePoint" />
<mxPoint x="480" y="190" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-25" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="ia-fclrWNqMUroYMcw65-23" target="ia-fclrWNqMUroYMcw65-2">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="420" y="350" as="sourcePoint" />
<mxPoint x="470" y="300" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-26" value="Owne Nodes" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="90" y="345" width="100" height="30" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-27" value="Rental Nodes" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="505" y="345" width="100" height="30" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-28" value="ResultParams:json" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#60a917;fontColor=#ffffff;strokeColor=#2D7600;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="280" y="516" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-29" value="padding result:buffers" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#0050ef;fontColor=#ffffff;strokeColor=#001DBC;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="280" y="596" width="120" height="70" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-30" value="Refer:Name Data" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#6a00ff;fontColor=#ffffff;strokeColor=#3700CC;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="280" y="556" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-34" value="有一些任务是可以分割的,这个既可以上层处理分割、合并。也可以由aios_kernel处理" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="450" y="80" width="170" height="70" as="geometry" />
</mxCell>
<mxCell id="ia-fclrWNqMUroYMcw65-35" value="调度器的核心是结合已知compute_node的状态,与Refer数据的距离,计算的成本,运行的速度等多种要素,选择一个compute_node完成计算任务。也可包含一定的迭代重试逻辑" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="450" y="240" width="170" height="70" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
+2 -2
View File
@@ -1,4 +1,4 @@
<mxfile host="Electron" modified="2023-08-16T01:50:21.024Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.8 Chrome/114.0.5735.289 Electron/25.5.0 Safari/537.36" etag="Fe0e1JctHMBM0bOF_cEU" version="21.6.8" type="device" pages="2">
<mxfile host="Electron" modified="2023-08-17T05:39:49.397Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.8 Chrome/114.0.5735.289 Electron/25.5.0 Safari/537.36" etag="4Rsz4qjJ1LkgbdKfJbeI" version="21.6.8" type="device" pages="2">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="848" dy="810" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
@@ -241,7 +241,7 @@
</mxGraphModel>
</diagram>
<diagram id="TOYXUel0h6b4Yd0VOcvu" name="Page-2">
<mxGraphModel dx="848" dy="810" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<mxGraphModel dx="848" dy="806" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
+368
View File
@@ -0,0 +1,368 @@
<mxfile host="Electron" modified="2023-08-21T08:17:59.615Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.8 Chrome/114.0.5735.289 Electron/25.5.0 Safari/537.36" etag="B6guG2NTWSku4GvC0ygf" version="21.6.8" type="device" pages="3">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="981" dy="563" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-3" value="(chat) message" style="rounded=1;whiteSpace=wrap;html=1;fontSize=12;glass=0;strokeWidth=1;shadow=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="159" y="330" width="90" height="40" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-0" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="WIyWlLk6GJQsqaUBKTNV-3" target="RbYReh6FQah4Kl5oFyjJ-1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="279" y="390" as="sourcePoint" />
<mxPoint x="309" y="350" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-8" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="RbYReh6FQah4Kl5oFyjJ-1" target="RbYReh6FQah4Kl5oFyjJ-2">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-14" value="message" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="RbYReh6FQah4Kl5oFyjJ-1" target="RbYReh6FQah4Kl5oFyjJ-13">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-1" value="Workflow" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#6d8764;fontColor=#ffffff;strokeColor=#3A5431;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="304" y="320" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-2" value="Functions" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="514" y="320" width="130" height="60" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="RbYReh6FQah4Kl5oFyjJ-3" target="RbYReh6FQah4Kl5oFyjJ-4">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-3" value="(phicyal / virtual)&lt;br&gt;environment" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="304" y="120" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-7" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="RbYReh6FQah4Kl5oFyjJ-4" target="RbYReh6FQah4Kl5oFyjJ-1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-4" value="(event) message" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="304" y="240" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-9" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=120;entryDy=50;entryPerimeter=0;dashed=1;dashPattern=8 8;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="RbYReh6FQah4Kl5oFyjJ-2" target="RbYReh6FQah4Kl5oFyjJ-3">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="564" y="290" as="sourcePoint" />
<mxPoint x="614" y="240" as="targetPoint" />
<Array as="points">
<mxPoint x="579" y="170" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-10" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.16;entryY=0.55;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="RbYReh6FQah4Kl5oFyjJ-2" target="RbYReh6FQah4Kl5oFyjJ-11">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="684" y="320" as="sourcePoint" />
<mxPoint x="714" y="350" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-11" value="Exist Service" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="689" y="300" width="130" height="90" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-13" value="sub / other workflow" style="whiteSpace=wrap;html=1;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="304" y="480" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-15" value="response message" style="endArrow=classic;html=1;rounded=0;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="RbYReh6FQah4Kl5oFyjJ-1" target="RbYReh6FQah4Kl5oFyjJ-17">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="129" y="480" as="sourcePoint" />
<mxPoint x="99" y="420" as="targetPoint" />
<Array as="points">
<mxPoint x="334" y="420" />
<mxPoint x="49" y="420" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-18" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="RbYReh6FQah4Kl5oFyjJ-17" target="WIyWlLk6GJQsqaUBKTNV-3">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-17" value="Personal" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="9" y="310" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-19" value="" style="shape=xor;whiteSpace=wrap;html=1;rotation=-90;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="309" y="67" width="20" height="20" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-21" value="" style="shape=xor;whiteSpace=wrap;html=1;rotation=-90;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="347" y="67" width="20" height="20" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-22" value="" style="shape=xor;whiteSpace=wrap;html=1;rotation=-90;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="386" y="67" width="20" height="20" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-23" value="IoT Devices" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="240" y="67" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-25" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.25;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.122;entryY=0.008;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="RbYReh6FQah4Kl5oFyjJ-19" target="RbYReh6FQah4Kl5oFyjJ-3">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="240" y="170" as="sourcePoint" />
<mxPoint x="290" y="120" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-26" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.25;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0;entryY=0;entryDx=50;entryDy=0;entryPerimeter=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="RbYReh6FQah4Kl5oFyjJ-21">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="443" y="120" as="sourcePoint" />
<mxPoint x="357" y="120.00000000000011" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="RbYReh6FQah4Kl5oFyjJ-27" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.25;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.766;entryY=0.02;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="RbYReh6FQah4Kl5oFyjJ-22" target="RbYReh6FQah4Kl5oFyjJ-3">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="430" y="140" as="sourcePoint" />
<mxPoint x="480" y="90" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="HvRWRVSjofeyYJQyU3aa-0" value="Sub workflow is not visiable for others&lt;br&gt;&lt;br&gt;Sub worflow can share roles&amp;nbsp;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="160" y="480" width="140" height="70" as="geometry" />
</mxCell>
<mxCell id="HvRWRVSjofeyYJQyU3aa-1" value="Chat with AI Agent is like chat with a workflow which have only one agent and no rules" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="70" y="150" width="150" height="80" as="geometry" />
</mxCell>
<mxCell id="ed6Jjq-fMpksm2tlv9Oi-0" value="inner&amp;nbsp;&lt;br&gt;environment" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;size=10;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="386" y="360" width="84" height="40" as="geometry" />
</mxCell>
<mxCell id="ed6Jjq-fMpksm2tlv9Oi-1" value="Environment could shared with workflows" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="440" y="120" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="ed6Jjq-fMpksm2tlv9Oi-2" value="Inner environment&amp;nbsp; could be used as Context(FileSystem)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="413" y="410" width="110" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="kWxfmPxtNxOAf0a73TCG" name="Page-2">
<mxGraphModel dx="1421" dy="816" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="VGzDL9xesOOnN_l_G2Ij-1" value="&lt;h1&gt;Workflow rules&lt;/h1&gt;&lt;p&gt;workflow rules(prompt)&lt;/p&gt;" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;" vertex="1" parent="1">
<mxGeometry x="70" y="800" width="190" height="120" as="geometry" />
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-2" value="&lt;h1&gt;Workflow roles&lt;/h1&gt;&lt;p&gt;AI Agent groups&lt;/p&gt;&lt;p&gt;Project Manager : Alex&lt;/p&gt;&lt;p&gt;Programer : Bobl&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;" vertex="1" parent="1">
<mxGeometry x="320" y="790" width="190" height="120" as="geometry" />
</mxCell>
<mxCell id="41KxsEdFswCCPQnavNoU-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="VGzDL9xesOOnN_l_G2Ij-3" target="VGzDL9xesOOnN_l_G2Ij-4">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="41KxsEdFswCCPQnavNoU-15" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="VGzDL9xesOOnN_l_G2Ij-3" target="VGzDL9xesOOnN_l_G2Ij-7">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-3" value="Message" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="340" y="170" width="100" height="40" as="geometry" />
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-4" value="inner filter&amp;nbsp;" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;" vertex="1" parent="1">
<mxGeometry x="150" y="260" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-5" value="roleA" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="80" y="350" width="110" height="60" as="geometry" />
</mxCell>
<mxCell id="41KxsEdFswCCPQnavNoU-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="VGzDL9xesOOnN_l_G2Ij-6" target="VGzDL9xesOOnN_l_G2Ij-8">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-6" value="roleB" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="240" y="350" width="110" height="60" as="geometry" />
</mxCell>
<mxCell id="41KxsEdFswCCPQnavNoU-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="VGzDL9xesOOnN_l_G2Ij-7">
<mxGeometry relative="1" as="geometry">
<mxPoint x="570.0344827586209" y="350" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-7" value="Workflow rules" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="520" y="260" width="100" height="50" as="geometry" />
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-8" value="Final Result of Message" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="340" y="590" width="100" height="50" as="geometry" />
</mxCell>
<mxCell id="41KxsEdFswCCPQnavNoU-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="VGzDL9xesOOnN_l_G2Ij-9" target="VGzDL9xesOOnN_l_G2Ij-8">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-9" value="Result Merge" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="521" y="530" width="100" height="40" as="geometry" />
</mxCell>
<mxCell id="41KxsEdFswCCPQnavNoU-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="VGzDL9xesOOnN_l_G2Ij-10" target="VGzDL9xesOOnN_l_G2Ij-9">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-10" value="roleC" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="435" y="350" width="110" height="60" as="geometry" />
</mxCell>
<mxCell id="41KxsEdFswCCPQnavNoU-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="VGzDL9xesOOnN_l_G2Ij-11" target="41KxsEdFswCCPQnavNoU-7">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-11" value="roleD" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="595" y="350" width="110" height="60" as="geometry" />
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-12" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="VGzDL9xesOOnN_l_G2Ij-4" target="VGzDL9xesOOnN_l_G2Ij-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="160" y="510" as="sourcePoint" />
<mxPoint x="210" y="460" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="VGzDL9xesOOnN_l_G2Ij-13" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="VGzDL9xesOOnN_l_G2Ij-4" target="VGzDL9xesOOnN_l_G2Ij-6">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="210" y="510" as="sourcePoint" />
<mxPoint x="260" y="460" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="41KxsEdFswCCPQnavNoU-1" value="" style="shape=cross;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="556" y="364" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="41KxsEdFswCCPQnavNoU-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="41KxsEdFswCCPQnavNoU-7" target="VGzDL9xesOOnN_l_G2Ij-9">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="41KxsEdFswCCPQnavNoU-7" value="call function or&amp;nbsp;&lt;br&gt;send message" style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;" vertex="1" parent="1">
<mxGeometry x="592.5" y="460" width="115" height="30" as="geometry" />
</mxCell>
<mxCell id="q_eHDVuD3DBh6_VEKgap-2" value="message process by filter,select one role do LLM and get RESULT of input" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="90" y="190" width="165" height="30" as="geometry" />
</mxCell>
<mxCell id="q_eHDVuD3DBh6_VEKgap-3" value="message process by rules,select mutil role do LLM and merge RESULT of input" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="510" y="180" width="165" height="30" as="geometry" />
</mxCell>
<mxCell id="q_eHDVuD3DBh6_VEKgap-5" value="如果一个工作流有3个role参与,每个人都需要调用函数并分析结果,那么要进行至少6次推理" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="483" y="640" width="174" height="40" as="geometry" />
</mxCell>
<mxCell id="q_eHDVuD3DBh6_VEKgap-6" value="这里是基于规则的合并,给另一个Role合并是多输入Agent流程" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="635" y="570" width="160" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="7NYJTgo0U9cdVshLy85U" name="Page-3">
<mxGraphModel dx="1177" dy="676" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="zJVYyOSlNiCVBlA5jEf0-2" value="Agent Sessions&lt;br&gt;Data" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="110" y="533" width="80" height="70" as="geometry" />
</mxCell>
<mxCell id="8StUH8aFnwlRlHm0zShF-2" value="Small LLM, Train With Personal Data" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" vertex="1" parent="1">
<mxGeometry x="270" y="258" width="140" height="50" as="geometry" />
</mxCell>
<mxCell id="awKuOLItvF_EOGf5wS2x-4" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="20" y="78" width="160" height="360" as="geometry" />
</mxCell>
<mxCell id="S5MjekdSblNa5itYb4Ee-13" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="8StUH8aFnwlRlHm0zShF-1" target="SPnvrlBiOLhgEaWxmdK3-4">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="8StUH8aFnwlRlHm0zShF-1" value="LLM&lt;br&gt;(Common Sence)" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" vertex="1" parent="1">
<mxGeometry x="250" y="218" width="140" height="50" as="geometry" />
</mxCell>
<mxCell id="8StUH8aFnwlRlHm0zShF-3" value="ControlNet&lt;br&gt;base on Agent Memory" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" vertex="1" parent="1">
<mxGeometry x="250" y="108" width="140" height="50" as="geometry" />
</mxCell>
<mxCell id="8StUH8aFnwlRlHm0zShF-4" value="Agent人格助记词" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;size=0.25;" vertex="1" parent="1">
<mxGeometry x="40" y="108" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="8StUH8aFnwlRlHm0zShF-5" value="Role助记词" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;size=0.25;" vertex="1" parent="1">
<mxGeometry x="40" y="168" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="8StUH8aFnwlRlHm0zShF-6" value="Workflow Rules助记词" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;size=0.25;" vertex="1" parent="1">
<mxGeometry x="40" y="235.5" width="120" height="52.5" as="geometry" />
</mxCell>
<mxCell id="8StUH8aFnwlRlHm0zShF-7" value="访问Knowlege构造助记词" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;size=0.25;" vertex="1" parent="1">
<mxGeometry x="40" y="378" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="Tz-ThZOieDqqDBRXvXnh-1" value="Invoke the function and wait for the necessary response." style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="600" y="33" width="110" height="70" as="geometry" />
</mxCell>
<mxCell id="awKuOLItvF_EOGf5wS2x-2" value="Send Message and wait for the necessary response." style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;glass=0;strokeWidth=1;shadow=0;" vertex="1" parent="1">
<mxGeometry x="610" y="153" width="90" height="70" as="geometry" />
</mxCell>
<mxCell id="awKuOLItvF_EOGf5wS2x-5" value="Input Prompts" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="60" y="78" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="awKuOLItvF_EOGf5wS2x-7" value="Responce Prompts" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="740" y="103" width="80" height="40" as="geometry" />
</mxCell>
<mxCell id="S5MjekdSblNa5itYb4Ee-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="awKuOLItvF_EOGf5wS2x-8" target="awKuOLItvF_EOGf5wS2x-9">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="awKuOLItvF_EOGf5wS2x-8" value="LLM Competion" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" vertex="1" parent="1">
<mxGeometry x="720" y="226.75" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="SPnvrlBiOLhgEaWxmdK3-9" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="awKuOLItvF_EOGf5wS2x-9" target="SPnvrlBiOLhgEaWxmdK3-1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="awKuOLItvF_EOGf5wS2x-9" value="Final Result&lt;br&gt;Of Message&lt;br&gt;(can be None)" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="450" y="363" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="SPnvrlBiOLhgEaWxmdK3-1" value="Storage Result in agent session and workflow session" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="450" y="483" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="SPnvrlBiOLhgEaWxmdK3-2" value="可用Function助记词" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;size=0.25;" vertex="1" parent="1">
<mxGeometry x="40" y="308" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="SPnvrlBiOLhgEaWxmdK3-7" value="Yes" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="SPnvrlBiOLhgEaWxmdK3-4" target="SPnvrlBiOLhgEaWxmdK3-6">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="SPnvrlBiOLhgEaWxmdK3-8" value="No" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="SPnvrlBiOLhgEaWxmdK3-4" target="awKuOLItvF_EOGf5wS2x-9">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="SPnvrlBiOLhgEaWxmdK3-4" value="推理结果&lt;br&gt;需要进一步处理?" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="440" y="203" width="140" height="80" as="geometry" />
</mxCell>
<mxCell id="SPnvrlBiOLhgEaWxmdK3-6" value="Call Funstion or send message?" style="rhombus;whiteSpace=wrap;html=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="440" y="78" width="140" height="80" as="geometry" />
</mxCell>
<mxCell id="S5MjekdSblNa5itYb4Ee-3" value="Call" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="SPnvrlBiOLhgEaWxmdK3-6" target="Tz-ThZOieDqqDBRXvXnh-1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="410" y="113" as="sourcePoint" />
<mxPoint x="460" y="63" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S5MjekdSblNa5itYb4Ee-4" value="Send" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="SPnvrlBiOLhgEaWxmdK3-6" target="awKuOLItvF_EOGf5wS2x-2">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="560" y="193" as="sourcePoint" />
<mxPoint x="610" y="143" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S5MjekdSblNa5itYb4Ee-5" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="awKuOLItvF_EOGf5wS2x-2" target="awKuOLItvF_EOGf5wS2x-7">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="720" y="213" as="sourcePoint" />
<mxPoint x="770" y="163" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S5MjekdSblNa5itYb4Ee-6" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="Tz-ThZOieDqqDBRXvXnh-1" target="awKuOLItvF_EOGf5wS2x-7">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="750" y="93" as="sourcePoint" />
<mxPoint x="800" y="43" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S5MjekdSblNa5itYb4Ee-7" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="awKuOLItvF_EOGf5wS2x-7" target="awKuOLItvF_EOGf5wS2x-8">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="750" y="213" as="sourcePoint" />
<mxPoint x="800" y="163" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S5MjekdSblNa5itYb4Ee-10" value="" style="endArrow=none;dashed=1;html=1;dashPattern=1 3;strokeWidth=2;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="330" y="218" as="sourcePoint" />
<mxPoint x="330" y="158" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S5MjekdSblNa5itYb4Ee-12" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;fillColor=#6d8764;strokeColor=#3A5431;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="200" y="251.75" as="sourcePoint" />
<mxPoint x="240" y="252" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S5MjekdSblNa5itYb4Ee-15" value="Real Time Enviroment Knowlege" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="10" y="533" width="80" height="70" as="geometry" />
</mxCell>
<mxCell id="zJVYyOSlNiCVBlA5jEf0-1" value="Workflow Context Data" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="110" y="473" width="80" height="70" as="geometry" />
</mxCell>
<mxCell id="S5MjekdSblNa5itYb4Ee-14" value="OOD&#39;s KnowlegeBase" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="10" y="473" width="80" height="70" as="geometry" />
</mxCell>
<mxCell id="zJVYyOSlNiCVBlA5jEf0-3" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;fillColor=#647687;strokeColor=#314354;" edge="1" parent="1" target="8StUH8aFnwlRlHm0zShF-7">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="100" y="463" as="sourcePoint" />
<mxPoint x="130" y="433" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="iPE2hx-tEKFiySbPAp22-1" value="&lt;font style=&quot;font-size: 11px;&quot;&gt;可用Function受到人格和Workflow的共同影响&lt;/font&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="190" y="318" width="130" height="30" as="geometry" />
</mxCell>
<mxCell id="iPE2hx-tEKFiySbPAp22-2" value="" style="endArrow=none;dashed=1;html=1;dashPattern=1 3;strokeWidth=2;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="SPnvrlBiOLhgEaWxmdK3-2" target="iPE2hx-tEKFiySbPAp22-1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="230" y="433" as="sourcePoint" />
<mxPoint x="280" y="383" as="targetPoint" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
+3
View File
@@ -0,0 +1,3 @@
TODO:
Embading Pipline
Knowlege Base
+7
View File
@@ -0,0 +1,7 @@
from .environment import environment,environment_event
from .agent import agent_msg,ai_agent,ai_agent_templete
from .compute_kernel import compute_kernel,compute_task
from .compute_node import compute_node,local_compute_node
from .open_ai_node import open_ai_compute_node
from .role import ai_role,ai_role_group
from .workflow import ai_workflow
+88
View File
@@ -0,0 +1,88 @@
from typing import Optional
import logging
logger = logging.getLogger(__name__)
class agent_msg:
def __init__(self) -> None:
self.sender = None
self.target = None
self.body = None
def get_msg_id(self) -> str:
pass
def get_sender(self) -> str:
return self.sender
def get_target(self) -> str:
return self.target
# return workflow_name, role_name, session_id
def parser_target(self,target:str) -> None:
pass
class agent_prompt:
def __init__(self) -> None:
pass
def as_str(self)->str:
pass
def append(self,prompt) -> None:
pass
# chat session store the chat history between owner and agent
# chat session might be large, so can read / write at stream mode.
class ai_chat_session:
def __init__(self) -> None:
pass
def get_owner_id(self) -> str:
pass
def append_post(self,msg:agent_msg) -> None:
"""append msg to session, msg is post from session (owner => msg.target)"""
pass
def append_recv(self,msg:agent_msg) -> None:
"""append msg to session, msg is recv from msg'sender (msg.sender => owner)"""
pass
def attach_event_handler(self,handler) -> None:
"""chat session changed event handler"""
pass
#TODO : add iterator interface for read chat history
class ai_agent_templete:
def __init__(self) -> None:
pass
class ai_agent:
def __init__(self) -> None:
self.chat_sessions = None
self.llm_model_name = None
self.max_token_size = 0
self.instance_id = None
self.template_id = None
def get_id(self) -> str:
return self.instance_id
def get_template_id(self) -> str:
return self.template_id
def get_chat_session_for_msg(self,msg:agent_msg) -> ai_chat_session:
pass
def get_chat_session(self,sender:str,session_id:str) -> ai_chat_session:
pass
def get_llm_model_name(self) -> str:
return self.llm_model_name
def get_max_token_size(self) -> int:
return self.max_token_size
+32
View File
@@ -0,0 +1,32 @@
class ai_function:
def __init__(self) -> None:
self.intro : str = None
def load_from_config(self,config:dict) -> bool:
pass
def is_local(self) -> bool:
pass
def is_in_zone(self) -> bool:
pass
def is_readyonly(self) -> bool:
pass
def get_intro(self) -> str:
return self.intro
async def execute(self):
pass
# call chain is a combination of ai_function,group of ai_function.
class call_chain:
def __init__(self) -> None:
pass
def load_from_config(self,config:dict) -> bool:
pass
async def execute(self):
pass
+14
View File
@@ -0,0 +1,14 @@
# aiso shell like bash of linux
from .workflow import ai_workflow
class aios_shell:
def __init__(self,username:str) -> None:
pass
async def send_msg(self,msg:str,target_workflow:str) -> str:
pass
async def install_workflow(self,workflow_id:ai_workflow) -> None:
pass
+77
View File
@@ -0,0 +1,77 @@
from abc import ABC, abstractmethod
from typing import Optional
import logging
import asyncio
from .agent import agent_prompt
from .compute_node import compute_node
logger = logging.getLogger(__name__)
# How to dispatch different computing tasks (some tasks may contain a large amount of state for correct execution)
# to suitable computing nodes, achieving a balance of speed, cost, and power consumption,
# is the CORE GOAL of the entire computing task schedule system (aios_kernel).
class compute_task(ABC):
@abstractmethod
def display(self) -> str:
pass
class compute_kernel:
_instance = None
def __new__(cls):
if cls._instance is None:
cls._instance = super(compute_kernel, cls).__new__(cls)
return cls._instance
def __init__(self) -> None:
self.task_queue = []
self.is_start = False
pass
def run(self,task:compute_task) -> None:
# check there is compute node can support this task
if self.is_task_support(task) is False:
logger.error(f"task {task.display()} is not support by any compute node")
return
# add task to working_queue
self.task_queue.append(task)
def start(self):
if self.is_start is True:
logger.warn("compute_kernel is already start")
return
self.is_start = True
async def _run_task_loop():
while True:
task = self.task_queue.pop(0)
c_node:compute_node= await self._schedule(task)
c_node.push_task(task)
asyncio.create_task(_run_task_loop())
async def _schedule(self,task) -> compute_node:
pass
def add_compute_node(self,node:compute_node):
pass
def disable_compute_node(self,):
pass
def is_task_support(self,task:compute_task) -> bool:
pass
# friendly interface for use:
def llm_completion(self,prompt:agent_prompt,mode_name:Optional[str] = None,max_token:int = 0) -> compute_task:
# craete a llm_work_task ,push on queue's end
# then task_schedule would run this task.(might schedule some work_task to another host)
pass
async def do_llm_completion(self,prompt:agent_prompt,mode_name:Optional[str] = None,max_token:int = 0) -> str:
pass
+48
View File
@@ -0,0 +1,48 @@
from abc import ABC, abstractmethod
from .compute_kernel import compute_task
class compute_node(ABC):
@abstractmethod
async def push_task(self,task:compute_task,proiority:int = 0):
pass
async def remove_task(self,task_id:str):
pass
@abstractmethod
def get_task_state(self,task_id:str):
pass
@abstractmethod
def display(self) -> str:
pass
@abstractmethod
def get_capacity(self):
pass
@abstractmethod
def is_support(self,task_type:str) -> bool:
pass
@abstractmethod
def is_local(self) -> bool:
pass
@abstractmethod
def is_trusted(self) -> bool:
return True
def get_fee_type(self) -> str:
return "free"
class local_compute_node(compute_node):
def display(self) -> str:
return super().display()
def is_local(self) -> bool:
return True
+23
View File
@@ -0,0 +1,23 @@
# basic environment class
# we have some built-in environment: Calender(include timer),Home(connect to IoT device in your home), ,KnwoledgeBase,FileSystem,
from abc import ABC, abstractmethod
from typing import Callable
from .agent import agent_msg
class environment_event(ABC):
@abstractmethod
def display(self) -> str:
pass
class environment:
def __init__(self) -> None:
pass
def get_id(self) -> str:
pass
def attach_event_handler(self,event_id:str,handler:Callable) -> None:
pass
+8
View File
@@ -0,0 +1,8 @@
from .compute_node import compute_node
class open_ai_compute_node(compute_node):
def display(self) -> str:
return super().display()
+25
View File
@@ -0,0 +1,25 @@
from .agent import ai_agent
class ai_role:
def __init__(self) -> None:
self.agent_instance_id : str = None
self.role_name : str = None
self.agent : ai_agent = None
self.introduce : str = None
def load_from_config(self,config:dict) -> bool:
pass
def get_intro(self) -> str:
return self.introduce
def get_name(self) -> str:
return self.role_name
class ai_role_group:
def __init__(self) -> None:
self.roles : dict[str,str]= None
pass
+206
View File
@@ -0,0 +1,206 @@
import logging
import asyncio
from typing import Optional,Tuple
from .environment import environment,environment_event
from .agent import agent_prompt,agent_msg,ai_chat_session
from .role import ai_role
from .ai_function import call_chain
from .compute_kernel import compute_kernel
logger = logging.getLogger(__name__)
class ai_message_filter:
def __init__(self) -> None:
pass
def select(self,msg:agent_msg) -> ai_role:
pass
class ai_workflow:
def __init__(self) -> None:
self.rule_prompt : agent_prompt = None
self.workflow_config = None
self.role_group = None
self.input_filter : ai_message_filter= None
self.msg_queue = []
self.connected_environment = {}
def load_from_disk(self,config_path:str,context_dir_path) -> int:
pass
#workflow is asynchronous.
# When processing one message, it can process another message at the same time.
# chatsession is synchronous, it has to wait for the previous message to finish processing before it can process the next message.
# Therefore, post a message needs to specify the session_id explicitly, if not specified it will be automatically created by workflow.
def post_msg(self,msg:agent_msg) -> None:
self.msg_queue.append(msg)
return
async def send_msg(self,msg:agent_msg) -> str:
pass
async def run(self):
# TODO add tracking design of msg processing
while True:
the_msg = await self._pop_msg()
chatsession:ai_chat_session = self._get_chat_session_for_msg(the_msg)
if chatsession is None:
logger.error(f"get_chat_session_for_msg return None for :{the_msg}")
continue
chatsession.append_recv(the_msg)
async def _process_msg(msg:agent_msg,the_role) -> None:
# prompt generat progress is most important part of workflow(app) develope
prompt = agent_prompt()
prompt.append(the_role.get_prompt())
prompt.append(self.get_workflow_rule_prompt())
prompt.append(self._get_function_prompt(the_role.get_name()))
prompt.append(self._get_knowlege_prompt(the_role.get_name()))
prompt.append(await self._get_prompt_from_session(chatsession,the_role.get_name())) # chat context
result = await compute_kernel().do_llm_completion(prompt,the_role.agent.get_llm_model_name(),the_role.agent.get_max_token_size())
final_result = result
result_type : str = self._get_llm_result_type(result)
is_ignore = False
match result_type:
case "function":
callchain:call_chain = self._parse_function_call_chain(result)
resp = await callchain.exec()
if callchain.have_result():
# generator proc resp prompt with WAITING state
proc_resp_prompt:agent_prompt = self._get_resp_prompt(resp,msg,the_role,prompt,chatsession)
final_result = await compute_kernel().do_llm_completion(proc_resp_prompt,the_role.agent.get_llm_model_name(),the_role.agent.get_max_token_size())
return final_result
case "send_message":
# send message to other / sub workflow
next_msg:agent_msg = self._parse_to_msg(result)
if next_msg is not None:
# TODO: Next Target can be another role in workflow
next_workflow:ai_workflow = self.get_workflow(next_msg.get_target())
inner_chat_session = the_role.agent.get_chat_session(next_msg.get_target(),next_msg.get_session_id())
inner_chat_session.append_post(next_msg)
resp = await next_workflow.send_msg(next_msg)
inner_chat_session.append_recv(resp)
# generator proc resp prompt with WAITING state
proc_resp_prompt:agent_prompt = self._get_resp_prompt(resp,msg,the_role,prompt,chatsession)
final_result = await compute_kernel().do_llm_completion(proc_resp_prompt,the_role.agent.get_llm_model_name(),the_role.agent.get_max_token_size())
return final_result
case "post_message":
# post message to other / sub workflow
next_msg:agent_msg = self._parse_to_msg(result)
if next_msg is not None:
next_workflow:ai_workflow = self.get_workflow(next_msg.get_target())
inner_chat_session = the_role.agent.get_chat_session(next_msg.get_target(),next_msg.get_session_id())
inner_chat_session.append_post(next_msg)
next_workflow.post_msg(next_msg)
case "ignore":
is_ignore = True
if is_ignore is not True:
# TODO : how to get inner chat session?
inner_chat_session = the_role.agent.get_chat_session_for_msg(msg)
if inner_chat_session is not None:
inner_chat_session.append_input(msg)
inner_chat_session.append_result(final_result)
return result
async def _workflow_process_msg(msg:agent_msg) -> None:
final_result = None
if self.input_filter is not None:
select_role = self.input_filter.select(msg)
if select_role is not None:
result = await _process_msg(msg,select_role)
if result is None:
logger.error(f"_process_msg return None for :{msg}")
return
if chatsession is not None:
chatsession.append_post(result)
final_result = result
else:
results = {}
for this_role in self.role_group.roles:
a_result = asyncio.create_task(_process_msg(msg,this_role))
results[this_role.get_name()] = a_result
# merge result from all roles
# TODO: one input msg can have multiple result msg, at this while ,we only support one result msg
final_result:agent_msg = self._merge_msg_result(results)
if chatsession is not None:
chatsession.append_post(final_result)
if final_result is not None:
# TODO post message to source
pass
asyncio.create_task(_workflow_process_msg(the_msg))
async def _pop_msg(self) -> agent_msg:
pass
def _get_chat_session_for_msg(self,msg:agent_msg) -> ai_chat_session:
pass
async def _get_prompt_from_session(self,chatsession:ai_chat_session,role_name:str) -> agent_prompt:
pass
def _get_msg_queue(self,session_id:str):
pass
def _merge_msg_result(self,results:dict) -> agent_msg:
pass
def _get_function_prompt(self,role_name:str) -> agent_prompt:
pass
def _get_knowlege_prompt(self,role_name:str) -> agent_prompt:
pass
def _get_resp_prompt(self,resp:str,msg:agent_msg,role:ai_role,prompt:agent_prompt,chatsession:ai_chat_session) -> agent_prompt:
pass
def get_workflow_rule_prompt(self) -> agent_prompt:
return self.rule_prompt
def _get_llm_result_type(self,llm_resp_str:str) -> str:
pass
def _parse_function_call_chain(self,llm_resp_str) -> call_chain:
pass
def _parse_to_msg(self,llm_resp_str) -> agent_msg:
pass
def get_workflow(self,workflow_name:str) -> ai_workflow:
"""get workflow from known workflow list or sub workflow list"""
pass
def _env_event_to_msg(self,env_event:environment_event) -> agent_msg:
pass
def get_inner_environment(self,env_id:str) -> environment:
pass
def connect_to_environment(self,env:environment) -> None:
the_env = self.connected_environment.get(env.get_id())
if the_env is None:
self.connected_environment[env.get_id()] = env
def _env_msg_handler(env_event:environment_event) -> None:
the_msg:agent_msg= self._env_event_to_msg(env_event)
self.post_msg(the_msg)
# register all event handler
the_env.attach_event_handler(None,_env_msg_handler)
else:
logger.warn(f"environment {env.get_id()} already connected!")
-3
View File
@@ -1,3 +0,0 @@
class ai_agent:
def __init__(self) -> None:
pass
+46 -9
View File
@@ -1,11 +1,19 @@
import logging
import toml
from .agent import ai_agent
from .templete import ai_agent_templete
from package_manager import pkg_env,pkg_env_mgr,pkg_media_info,media_reader,pkg_install_task
logger = logging.getLogger(__name__)
class agent_manager:
_instance = None
def __init__(self) -> None:
self.loaded_agent_instance = {}
pass
def __new__(cls):
@@ -15,22 +23,51 @@ class agent_manager:
def initial(self,root_dir:str) -> None:
pass
self.agent_templete_env : pkg_env = pkg_env_mgr().get_env(f"{root_dir}templetes/agent_templetes.cfg")
self.agent_env : pkg_env = pkg_env_mgr().get_env(f"{root_dir}agents/agents.cfg")
if self.agent_templete_env is None:
raise Exception("agent_manager initial failed")
def get(self,agent_id) -> ai_agent:
pass
def get(self,agent_id:str) -> ai_agent:
the_agent = self.loaded_agent_instance.get(agent_id)
if the_agent:
return the_agent
# try load from disk
agent_media_info = self.agent_env.load(agent_id)
if agent_media_info is None:
return None
the_agent = self._load_agent_from_media(agent_media_info)
if the_agent is None:
logger.warn(f"load agent {agent_id} from media failed!")
return the_agent
def remove(self,agent_id:str)->int:
pass
def get_templete(self,templete_id) -> ai_agent_templete:
template_media_info = self.agent_templete_env.get(templete_id)
if template_media_info is None:
return None
return self._load_templete_from_media(template_media_info)
def install(self,templete_id) -> pkg_install_task:
installer = self.agent_templete_env.get_installer()
return installer.install(templete_id)
def uninstall(self,templete_id) -> int:
pass
def _load_templete_from_media(self,templete_media:pkg_media_info) -> ai_agent_templete:
pass
def install(self,templete_id) -> int:
installer = None
#installer.install(templete_id)
def _load_agent_from_media(self,agent_media:pkg_media_info) -> ai_agent:
pass
def create(self,template,agent_name,agent_last_name,agent_introduce) -> ai_agent:
pass
-3
View File
@@ -1,3 +0,0 @@
class ai_agent_templete:
def __init__(self) -> None:
pass
@@ -0,0 +1,3 @@
from .env import pkg_env_mgr,pkg_env
from .pkg import pkg_info,pkg_media_info
from .installer import pkg_install_task
+4 -4
View File
@@ -19,7 +19,7 @@ INSTALL_TASK_STATE_DOWNLOADING = 3
INSTALL_TASK_STATE_INSTALLING = 4
INSTALL_TAKS_STATE_ERROR = 5
class install_task:
class pkg_install_task:
def __init__(self,owner:pkg_env) -> None:
self.owner = owner
self.state = INSTALL_TASK_STATE_CHECK_DEPENDENCY
@@ -35,7 +35,7 @@ class pkg_installer:
self.owner_env = owner_env
def install(self,pkg_name:str,
install_from_dependency = False, can_upgrade = True,skip_depends = False,options = None)->Tuple[install_task,str]:
install_from_dependency = False, can_upgrade = True,skip_depends = False,options = None)->Tuple[pkg_install_task,str]:
the_pkg_info : pkg_info = None
is_upgrade : bool = False
@@ -74,7 +74,7 @@ class pkg_installer:
return result_task,"already installing"
logger.info(f"start download&install {pkg_name},install_from_dependency={install_from_dependency},upgrade={is_upgrade},backup={need_backup},target_pkg_info={the_pkg_info}")
result_task = install_task()
result_task = pkg_install_task()
self.all_tasks[the_pkg_info.cid] = result_task
async def download_and_install_pkg()->int:
# check dependency
@@ -149,7 +149,7 @@ class pkg_installer:
if depend_task is not None:
logger.debug(f"{pkg.name}'s depend pkg {depend_pkg_name} already in task list")
continue
depend_task = install_task()
depend_task = pkg_install_task()
task_list[depend_pkg_name] = depend_task
depend_pkg_info = self.owner_env.lookup(depend_pkg_name)
@@ -0,0 +1,9 @@
class media_reader:
def __init__(self):
pass
def load_from_media(self,media_info:str) -> int:
pass
def read(self, inner_path:str):
raise NotImplementedError
+5 -4
View File
@@ -9,12 +9,13 @@ class pkg_info:
self.target_media_type = "dir"
self.source_media_type = "7z"
def parse_pkg_name(pkg_name:str) -> Tuple[str, str, str]:
#return pkg_id,version_str,cid
@classmethod
def parse_pkg_name(cls,pkg_name:str) -> Tuple[str, str, str]:
"""parse pkg name like test-pkg#nightly#>0.2.31#sha1:323423423 to test-pkg,nightly#>0.2.31,sha1:323423423"""
pass
@property
def cid(self) -> str:
return self.cid
-1
View File
@@ -1 +0,0 @@
TODO
+2 -1
View File
@@ -23,8 +23,9 @@ def test_agent():
agent = am.create(agent_templete,"Tracy","Wang","Tracy Wang is my english teacher")
print("Agent Tracy Wang load success!");
print(agent.get_introduce());
#print(agent.get_introduce());
#chat_session = agent.get_default_chat_session("master");
#chat_session.chat("给我讲一个英文笑话!");
+66
View File
@@ -0,0 +1,66 @@
import asyncio
import aiohttp
import aiofiles
STATE_DONE = 0
STATE_DOWNLOADING = 1
class install_task:
def __init__(self) -> None:
self.download_task = None
self.state = STATE_DOWNLOADING
self.recv_bytes = 0
self.total_bytes = 0
class install_task_mgr:
def __init__(self) -> None:
self.all_tasks = {}
def create_install_task(self,url:str,target:str):
owner = self
this_task = self.all_tasks.get(url)
if this_task is not None:
return this_task
this_task = install_task()
self.all_tasks[url] = this_task
async def down_and_write():
async with aiofiles.open(target, 'wb') as file:
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
while True:
chunk = await response.content.read(1024*1024*16)
this_task.recv_bytes += len(chunk)
if not chunk:
break
await file.write(chunk)
print(f"download task {url} done!")
this_task.state = STATE_DONE
del owner.all_tasks[url]
this_task.download_task = asyncio.create_task(down_and_write())
return this_task
async def test_wait_download(mgr):
this_task = mgr.create_install_task("https://www.cyfs.com/download/beta/cyberchat/android/latest","test.pkg")
await this_task.download_task
def test_timer_download(mgr):
this_task = mgr.create_install_task("https://www.cyfs.com/download/beta/cyberchat/android/latest","test.pkg")
# start timer
async def check_timer():
while this_task.state == STATE_DOWNLOADING:
await r = asyncio.sleep(1)
print(f"download bytes:{this_task.recv_bytes}")
print("download complete!")
asyncio.create_task(check_timer())
async def test_main():
mgr = install_task_mgr()
test_timer_download(mgr)
await test_wait_download(mgr)
await asyncio.sleep(1)
if __name__ == "__main__":
asyncio.run(test_main())
+12
View File
@@ -0,0 +1,12 @@
import asyncio
async def test_llm_completion_task():
# compute task have engouh meta info to make sure compute_kernel can run it in most suitable compute container
test_task = llm_completion_task()
# add tset_task to compute_kernel's execute queue
compute_kernel.run(test_task)
# wait for test_task
if __name__ == "__main__":
asyncio.run(test_llm_completion_task())
+6
View File
@@ -0,0 +1,6 @@
def test_workflow():
pass