pycoze 0.1.58__py3-none-any.whl → 0.1.60__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/bot/__init__.py CHANGED
@@ -1 +1 @@
1
- from .bot import chat
1
+ from .bot import chat, get_chat_response
@@ -1,5 +1,5 @@
1
- from .agent import run_agent
2
- from .assistant import Runnable
3
- from .chat import INPUT_MESSAGE, output
4
-
5
- __all__ = [run_agent, Runnable, INPUT_MESSAGE, output]
1
+ from .agent import run_agent
2
+ from .assistant import Runnable
3
+ from .chat import INPUT_MESSAGE, output
4
+
5
+ __all__ = [run_agent, Runnable, INPUT_MESSAGE, output]
pycoze/bot/bot.py CHANGED
@@ -73,3 +73,9 @@ def chat(bot_setting_file: str):
73
73
  history.append(HumanMessage(message["content"]))
74
74
  result = agent_chat(bot_setting_file, history)
75
75
  history.append(output("assistant", result))
76
+
77
+
78
+ def get_chat_response(bot_setting_file: str, input_text: str):
79
+ history = [HumanMessage(input_text)]
80
+ result = agent_chat(bot_setting_file, history)
81
+ return result
pycoze/ui/ui_def.py CHANGED
@@ -50,6 +50,10 @@ def password(name, default, tip="", hide_if="", style="", cls="") -> str:
50
50
  return useDefault(name, default)
51
51
 
52
52
 
53
+ def tool(name, default, tools, tip="", hide_if="", style="", cls="") -> str:
54
+ return eval(useDefault(name, default))
55
+
56
+
53
57
  def color(
54
58
  name,
55
59
  default,
pycoze/utils/arg.py CHANGED
@@ -1,17 +1,20 @@
1
- import argparse
2
1
  import sys
3
2
  import json
4
3
 
5
4
 
6
- def read_arg(param, is_path=False):
5
+ def read_arg(param, is_path=False, posix=True):
6
+ while param.startswith("-"):
7
+ param = param[1:]
7
8
  args = sys.argv[1:]
8
- parser = argparse.ArgumentParser()
9
- parser.add_argument(param, nargs="?", help=f"Parameter {param}")
10
- args = parser.parse_known_args(args)[0]
11
- value = getattr(args, param.lstrip("-"))
12
- # 如果是路径并且有引号,去掉引号
13
- if is_path and value and value.startswith('"') and value.endswith('"'):
14
- value = value[1:-1]
9
+ for i in range(len(args)):
10
+ if args[i] == "-" + param or args[i] == "--" + param:
11
+ value = args[i + 1]
12
+ break
13
+ if is_path and value:
14
+ if value.startswith('"') and value.endswith('"'):
15
+ value = value[1:-1]
16
+ if posix:
17
+ value = value.replace("\\", "/")
15
18
 
16
19
  return value
17
20
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.58
3
+ Version: 0.1.60
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -2,9 +2,9 @@ pycoze/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  pycoze/module.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  pycoze/access/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  pycoze/access/tool_for_bot.py,sha256=Nv6XlxcqaLaMVQNDkpcthlqaSxyfHoOfWiTScQXO22Y,2656
5
- pycoze/bot/__init__.py,sha256=pciDtfcIXda7iFt9uI5Fpm0JKpGBhdXHmJv4966WTVU,21
6
- pycoze/bot/bot.py,sha256=URQYW8mbcsjIsO3pNT-QFzWNwQFtOhUJG62dfxqZTLM,2589
7
- pycoze/bot/agent/__init__.py,sha256=IaYqQCJ3uBor92JdOxI_EY4HtYOHgej8lijr3UrN1Vc,161
5
+ pycoze/bot/__init__.py,sha256=6HHMxDQVOyZM9dtSjQm9tjGnhj4h7CixD0JOvEwTi48,41
6
+ pycoze/bot/bot.py,sha256=jl-1sSgAw59gW4xj1Fyenbr2u1_AOk6WWjEfGQ0r-Ys,2764
7
+ pycoze/bot/agent/__init__.py,sha256=YR9vpkEQn1e4937r_xFPJXUCPBEJ0SFzEQDBe2x3-YA,157
8
8
  pycoze/bot/agent/agent.py,sha256=7xnz4a8LDyAVU0O3tS6n7_jSnr_lukQxfNR2znCWoV4,4611
9
9
  pycoze/bot/agent/assistant.py,sha256=QLeWaPi415P9jruYOm8qcIbC94cXXAhJYmLTkyC9NTQ,1267
10
10
  pycoze/bot/agent/chat.py,sha256=kc0qgcrBSXdiMy49JwThZTV-0PAvzAhiUvbI5ILiSnU,571
@@ -18,12 +18,12 @@ pycoze/ui/__init__.py,sha256=CBBpypz4qDoqJkPmGqR2BroCOEIX4rZiJucRsANPnwo,448
18
18
  pycoze/ui/base.py,sha256=nXNXRTZ5Tl1AQp5nfjzLvOVzt_1nLSCn2IOyfxAN_fc,1471
19
19
  pycoze/ui/color.py,sha256=cT9Ib8uNzkOKxyW0IwVj46o4LwdB1xgNCj1_Rou9d_4,854
20
20
  pycoze/ui/typ.py,sha256=NpT0FrbHvByOszBZMFtroRp7I7pN-38tYz_zPOPejF4,1723
21
- pycoze/ui/ui_def.py,sha256=CNFYH8NC-WYmbceIPpxsRr9H6O006pMKukx7U-BOE1Q,3744
21
+ pycoze/ui/ui_def.py,sha256=HIi_FuXDYPGh-DsbNLyRG8PHrId91ZgfKzkZtkYgH00,3866
22
22
  pycoze/utils/__init__.py,sha256=KExBkotf23dr2NfTEouWke5nJB1q2IuDXgHrmuyd95k,73
23
- pycoze/utils/arg.py,sha256=rRujm1zKc0XlnNlpIJ6JAAaFiTzDGmL_RliIpSc5OD8,724
23
+ pycoze/utils/arg.py,sha256=AhOobJNjifCf7dKKPZa7AsN7CcZg3OSECUp9TZIrDTI,748
24
24
  pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
25
- pycoze-0.1.58.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
26
- pycoze-0.1.58.dist-info/METADATA,sha256=yab-43itzAxZyXOG9n48QeDVv6ZtVy3nH-VyBqgb-2w,719
27
- pycoze-0.1.58.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
28
- pycoze-0.1.58.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
29
- pycoze-0.1.58.dist-info/RECORD,,
25
+ pycoze-0.1.60.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
26
+ pycoze-0.1.60.dist-info/METADATA,sha256=oybaShHu3kdUedwiYSkGY6dX0tttkbpbYqVkQmOt86s,719
27
+ pycoze-0.1.60.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
28
+ pycoze-0.1.60.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
29
+ pycoze-0.1.60.dist-info/RECORD,,