pycoze 0.1.173__tar.gz → 0.1.175__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pycoze-0.1.173 → pycoze-0.1.175}/PKG-INFO +1 -1
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/bot/agent/chat.py +3 -2
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/bot/agent_chat.py +2 -1
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/bot/bot.py +7 -8
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze.egg-info/PKG-INFO +1 -1
- {pycoze-0.1.173 → pycoze-0.1.175}/setup.py +1 -1
- {pycoze-0.1.173 → pycoze-0.1.175}/LICENSE +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/README.md +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/__init__.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/ai/__init__.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/ai/vram_reserve.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/bot/__init__.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/bot/agent/__init__.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/bot/agent/agent.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/bot/agent/agent_types/__init__.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/bot/agent/agent_types/const.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/bot/agent/agent_types/openai_func_call_agent.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/bot/agent/assistant.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/reference/__init__.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/reference/bot.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/reference/lib.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/reference/tool.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/ui/__init__.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/ui/base.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/ui/color.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/ui/typ.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/ui/ui_def.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/utils/__init__.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/utils/arg.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze/utils/text_or_file.py +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze.egg-info/SOURCES.txt +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze.egg-info/dependency_links.txt +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/pycoze.egg-info/top_level.txt +0 -0
- {pycoze-0.1.173 → pycoze-0.1.175}/setup.cfg +0 -0
@@ -9,7 +9,7 @@ _INFOMATION_MESSAGE = "INFOMATION_MESSAGE=>"
|
|
9
9
|
_LOG = "LOG=>"
|
10
10
|
|
11
11
|
|
12
|
-
CHAT_DATA = {"output":""}
|
12
|
+
CHAT_DATA = {"output":"", "info": ""}
|
13
13
|
|
14
14
|
|
15
15
|
def log(content, *args, end="\n", **kwargs):
|
@@ -17,7 +17,7 @@ def log(content, *args, end="\n", **kwargs):
|
|
17
17
|
|
18
18
|
|
19
19
|
def clear_chat_data():
|
20
|
-
CHAT_DATA = {"output":""}
|
20
|
+
CHAT_DATA = {"output":"", "info": ""}
|
21
21
|
|
22
22
|
|
23
23
|
def output(role, content):
|
@@ -26,4 +26,5 @@ def output(role, content):
|
|
26
26
|
print(_OUTPUT_MESSAGE + json.dumps({"role": role, "content": content}))
|
27
27
|
|
28
28
|
def info(role, content):
|
29
|
+
CHAT_DATA["info"] += content
|
29
30
|
print(_INFOMATION_MESSAGE + json.dumps({"role": role, "content": content}))
|
@@ -76,4 +76,5 @@ async def agent_chat(bot_setting_file, history, should_exit):
|
|
76
76
|
tool_compatibility_mode=cfg["toolCompatibilityMode"],
|
77
77
|
)
|
78
78
|
result = await run_agent(agent, history, cfg["toolCompatibilityMode"], should_exit)
|
79
|
-
|
79
|
+
if not should_exit.is_set():
|
80
|
+
output("assistant", result)
|
@@ -10,10 +10,10 @@ import asyncio
|
|
10
10
|
|
11
11
|
class PeekableQueue(queue.Queue):
|
12
12
|
def peek(self):
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
return
|
13
|
+
try:
|
14
|
+
return self._get()
|
15
|
+
except queue.Empty:
|
16
|
+
return None
|
17
17
|
|
18
18
|
def chat(bot_setting_file: str):
|
19
19
|
history = []
|
@@ -51,15 +51,14 @@ def chat(bot_setting_file: str):
|
|
51
51
|
while agent_chat_thread.is_alive():
|
52
52
|
print("alive")
|
53
53
|
if not input_queue.empty():
|
54
|
-
print("not input_queue.empty()")
|
55
54
|
next_input_text = input_queue.peek()
|
56
|
-
print("next_input_text", next_input_text)
|
57
55
|
if next_input_text == INTERRUPT_MESSAGE:
|
58
|
-
|
56
|
+
history.append(AIMessage(content=CHAT_DATA["info"]))
|
59
57
|
should_exit.set() # 设置退出标志
|
60
58
|
break
|
61
59
|
time.sleep(0.1) # 每隔 0.1 秒检查一次
|
62
|
-
|
60
|
+
if next_input_text != INTERRUPT_MESSAGE:
|
61
|
+
history.append(AIMessage(content=CHAT_DATA["output"]))
|
63
62
|
except json.JSONDecodeError:
|
64
63
|
print("Invalid JSON format in input message.")
|
65
64
|
except KeyError:
|
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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|