pro-craft 0.1.36__py3-none-any.whl → 0.1.37__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.
Potentially problematic release.
This version of pro-craft might be problematic. Click here for more details.
- pro_craft/log.py +1 -1
- pro_craft/prompt_craft/async_.py +20 -23
- {pro_craft-0.1.36.dist-info → pro_craft-0.1.37.dist-info}/METADATA +1 -1
- {pro_craft-0.1.36.dist-info → pro_craft-0.1.37.dist-info}/RECORD +6 -6
- {pro_craft-0.1.36.dist-info → pro_craft-0.1.37.dist-info}/WHEEL +0 -0
- {pro_craft-0.1.36.dist-info → pro_craft-0.1.37.dist-info}/top_level.txt +0 -0
pro_craft/log.py
CHANGED
|
@@ -12,7 +12,7 @@ class Log:
|
|
|
12
12
|
def __init__(self, console_level = logging.INFO, log_file_name="app.log"):
|
|
13
13
|
self.Console_LOG_LEVEL = console_level
|
|
14
14
|
self.log_file_name = log_file_name
|
|
15
|
-
os.makedirs("logs", exist_ok=
|
|
15
|
+
os.makedirs("logs", exist_ok=True)
|
|
16
16
|
self.LOG_FILE_PATH = os.path.join("logs", log_file_name)
|
|
17
17
|
self.logger = self.get_logger()
|
|
18
18
|
self.super_log_level = self.logger.critical
|
pro_craft/prompt_craft/async_.py
CHANGED
|
@@ -364,7 +364,7 @@ class AsyncIntel():
|
|
|
364
364
|
session = session)
|
|
365
365
|
for use_case_old in use_cases:
|
|
366
366
|
if use_case == use_case_old.use_case:
|
|
367
|
-
print("用例已经存在")
|
|
367
|
+
# print("用例已经存在")
|
|
368
368
|
return
|
|
369
369
|
|
|
370
370
|
use_case = UseCase(prompt_id=prompt_id,
|
|
@@ -654,36 +654,34 @@ class AsyncIntel():
|
|
|
654
654
|
version=version,
|
|
655
655
|
inference_save_case=inference_save_case,
|
|
656
656
|
)
|
|
657
|
-
|
|
658
|
-
try:
|
|
659
|
-
json_str = extract_(ai_result,r'json')
|
|
660
|
-
ai_result = json.loads(json_str)
|
|
661
|
-
if OutputFormat:
|
|
662
|
-
OutputFormat(**ai_result)
|
|
663
|
-
|
|
664
|
-
except JSONDecodeError as e:
|
|
657
|
+
if OutputFormat:
|
|
665
658
|
try:
|
|
666
|
-
|
|
667
|
-
json_str = fix_broken_json_string(json_str)
|
|
659
|
+
json_str = extract_(ai_result,r'json')
|
|
668
660
|
ai_result = json.loads(json_str)
|
|
669
|
-
|
|
670
|
-
OutputFormat(**ai_result)
|
|
661
|
+
OutputFormat(**ai_result)
|
|
671
662
|
|
|
672
663
|
except JSONDecodeError as e:
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
664
|
+
try:
|
|
665
|
+
self.logger.error(f"尝试补救")
|
|
666
|
+
json_str = fix_broken_json_string(json_str)
|
|
667
|
+
ai_result = json.loads(json_str)
|
|
668
|
+
OutputFormat(**ai_result)
|
|
678
669
|
|
|
679
|
-
|
|
680
|
-
|
|
670
|
+
except JSONDecodeError as e:
|
|
671
|
+
raise IntellectRemoveFormatError(f"prompt_id: {prompt_id} 生成的内容为无法被Json解析 {e}") from e
|
|
672
|
+
|
|
673
|
+
except ValidationError as e:
|
|
674
|
+
err_info = e.errors()[0]
|
|
675
|
+
raise IntellectRemoveFormatError(f"{err_info["type"]}: 属性:{err_info['loc']}, 发生了如下错误: {err_info['msg']}, 格式校验失败, 当前输入为: {err_info['input']} 请检查") from e
|
|
676
|
+
|
|
677
|
+
except Exception as e:
|
|
678
|
+
raise Exception(f"Error {prompt_id} : {e}") from e
|
|
681
679
|
|
|
682
680
|
return ai_result
|
|
683
681
|
|
|
684
682
|
async def intellect_formats(self,
|
|
685
683
|
input_datas: list[dict | str],
|
|
686
|
-
OutputFormat: object,
|
|
684
|
+
OutputFormat: object | None,
|
|
687
685
|
prompt_id: str,
|
|
688
686
|
ExtraFormats: list[object] = [],
|
|
689
687
|
version: str = None,
|
|
@@ -719,8 +717,7 @@ class AsyncIntel():
|
|
|
719
717
|
# 修改逻辑
|
|
720
718
|
assert kwargs.get('input_data') # 要求一定要有data入参
|
|
721
719
|
input_data = kwargs.get('input_data')
|
|
722
|
-
|
|
723
|
-
OutputFormat = kwargs.get('OutputFormat')
|
|
720
|
+
OutputFormat = kwargs.get('OutputFormat','')
|
|
724
721
|
|
|
725
722
|
if isinstance(input_data,dict):
|
|
726
723
|
input_ = output_ = json.dumps(input_data,ensure_ascii=False)
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
pro_craft/__init__.py,sha256=CkERhdDQyrPWpOb5nArMt2UCcX8STJLF7JC2x7yTBYM,515
|
|
2
2
|
pro_craft/database.py,sha256=cbUcy4_e9RgcDVBNMvERNmTv_pZWgd4ox4a4drBWS6w,9310
|
|
3
3
|
pro_craft/file_manager.py,sha256=abVAlJ07_egWNuTj4JiP4me8NloQrsXGNd-SP63ab94,3738
|
|
4
|
-
pro_craft/log.py,sha256=
|
|
4
|
+
pro_craft/log.py,sha256=Ft5pKvdmNeXg7BPtc1H8vBi5r6p0vyKP5X_HVEEwE8U,3261
|
|
5
5
|
pro_craft/utils.py,sha256=R1DFkS4dsm5dIhg8lLTgBBvItvIYyyojROdh-ykqiYk,5250
|
|
6
6
|
pro_craft/code_helper/coder.py,sha256=L6pRQr0pYRIHrMFZ4-pO_tZf1koxgGgF3L7Vl-GIyjM,24687
|
|
7
7
|
pro_craft/code_helper/designer.py,sha256=3gyCqrjcw61sHzDjUPKhL1LOAE8xWLLbNT8NlK2mFLc,4739
|
|
8
8
|
pro_craft/prompt_craft/__init__.py,sha256=83ruWO1Oci-DWvdVhPqcQrgdZTNfbmK72VQCkWASk7A,80
|
|
9
|
-
pro_craft/prompt_craft/async_.py,sha256=
|
|
9
|
+
pro_craft/prompt_craft/async_.py,sha256=orxKDtxZSrx3uqHCOijqFcX2-436Cz2eakG03m33C9M,40426
|
|
10
10
|
pro_craft/prompt_craft/new.py,sha256=ULjGGl95vmHrOs7XECJGlaqj1NE9BypE5WnFYhGugRY,25903
|
|
11
11
|
pro_craft/prompt_craft/sync.py,sha256=4bms8Qvzq5QqgwHWwiyjrcl7hdkSqE7Kne5s3Ex8bBU,26217
|
|
12
12
|
pro_craft/server/mcp/__init__.py,sha256=4dbl-lFcm0r2tkOP04OxqiZG2jR-rqF181qi2AfU6UA,123
|
|
13
13
|
pro_craft/server/mcp/prompt.py,sha256=OZrsyUfSQMOY_KX7dWthW209adz5JfELsQ0ODfuQR44,1245
|
|
14
14
|
pro_craft/server/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
pro_craft/server/router/prompt.py,sha256=Wa4FfYRL6oeyA3F-79pmPeIH0Vo8wSEv7RH1lP6jXck,2907
|
|
16
|
-
pro_craft-0.1.
|
|
17
|
-
pro_craft-0.1.
|
|
18
|
-
pro_craft-0.1.
|
|
19
|
-
pro_craft-0.1.
|
|
16
|
+
pro_craft-0.1.37.dist-info/METADATA,sha256=r2xyJiA_x6zoAv-GhhXVi6IG-V-Vt_YOJkpuN7Du-l0,1718
|
|
17
|
+
pro_craft-0.1.37.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
18
|
+
pro_craft-0.1.37.dist-info/top_level.txt,sha256=yqYDHArnYMWpeCxkmGRwlL6sJtxiOUnYylLDx9EOgFg,10
|
|
19
|
+
pro_craft-0.1.37.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|