gomyck-tools 1.3.9__py3-none-any.whl → 1.4.0__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.
- ctools/ai/env_config.py +14 -5
- ctools/ai/tools/quick_tools.py +3 -2
- {gomyck_tools-1.3.9.dist-info → gomyck_tools-1.4.0.dist-info}/METADATA +1 -1
- {gomyck_tools-1.3.9.dist-info → gomyck_tools-1.4.0.dist-info}/RECORD +7 -7
- {gomyck_tools-1.3.9.dist-info → gomyck_tools-1.4.0.dist-info}/WHEEL +0 -0
- {gomyck_tools-1.3.9.dist-info → gomyck_tools-1.4.0.dist-info}/licenses/LICENSE +0 -0
- {gomyck_tools-1.3.9.dist-info → gomyck_tools-1.4.0.dist-info}/top_level.txt +0 -0
ctools/ai/env_config.py
CHANGED
@@ -5,7 +5,7 @@ __date__ = '2025/5/16 16:42'
|
|
5
5
|
|
6
6
|
import json
|
7
7
|
import os
|
8
|
-
from typing import Any
|
8
|
+
from typing import Any, Optional
|
9
9
|
|
10
10
|
from dotenv.main import DotEnv
|
11
11
|
|
@@ -18,11 +18,20 @@ class Configuration:
|
|
18
18
|
if not os.path.exists(dotenv_path): raise FileNotFoundError(f"Could not find .env file at {dotenv_path}")
|
19
19
|
self.env = DotEnv(dotenv_path=dotenv_path)
|
20
20
|
|
21
|
-
def get_env(self, key: str) ->
|
21
|
+
def get_env(self, key: str, default: Optional[Any] = None) -> Any:
|
22
22
|
value = self.env.get(key)
|
23
|
-
if value
|
24
|
-
|
25
|
-
|
23
|
+
if value:
|
24
|
+
val = value.strip().lower()
|
25
|
+
if val == "true": return True
|
26
|
+
if val == "false": return False
|
27
|
+
return value
|
28
|
+
value = os.getenv(key)
|
29
|
+
if value:
|
30
|
+
val = value.strip().lower()
|
31
|
+
if val == "true": return True
|
32
|
+
if val == "false": return False
|
33
|
+
return value
|
34
|
+
return default
|
26
35
|
|
27
36
|
def get_llm_api_key(self) -> str:
|
28
37
|
api_key = self.get_env("LLM_API_KEY")
|
ctools/ai/tools/quick_tools.py
CHANGED
@@ -5,6 +5,7 @@ __date__ = '2025/6/9 09:49'
|
|
5
5
|
|
6
6
|
import asyncio
|
7
7
|
import json
|
8
|
+
import os
|
8
9
|
import sys
|
9
10
|
import uuid
|
10
11
|
|
@@ -38,10 +39,10 @@ def build_call_back(debug=False):
|
|
38
39
|
call_id = uuid.uuid4()
|
39
40
|
queue = asyncio.Queue()
|
40
41
|
async def on_msg(cid, role, msg):
|
41
|
-
if debug: print(msg, file=sys.__stdout__, end='')
|
42
|
+
if debug: print(msg, file=sys.__stdout__, end='', flush=True)
|
42
43
|
await queue.put({"id": cid, "role": role, "msg": msg})
|
43
44
|
async def on_final(cid, is_final, msg):
|
44
|
-
if debug: print(cid, is_final, msg, file=sys.__stdout__)
|
45
|
+
if debug: print(cid, is_final, msg, file=sys.__stdout__, flush=True)
|
45
46
|
if is_final:
|
46
47
|
await queue.put("[DONE]")
|
47
48
|
else:
|
@@ -14,7 +14,7 @@ ctools/similar.py,sha256=7mBbp7JrGGyAgA_hDmCvGJ6hGE1Lh43ocyqPkLGclyc,695
|
|
14
14
|
ctools/sys_info.py,sha256=T5pcRblNHEmXEvPk2PPvQga7Hh5aDnNN72pt4U176SE,4270
|
15
15
|
ctools/sys_log.py,sha256=T-tgOcrFggSJ2I6pLHhKpj4fvVFk_vbZBOrInKC6y3Q,2789
|
16
16
|
ctools/ai/__init__.py,sha256=gTYAICILq48icnFbg0HCbsQO8PbU02EDOQ0JeMvfqTY,98
|
17
|
-
ctools/ai/env_config.py,sha256=
|
17
|
+
ctools/ai/env_config.py,sha256=jBZxeKLNvEPcN7jbS2PYHXiPrxLMCc2SWMAbqO2UuoE,1313
|
18
18
|
ctools/ai/llm_chat.py,sha256=dAFar0A5h3ws_kjx9MlWZAawLPYHIwvfdyO_umJgkpU,8655
|
19
19
|
ctools/ai/llm_client.py,sha256=iI8kUPn8z0pgTq8mTwnIJm9bOREmSZU5btePinmgGpg,5515
|
20
20
|
ctools/ai/llm_exception.py,sha256=wsCVl0m53Mk7Xfug1obocAthlX0oEo4dytg1eOhWHPg,389
|
@@ -22,7 +22,7 @@ ctools/ai/mcp/__init__.py,sha256=gTYAICILq48icnFbg0HCbsQO8PbU02EDOQ0JeMvfqTY,98
|
|
22
22
|
ctools/ai/mcp/mcp_client.py,sha256=eDxiG6ZHa4HX-Sz63ObmxyXIq2WZwUxQt8fSw9COfGc,11589
|
23
23
|
ctools/ai/tools/__init__.py,sha256=gPc-ViRgtFlfX7JUbk5wQZ3wkJ5Ylh14CIqPwa83VPs,98
|
24
24
|
ctools/ai/tools/json_extract.py,sha256=bgubZ2RwTo_R1X0CzMnvBWu61hglB1l6oO553645RXc,4842
|
25
|
-
ctools/ai/tools/quick_tools.py,sha256=
|
25
|
+
ctools/ai/tools/quick_tools.py,sha256=WeUFDLLHrP6PCs1pM3G_hRS2YSTp5XjCrJ077u06jeo,2369
|
26
26
|
ctools/ai/tools/think_process.py,sha256=RGU9j3_O328Byw05ILek-aMfFBczbly2RA-QRouqUjM,257
|
27
27
|
ctools/ai/tools/tool_use_xml_parse.py,sha256=zpHKMhU5LFSpuznU_Z5w_HHp-Bney-Te8DxoU1BNHZ0,1429
|
28
28
|
ctools/ai/tools/xml_extract.py,sha256=lpUTERzUQhbiWanc5_ukBP0wPIVg0F9va39S36yyI-4,231
|
@@ -75,8 +75,8 @@ ctools/web/ctoken.py,sha256=CdHm6-ykBLh7Lv8ZRMunSW40qMTkRH0ITeMLuG9z1ts,883
|
|
75
75
|
ctools/web/download_util.py,sha256=EVN3fxwbUE5Q8nurAya5IYialIKBMoFtSOy0uPKyV-E,1951
|
76
76
|
ctools/web/params_util.py,sha256=2vAuwn8OPydv_7BPKypqk4zuerPZqOGcf95wV19H1Ks,824
|
77
77
|
ctools/web/upload_util.py,sha256=xH4Z-sz-s7EVDEz2gKXoP9OZTLc-er5yvsiLqhSDFm8,1076
|
78
|
-
gomyck_tools-1.
|
79
|
-
gomyck_tools-1.
|
80
|
-
gomyck_tools-1.
|
81
|
-
gomyck_tools-1.
|
82
|
-
gomyck_tools-1.
|
78
|
+
gomyck_tools-1.4.0.dist-info/licenses/LICENSE,sha256=X25ypfH9E6VTht2hcO8k7LCSdHUcoG_ALQt80jdYZfY,547
|
79
|
+
gomyck_tools-1.4.0.dist-info/METADATA,sha256=cRhMg8qcxTte7Uy7g8kZAFb9cmaoJR882y5XO5mcqBM,1595
|
80
|
+
gomyck_tools-1.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
81
|
+
gomyck_tools-1.4.0.dist-info/top_level.txt,sha256=-MiIH9FYRVKp1i5_SVRkaI-71WmF1sZSRrNWFU9ls3s,7
|
82
|
+
gomyck_tools-1.4.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|