pycoze 0.1.271__py3-none-any.whl → 0.1.279__py3-none-any.whl
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.
- pycoze/api/lib/tab_cls.py +7 -8
- pycoze/bot/agent/agent.py +9 -5
- pycoze/utils/socket.py +3 -3
- {pycoze-0.1.271.dist-info → pycoze-0.1.279.dist-info}/METADATA +6 -1
- {pycoze-0.1.271.dist-info → pycoze-0.1.279.dist-info}/RECORD +8 -8
- {pycoze-0.1.271.dist-info → pycoze-0.1.279.dist-info}/WHEEL +1 -1
- {pycoze-0.1.271.dist-info → pycoze-0.1.279.dist-info}/LICENSE +0 -0
- {pycoze-0.1.271.dist-info → pycoze-0.1.279.dist-info}/top_level.txt +0 -0
pycoze/api/lib/tab_cls.py
CHANGED
@@ -9,9 +9,8 @@ socket = utils.socket
|
|
9
9
|
params = utils.params
|
10
10
|
|
11
11
|
class TabCls:
|
12
|
-
|
13
12
|
def open_workflow(self, workflow_id: str, wait_for_open=True) -> WorkflowCls:
|
14
|
-
item_path = os.path.join(params["workspacePath"], 'workflow', workflow_id)
|
13
|
+
item_path = os.path.join(params["workspacePath"], 'User', 'Local', 'workflow', workflow_id)
|
15
14
|
if not os.path.isabs(item_path):
|
16
15
|
item_path = os.path.abspath(item_path)
|
17
16
|
info_path = os.path.join(item_path, "info.json")
|
@@ -23,10 +22,6 @@ class TabCls:
|
|
23
22
|
self._wait_for_tab_open(location)
|
24
23
|
return WorkflowCls(location)
|
25
24
|
|
26
|
-
def get_active(self) -> ViewCls:
|
27
|
-
result = socket.post_and_recv_result("get-active-tab", {})
|
28
|
-
return self._result_to_view(result)
|
29
|
-
|
30
25
|
def _wait_for_tab_open(self, location: list[str] | ViewCls):
|
31
26
|
times = 0
|
32
27
|
while not self.is_tab_open(location):
|
@@ -35,9 +30,13 @@ class TabCls:
|
|
35
30
|
if times > 1000:
|
36
31
|
raise Exception("Tab open timeout")
|
37
32
|
|
38
|
-
def
|
33
|
+
def get_active(self) -> list[str]:
|
34
|
+
result = socket.post_and_recv_result("get-active-tab", {})
|
35
|
+
return result
|
36
|
+
|
37
|
+
def get_all(self) -> list[list[str]]:
|
39
38
|
results = socket.post_and_recv_result("get-all-tabs", {})
|
40
|
-
return
|
39
|
+
return results
|
41
40
|
|
42
41
|
def close_tab(self, location: list[str] | ViewCls):
|
43
42
|
if isinstance(location, ViewCls):
|
pycoze/bot/agent/agent.py
CHANGED
@@ -9,14 +9,13 @@ from langchain_core.messages import (
|
|
9
9
|
AIMessageChunk,
|
10
10
|
SystemMessage,
|
11
11
|
)
|
12
|
-
from langchain_core.agents import AgentFinish
|
13
12
|
from .agent_types.const import HumanToolString
|
14
13
|
|
15
14
|
|
16
15
|
async def run_agent(agent, inputs: list, tool_compatibility_mode: bool):
|
17
16
|
exist_ids = set()
|
18
17
|
content_list = []
|
19
|
-
async for event in agent.astream_events(inputs, version="
|
18
|
+
async for event in agent.astream_events(inputs, version="v1"):
|
20
19
|
kind = event["event"]
|
21
20
|
if kind == "on_chain_end":
|
22
21
|
if "data" in event:
|
@@ -28,8 +27,13 @@ async def run_agent(agent, inputs: list, tool_compatibility_mode: bool):
|
|
28
27
|
):
|
29
28
|
input_list = event["data"]["input"]
|
30
29
|
for msg in input_list:
|
31
|
-
if isinstance(msg, HumanMessage) or isinstance(
|
32
|
-
|
30
|
+
if isinstance(msg, HumanMessage) or isinstance(
|
31
|
+
msg, SystemMessage
|
32
|
+
):
|
33
|
+
if (
|
34
|
+
not tool_compatibility_mode
|
35
|
+
or not msg.content.startswith(HumanToolString)
|
36
|
+
):
|
33
37
|
content_list = [] # 防止内容重复
|
34
38
|
if isinstance(msg, AIMessage) and not isinstance(
|
35
39
|
msg, AIMessageChunk
|
@@ -88,4 +92,4 @@ if __name__ == "__main__":
|
|
88
92
|
)
|
89
93
|
|
90
94
|
inputs = [HumanMessage(content="计算根号7+根号88")]
|
91
|
-
print(asyncio.run(run_agent(agent, inputs, True, threading.Event())))
|
95
|
+
print(asyncio.run(run_agent(agent, inputs, True, threading.Event())))
|
pycoze/utils/socket.py
CHANGED
@@ -5,14 +5,14 @@ from pycoze import utils
|
|
5
5
|
|
6
6
|
|
7
7
|
params = utils.params
|
8
|
-
tcp_port = params["tcpPort"]
|
9
8
|
|
10
9
|
|
11
10
|
class TcpSocket:
|
12
11
|
def __init__(self):
|
13
|
-
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
14
|
-
self.socket.connect(("localhost", int(tcp_port)))
|
15
12
|
self.is_connected = True
|
13
|
+
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
14
|
+
if params is not None:
|
15
|
+
self.socket.connect(("localhost", int(params["tcpPort"])))
|
16
16
|
|
17
17
|
def post(self, subject, message):
|
18
18
|
subject = "python-event:" + subject
|
@@ -1,9 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pycoze
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.279
|
4
4
|
Summary: Package for pycoze only!
|
5
|
+
Home-page: UNKNOWN
|
5
6
|
Author: Yuan Jie Xiong
|
6
7
|
Author-email: aiqqqqqqq@qq.com
|
8
|
+
License: UNKNOWN
|
9
|
+
Platform: UNKNOWN
|
7
10
|
Classifier: Programming Language :: Python :: 3
|
8
11
|
Classifier: License :: OSI Approved :: MIT License
|
9
12
|
Classifier: Operating System :: OS Independent
|
@@ -25,3 +28,5 @@ Package for pycoze only!
|
|
25
28
|
<!-- python setup.py sdist bdist_wheel -->
|
26
29
|
<!-- twine upload dist/* -->
|
27
30
|
<!-- 修改src\renderer\layout\init\const.ts中的库版本要求 -->
|
31
|
+
|
32
|
+
|
@@ -7,14 +7,14 @@ pycoze/ai/llm/text_to_image_prompt.py,sha256=0bx2C_YRvjAo7iphHGp1-pmGKsKqwur7dM0
|
|
7
7
|
pycoze/ai/llm/think.py,sha256=sUgTBdGzcZtL3r-Wx8M3lDuVUmDVz8g3qC0VU8uiKAI,5143
|
8
8
|
pycoze/api/__init__.py,sha256=GGRRRPop0ZxdXe5JRhg2XvHITGIWfNcHA25opJZ0f1w,313
|
9
9
|
pycoze/api/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
pycoze/api/lib/tab_cls.py,sha256=
|
10
|
+
pycoze/api/lib/tab_cls.py,sha256=nPbTfWF_Mmz3tKAmGrVdgK21HE9g1074V59nrteiG8c,2612
|
11
11
|
pycoze/api/lib/view.py,sha256=sl3qOC-IbfJaUg1-nLtEpm-0sDxyI9UOhhrnITaFsFs,7258
|
12
12
|
pycoze/api/lib/window_cls.py,sha256=Yezy-SR_EwVtUjrgXnHRC69WGgXVaXeJHjaxn09Ophg,1737
|
13
13
|
pycoze/bot/__init__.py,sha256=JxnRoCCqx_LFyVb3pLu0qYCsH8ZLuAaMXAtvVUuCHuE,78
|
14
14
|
pycoze/bot/agent_chat.py,sha256=ARXXsIVCTpmBojz2C4BR69nB0QhM6gkEngL3iq34JPo,4178
|
15
15
|
pycoze/bot/bot.py,sha256=_qmUTZ09FmRLifHrW5stDZWGVK6yuMEMBC3fmeYJnqk,844
|
16
16
|
pycoze/bot/agent/__init__.py,sha256=3wE8_FFQS8j2BY-g9Cr-onV0POEvDRZaw_NCzpqrNus,265
|
17
|
-
pycoze/bot/agent/agent.py,sha256=
|
17
|
+
pycoze/bot/agent/agent.py,sha256=rdmc1GD3LVWNDpt2BD4_5N3w5c8dHkxoOlvAWKq3b1E,3653
|
18
18
|
pycoze/bot/agent/assistant.py,sha256=5LIgPIVVzx6uIOWT5S_XDDyPPjPHRBBNpIU3GiOkVHc,1186
|
19
19
|
pycoze/bot/agent/chat.py,sha256=mubOCAHvA6VtyE6N40elI6KrP6A69uB_G6ihE3G_Vi4,860
|
20
20
|
pycoze/bot/agent/agent_types/__init__.py,sha256=zmU2Kmrv5mCdfg-QlPn2H6pWxbGeq8s7YTqLhpzJC6k,179
|
@@ -33,10 +33,10 @@ pycoze/ui/ui_def.py,sha256=lGWZGpzRoegP34D562PvK0EJHrmVZrlHW1JjsIG9A9Q,4521
|
|
33
33
|
pycoze/utils/__init__.py,sha256=H-2KRUsUG47owL0sbD1KwDOuRm-j_0K4RkeNhzr7ISo,319
|
34
34
|
pycoze/utils/arg.py,sha256=jop1tBfe5hYkHW1NSpCeaZBEznkgguBscj_7M2dWfrs,503
|
35
35
|
pycoze/utils/env.py,sha256=5pWlXfM1F5ZU9hhv1rHlDEanjEW5wf0nbyez9bNRqqA,559
|
36
|
-
pycoze/utils/socket.py,sha256=
|
36
|
+
pycoze/utils/socket.py,sha256=bZbFFRH4mfThzRqt55BAAGQ6eICx_ja4x8UGGrUdAm8,2428
|
37
37
|
pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
|
38
|
-
pycoze-0.1.
|
39
|
-
pycoze-0.1.
|
40
|
-
pycoze-0.1.
|
41
|
-
pycoze-0.1.
|
42
|
-
pycoze-0.1.
|
38
|
+
pycoze-0.1.279.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
|
39
|
+
pycoze-0.1.279.dist-info/METADATA,sha256=kCMpc0ItijrWiZigjVP1T_126Zn5d7CrB2DYSQI-sK8,755
|
40
|
+
pycoze-0.1.279.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
|
41
|
+
pycoze-0.1.279.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
|
42
|
+
pycoze-0.1.279.dist-info/RECORD,,
|
File without changes
|
File without changes
|