aient 1.1.13__py3-none-any.whl → 1.1.14__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.
- aient/core/request.py +18 -4
- aient/plugins/excute_command.py +2 -1
- aient/utils/scripts.py +3 -2
- {aient-1.1.13.dist-info → aient-1.1.14.dist-info}/METADATA +1 -1
- {aient-1.1.13.dist-info → aient-1.1.14.dist-info}/RECORD +8 -8
- {aient-1.1.13.dist-info → aient-1.1.14.dist-info}/WHEEL +0 -0
- {aient-1.1.13.dist-info → aient-1.1.14.dist-info}/licenses/LICENSE +0 -0
- {aient-1.1.13.dist-info → aient-1.1.14.dist-info}/top_level.txt +0 -0
aient/core/request.py
CHANGED
@@ -241,7 +241,7 @@ async def get_gemini_payload(request, engine, provider, api_key=None):
|
|
241
241
|
if key == request.model:
|
242
242
|
for k, v in value.items():
|
243
243
|
payload[k] = v
|
244
|
-
elif all(_model not in request.model for _model in ["gemini", "gpt", "claude"]):
|
244
|
+
elif all(_model not in request.model.lower() for _model in ["gemini", "gpt", "claude"]):
|
245
245
|
payload[key] = value
|
246
246
|
|
247
247
|
return url, headers, payload
|
@@ -511,7 +511,7 @@ async def get_vertex_gemini_payload(request, engine, provider, api_key=None):
|
|
511
511
|
if key == request.model:
|
512
512
|
for k, v in value.items():
|
513
513
|
payload[k] = v
|
514
|
-
elif all(_model not in request.model for _model in ["gemini", "gpt", "claude"]):
|
514
|
+
elif all(_model not in request.model.lower() for _model in ["gemini", "gpt", "claude"]):
|
515
515
|
payload[key] = value
|
516
516
|
|
517
517
|
return url, headers, payload
|
@@ -935,6 +935,9 @@ async def get_gpt_payload(request, engine, provider, api_key=None):
|
|
935
935
|
headers['Authorization'] = f"Bearer {api_key}"
|
936
936
|
|
937
937
|
url = provider['base_url']
|
938
|
+
if "openrouter.ai" in url:
|
939
|
+
headers['HTTP-Referer'] = "https://github.com/yym68686/uni-api"
|
940
|
+
headers['X-Title'] = "Uni API"
|
938
941
|
|
939
942
|
messages = []
|
940
943
|
for msg in request.messages:
|
@@ -1055,7 +1058,7 @@ async def get_gpt_payload(request, engine, provider, api_key=None):
|
|
1055
1058
|
if key == request.model:
|
1056
1059
|
for k, v in value.items():
|
1057
1060
|
payload[k] = v
|
1058
|
-
elif all(_model not in request.model for _model in ["gemini", "gpt", "claude"]):
|
1061
|
+
elif all(_model not in request.model.lower() for _model in ["gemini", "gpt", "claude"]):
|
1059
1062
|
payload[key] = value
|
1060
1063
|
|
1061
1064
|
return url, headers, payload
|
@@ -1153,7 +1156,7 @@ async def get_azure_payload(request, engine, provider, api_key=None):
|
|
1153
1156
|
if key == request.model:
|
1154
1157
|
for k, v in value.items():
|
1155
1158
|
payload[k] = v
|
1156
|
-
elif all(_model not in request.model for _model in ["gemini", "gpt", "claude"]):
|
1159
|
+
elif all(_model not in request.model.lower() for _model in ["gemini", "gpt", "claude"]):
|
1157
1160
|
payload[key] = value
|
1158
1161
|
|
1159
1162
|
return url, headers, payload
|
@@ -1168,6 +1171,9 @@ async def get_openrouter_payload(request, engine, provider, api_key=None):
|
|
1168
1171
|
headers['Authorization'] = f"Bearer {api_key}"
|
1169
1172
|
|
1170
1173
|
url = provider['base_url']
|
1174
|
+
if "openrouter.ai" in url:
|
1175
|
+
headers['HTTP-Referer'] = "https://github.com/yym68686/uni-api"
|
1176
|
+
headers['X-Title'] = "Uni API"
|
1171
1177
|
|
1172
1178
|
messages = []
|
1173
1179
|
for msg in request.messages:
|
@@ -1215,6 +1221,14 @@ async def get_openrouter_payload(request, engine, provider, api_key=None):
|
|
1215
1221
|
if field not in miss_fields and value is not None:
|
1216
1222
|
payload[field] = value
|
1217
1223
|
|
1224
|
+
if safe_get(provider, "preferences", "post_body_parameter_overrides", default=None):
|
1225
|
+
for key, value in safe_get(provider, "preferences", "post_body_parameter_overrides", default={}).items():
|
1226
|
+
if key == request.model:
|
1227
|
+
for k, v in value.items():
|
1228
|
+
payload[k] = v
|
1229
|
+
elif all(_model not in request.model.lower() for _model in ["gemini", "gpt", "claude"]):
|
1230
|
+
payload[key] = value
|
1231
|
+
|
1218
1232
|
return url, headers, payload
|
1219
1233
|
|
1220
1234
|
async def get_cohere_payload(request, engine, provider, api_key=None):
|
aient/plugins/excute_command.py
CHANGED
@@ -172,7 +172,8 @@ def excute_command(command):
|
|
172
172
|
process.stderr.close()
|
173
173
|
|
174
174
|
new_output_lines = []
|
175
|
-
output_lines = "".join(output_lines).strip().replace("\\
|
175
|
+
output_lines = "".join(output_lines).strip().replace("\\r", "\r").replace("\\\\", "").replace("\\n", "\n").replace("\r", "+++").replace("\n", "+++")
|
176
|
+
output_lines = re.sub(r'\\u001b\[[0-9;]*[a-zA-Z]', '', output_lines)
|
176
177
|
for line in output_lines.split("+++"):
|
177
178
|
if line.strip() == "":
|
178
179
|
continue
|
aient/utils/scripts.py
CHANGED
@@ -667,7 +667,6 @@ def convert_functions_to_xml(functions_list):
|
|
667
667
|
|
668
668
|
if __name__ == "__main__":
|
669
669
|
|
670
|
-
# 运行本文件:python -m beswarm.aient.src.aient.utils.scripts
|
671
670
|
os.system("clear")
|
672
671
|
test_xml = """
|
673
672
|
✅ 好的,我现在读取 `README.md` 文件。
|
@@ -742,4 +741,6 @@ if __name__ == "__main__":
|
|
742
741
|
请提供前两个 `excute_command` 的执行结果。
|
743
742
|
"""
|
744
743
|
|
745
|
-
print(parse_function_xml(test_xml))
|
744
|
+
print(parse_function_xml(test_xml))
|
745
|
+
|
746
|
+
# 运行本文件:python -m beswarm.aient.src.aient.utils.scripts
|
@@ -4,7 +4,7 @@ aient/core/.gitignore,sha256=5JRRlYYsqt_yt6iFvvzhbqh2FTUQMqwo6WwIuFzlGR8,13
|
|
4
4
|
aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
|
5
5
|
aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
|
6
6
|
aient/core/models.py,sha256=kF-HLi1I2k_G5r153ZHuiGH8_NmpTlFMfK0_myB28YQ,7366
|
7
|
-
aient/core/request.py,sha256=
|
7
|
+
aient/core/request.py,sha256=9GbzEg7jIH8s-jXeB1gsfoOsDbwg4C6LqXvRxVTnqEs,65263
|
8
8
|
aient/core/response.py,sha256=Z0Bjl_QvpUguyky1LIcsVks4BKKqT0eYEpDmKa_cwpQ,31978
|
9
9
|
aient/core/utils.py,sha256=-naFCv8V-qhnqvDUd8BNbW1HR9CVAPxISrXoAz464Qg,26580
|
10
10
|
aient/core/test/test_base_api.py,sha256=pWnycRJbuPSXKKU9AQjWrMAX1wiLC_014Qc9hh5C2Pw,524
|
@@ -23,7 +23,7 @@ aient/models/vertex.py,sha256=qVD5l1Q538xXUPulxG4nmDjXE1VoV4yuAkTCpIeJVw0,16795
|
|
23
23
|
aient/plugins/__init__.py,sha256=p3KO6Aa3Lupos4i2SjzLQw1hzQTigOAfEHngsldrsyk,986
|
24
24
|
aient/plugins/arXiv.py,sha256=yHjb6PS3GUWazpOYRMKMzghKJlxnZ5TX8z9F6UtUVow,1461
|
25
25
|
aient/plugins/config.py,sha256=Vp6CG9ocdC_FAlCMEGtKj45xamir76DFxdJVvURNtog,6539
|
26
|
-
aient/plugins/excute_command.py,sha256=
|
26
|
+
aient/plugins/excute_command.py,sha256=huQSbNbeImV8BUIsQKE13BIhCAMr7aYRyXO4saE1dTI,10534
|
27
27
|
aient/plugins/get_time.py,sha256=Ih5XIW5SDAIhrZ9W4Qe5Hs1k4ieKPUc_LAd6ySNyqZk,654
|
28
28
|
aient/plugins/image.py,sha256=ZElCIaZznE06TN9xW3DrSukS7U3A5_cjk1Jge4NzPxw,2072
|
29
29
|
aient/plugins/list_directory.py,sha256=JZVuImecMSfEv6jLqii-0uQJ1UCsrpMNmYlwW3PEDg4,1374
|
@@ -37,9 +37,9 @@ aient/prompt/__init__.py,sha256=GBtn6-JDT8KHFCcuPpfSNE_aGddg5p4FEyMCy4BfwGs,20
|
|
37
37
|
aient/prompt/agent.py,sha256=y2GETN6ScC5yQVs75VFfzm4YUWzblbqLYz0Sy6JnPRw,24950
|
38
38
|
aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
39
|
aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
|
40
|
-
aient/utils/scripts.py,sha256=
|
41
|
-
aient-1.1.
|
42
|
-
aient-1.1.
|
43
|
-
aient-1.1.
|
44
|
-
aient-1.1.
|
45
|
-
aient-1.1.
|
40
|
+
aient/utils/scripts.py,sha256=LD8adnfuRrJoY2tWKseXOPJXaxbrUmz4czsnUvHswNY,29096
|
41
|
+
aient-1.1.14.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
|
42
|
+
aient-1.1.14.dist-info/METADATA,sha256=Cm2dAAwtu6XxjyHCXOgzNRRRdbQAC2iVeCFfJxLM3Wg,4968
|
43
|
+
aient-1.1.14.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
44
|
+
aient-1.1.14.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
|
45
|
+
aient-1.1.14.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|