pycoze 0.1.208__tar.gz → 0.1.210__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. {pycoze-0.1.208 → pycoze-0.1.210}/PKG-INFO +1 -1
  2. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/bot/agent/agent.py +1 -4
  3. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/bot/agent_chat.py +7 -4
  4. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/bot/bot.py +3 -5
  5. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze.egg-info/PKG-INFO +1 -1
  6. {pycoze-0.1.208 → pycoze-0.1.210}/setup.py +1 -1
  7. {pycoze-0.1.208 → pycoze-0.1.210}/LICENSE +0 -0
  8. {pycoze-0.1.208 → pycoze-0.1.210}/README.md +0 -0
  9. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/__init__.py +0 -0
  10. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/ai/__init__.py +0 -0
  11. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/ai/vram_reserve.py +0 -0
  12. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/automation/__init__.py +0 -0
  13. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/automation/browser/__init__.py +0 -0
  14. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/automation/browser/edge_driver_manager.py +0 -0
  15. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/bot/__init__.py +0 -0
  16. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/bot/agent/__init__.py +0 -0
  17. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/bot/agent/agent_types/__init__.py +0 -0
  18. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/bot/agent/agent_types/const.py +0 -0
  19. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/bot/agent/agent_types/openai_func_call_agent.py +0 -0
  20. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/bot/agent/assistant.py +0 -0
  21. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/bot/agent/chat.py +0 -0
  22. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/reference/__init__.py +0 -0
  23. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/reference/bot.py +0 -0
  24. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/reference/lib.py +0 -0
  25. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/reference/tool.py +0 -0
  26. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/reference/workflow.py +0 -0
  27. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/ui/__init__.py +0 -0
  28. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/ui/base.py +0 -0
  29. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/ui/color.py +0 -0
  30. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/ui/typ.py +0 -0
  31. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/ui/ui_def.py +0 -0
  32. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/utils/__init__.py +0 -0
  33. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/utils/arg.py +0 -0
  34. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/utils/env.py +0 -0
  35. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze/utils/text_or_file.py +0 -0
  36. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze.egg-info/SOURCES.txt +0 -0
  37. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze.egg-info/dependency_links.txt +0 -0
  38. {pycoze-0.1.208 → pycoze-0.1.210}/pycoze.egg-info/top_level.txt +0 -0
  39. {pycoze-0.1.208 → pycoze-0.1.210}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.208
3
+ Version: 0.1.210
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -13,13 +13,10 @@ from langchain_core.agents import AgentFinish
13
13
  from .agent_types.const import HumanToolString
14
14
 
15
15
 
16
- async def run_agent(agent, inputs: list, tool_compatibility_mode: bool, should_exit):
16
+ async def run_agent(agent, inputs: list, tool_compatibility_mode: bool):
17
17
  exist_ids = set()
18
18
  content_list = []
19
19
  async for event in agent.astream_events(inputs, version="v2"):
20
- if should_exit.is_set():
21
- break
22
-
23
20
  kind = event["event"]
24
21
  if kind == "on_chain_end":
25
22
  if "data" in event:
@@ -34,7 +34,7 @@ def load_abilities(bot_setting_file: str):
34
34
  return abilities
35
35
 
36
36
 
37
- async def agent_chat(bot_setting_file, history, should_exit):
37
+ async def agent_chat(bot_setting_file, history):
38
38
  role_setting = load_role_setting(bot_setting_file)
39
39
  abilities = load_abilities(bot_setting_file)
40
40
 
@@ -77,6 +77,9 @@ async def agent_chat(bot_setting_file, history, should_exit):
77
77
  assistant_message=prompt,
78
78
  tool_compatibility_mode=cfg["toolCompatibilityMode"],
79
79
  )
80
- result = await run_agent(agent, history, cfg["toolCompatibilityMode"], should_exit)
81
- if not should_exit.is_set():
82
- output("assistant", result)
80
+ try:
81
+ result = await run_agent(agent, history, cfg["toolCompatibilityMode"])
82
+ return result
83
+ except KeyboardInterrupt:
84
+ return CHAT_DATA["info"]
85
+
@@ -22,9 +22,8 @@ def chat(bot_setting_file: str):
22
22
  raise ValueError("Invalid message")
23
23
  message = json.loads(input_text[len(INPUT_MESSAGE) :])
24
24
  history.append(HumanMessage(message["content"]))
25
- should_exit = threading.Event()
26
- result = agent_chat(bot_setting_file, history, should_exit)
27
- history.append(AIMessage(result["output"]))
25
+ result = asyncio.run(agent_chat(bot_setting_file, history))
26
+ history.append(AIMessage(result))
28
27
 
29
28
 
30
29
 
@@ -32,6 +31,5 @@ def chat(bot_setting_file: str):
32
31
  def get_chat_response(bot_setting_file: str, input_text: str):
33
32
  history = [HumanMessage(input_text)]
34
33
  clear_chat_data()
35
- should_exit = threading.Event()
36
- asyncio.run(agent_chat(bot_setting_file, history, should_exit))
34
+ asyncio.run(agent_chat(bot_setting_file, history))
37
35
  return CHAT_DATA["output"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.208
3
+ Version: 0.1.210
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pycoze",
5
- version="0.1.208",
5
+ version="0.1.210",
6
6
  packages=find_packages(),
7
7
  install_requires=[],
8
8
  author="Yuan Jie Xiong",
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