pycoze 0.1.151__tar.gz → 0.1.152__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. {pycoze-0.1.151 → pycoze-0.1.152}/PKG-INFO +1 -1
  2. pycoze-0.1.152/pycoze/bot/bot.py +40 -0
  3. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze.egg-info/PKG-INFO +1 -1
  4. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze.egg-info/SOURCES.txt +0 -1
  5. {pycoze-0.1.151 → pycoze-0.1.152}/setup.py +1 -1
  6. pycoze-0.1.151/pycoze/bot/bot.py +0 -21
  7. pycoze-0.1.151/pycoze/module.py +0 -0
  8. {pycoze-0.1.151 → pycoze-0.1.152}/LICENSE +0 -0
  9. {pycoze-0.1.151 → pycoze-0.1.152}/README.md +0 -0
  10. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/__init__.py +0 -0
  11. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/ai/__init__.py +0 -0
  12. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/ai/vram_reserve.py +0 -0
  13. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/bot/__init__.py +0 -0
  14. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/bot/agent/__init__.py +0 -0
  15. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/bot/agent/agent.py +0 -0
  16. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/bot/agent/agent_types/__init__.py +0 -0
  17. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/bot/agent/agent_types/const.py +0 -0
  18. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/bot/agent/agent_types/openai_func_call_agent.py +0 -0
  19. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/bot/agent/assistant.py +0 -0
  20. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/bot/agent/chat.py +0 -0
  21. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/bot/agent_chat.py +0 -0
  22. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/reference/__init__.py +0 -0
  23. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/reference/bot.py +0 -0
  24. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/reference/lib.py +0 -0
  25. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/reference/tool.py +0 -0
  26. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/ui/__init__.py +0 -0
  27. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/ui/base.py +0 -0
  28. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/ui/color.py +0 -0
  29. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/ui/typ.py +0 -0
  30. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/ui/ui_def.py +0 -0
  31. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/utils/__init__.py +0 -0
  32. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/utils/arg.py +0 -0
  33. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze/utils/text_or_file.py +0 -0
  34. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze.egg-info/dependency_links.txt +0 -0
  35. {pycoze-0.1.151 → pycoze-0.1.152}/pycoze.egg-info/top_level.txt +0 -0
  36. {pycoze-0.1.151 → pycoze-0.1.152}/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.152
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -0,0 +1,40 @@
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 threading
6
+
7
+
8
+ def chat(bot_setting_file: str):
9
+ history = []
10
+ stop_event = threading.Event()
11
+
12
+ def user_input_listener():
13
+ while not stop_event.is_set():
14
+ input_text = input()
15
+ if input_text:
16
+ stop_event.set()
17
+ if not input_text.startswith(INPUT_MESSAGE):
18
+ raise ValueError("Invalid message")
19
+ message = json.loads(input_text[len(INPUT_MESSAGE):])
20
+ history.append(HumanMessage(message["content"]))
21
+ # 中断当前的机器人输出
22
+ print("User interrupted the bot.")
23
+ # 重新开始对话
24
+ chat(bot_setting_file)
25
+
26
+ input_thread = threading.Thread(target=user_input_listener)
27
+ input_thread.start()
28
+
29
+ while not stop_event.is_set():
30
+ result = agent_chat(bot_setting_file, history)
31
+ history.append(output("assistant", result))
32
+ print(result) # 输出机器人回复
33
+
34
+ input_thread.join()
35
+
36
+
37
+ def get_chat_response(bot_setting_file: str, input_text: str):
38
+ history = [HumanMessage(input_text)]
39
+ result = agent_chat(bot_setting_file, history)
40
+ 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.152
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.152",
6
6
  packages=find_packages(),
7
7
  install_requires=[],
8
8
  author="Yuan Jie Xiong",
@@ -1,21 +0,0 @@
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
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