pycoze 0.1.151__tar.gz → 0.1.153__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. {pycoze-0.1.151 → pycoze-0.1.153}/PKG-INFO +1 -1
  2. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/bot/agent_chat.py +3 -2
  3. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/bot/bot.py +29 -21
  4. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze.egg-info/PKG-INFO +1 -1
  5. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze.egg-info/SOURCES.txt +0 -1
  6. {pycoze-0.1.151 → pycoze-0.1.153}/setup.py +1 -1
  7. pycoze-0.1.151/pycoze/module.py +0 -0
  8. {pycoze-0.1.151 → pycoze-0.1.153}/LICENSE +0 -0
  9. {pycoze-0.1.151 → pycoze-0.1.153}/README.md +0 -0
  10. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/__init__.py +0 -0
  11. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/ai/__init__.py +0 -0
  12. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/ai/vram_reserve.py +0 -0
  13. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/bot/__init__.py +0 -0
  14. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/bot/agent/__init__.py +0 -0
  15. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/bot/agent/agent.py +0 -0
  16. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/bot/agent/agent_types/__init__.py +0 -0
  17. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/bot/agent/agent_types/const.py +0 -0
  18. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/bot/agent/agent_types/openai_func_call_agent.py +0 -0
  19. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/bot/agent/assistant.py +0 -0
  20. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/bot/agent/chat.py +0 -0
  21. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/reference/__init__.py +0 -0
  22. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/reference/bot.py +0 -0
  23. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/reference/lib.py +0 -0
  24. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/reference/tool.py +0 -0
  25. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/ui/__init__.py +0 -0
  26. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/ui/base.py +0 -0
  27. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/ui/color.py +0 -0
  28. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/ui/typ.py +0 -0
  29. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/ui/ui_def.py +0 -0
  30. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/utils/__init__.py +0 -0
  31. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/utils/arg.py +0 -0
  32. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze/utils/text_or_file.py +0 -0
  33. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze.egg-info/dependency_links.txt +0 -0
  34. {pycoze-0.1.151 → pycoze-0.1.153}/pycoze.egg-info/top_level.txt +0 -0
  35. {pycoze-0.1.151 → pycoze-0.1.153}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.151
3
+ Version: 0.1.153
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -32,7 +32,7 @@ def load_abilities(bot_setting_file: str):
32
32
  return abilities
33
33
 
34
34
 
35
- def agent_chat(bot_setting_file, history):
35
+ def agent_chat(bot_setting_file, history, result_queue):
36
36
  role_setting = load_role_setting(bot_setting_file)
37
37
  abilities = load_abilities(bot_setting_file)
38
38
 
@@ -75,4 +75,5 @@ def agent_chat(bot_setting_file, history):
75
75
  assistant_message=prompt,
76
76
  tool_compatibility_mode=cfg["toolCompatibilityMode"],
77
77
  )
78
- return asyncio.run(run_agent(agent, history, cfg["toolCompatibilityMode"]))
78
+ result = asyncio.run(run_agent(agent, history, cfg["toolCompatibilityMode"]))
79
+ result_queue.put(result_queue)
@@ -1,21 +1,29 @@
1
- from langchain_core.messages import HumanMessage
2
- from .agent import INPUT_MESSAGE, output
3
- from .agent_chat import agent_chat
4
- import json
5
-
6
- def chat(bot_setting_file: str):
7
- history = []
8
- while True:
9
- input_text = input()
10
- if not input_text.startswith(INPUT_MESSAGE):
11
- raise ValueError("Invalid message")
12
- message = json.loads(input_text[len(INPUT_MESSAGE) :])
13
- history.append(HumanMessage(message["content"]))
14
- result = agent_chat(bot_setting_file, history)
15
- history.append(output("assistant", result))
16
-
17
-
18
- def get_chat_response(bot_setting_file: str, input_text: str):
19
- history = [HumanMessage(input_text)]
20
- result = agent_chat(bot_setting_file, history)
21
- return result
1
+ from langchain_core.messages import HumanMessage
2
+ from .agent import INPUT_MESSAGE, output
3
+ from .agent_chat import agent_chat
4
+ import json
5
+ import queue
6
+ import threading
7
+
8
+
9
+ def chat(bot_setting_file: str):
10
+ history = []
11
+ while True:
12
+ input_text = input()
13
+ if not input_text.startswith(INPUT_MESSAGE):
14
+ raise ValueError("Invalid message")
15
+ message = json.loads(input_text[len(INPUT_MESSAGE) :])
16
+ history.append(HumanMessage(message["content"]))
17
+ result_queue = queue.Queue()
18
+ agent_chat_thread = threading.Thread(target=agent_chat, args=(bot_setting_file, history, result_queue))
19
+
20
+ result = agent_chat(bot_setting_file, history)
21
+ history.append(output("assistant", result))
22
+
23
+
24
+
25
+ def get_chat_response(bot_setting_file: str, input_text: str):
26
+ history = [HumanMessage(input_text)]
27
+ result_queue = queue.Queue()
28
+ result = agent_chat(bot_setting_file, history, result_queue)
29
+ return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.151
3
+ Version: 0.1.153
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -2,7 +2,6 @@ LICENSE
2
2
  README.md
3
3
  setup.py
4
4
  pycoze/__init__.py
5
- pycoze/module.py
6
5
  pycoze.egg-info/PKG-INFO
7
6
  pycoze.egg-info/SOURCES.txt
8
7
  pycoze.egg-info/dependency_links.txt
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pycoze",
5
- version="0.1.151",
5
+ version="0.1.153",
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