aient 1.1.66__tar.gz → 1.1.68__tar.gz
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-1.1.66 → aient-1.1.68}/PKG-INFO +1 -1
- {aient-1.1.66 → aient-1.1.68}/aient/core/response.py +1 -1
- {aient-1.1.66 → aient-1.1.68}/aient/models/chatgpt.py +15 -2
- {aient-1.1.66 → aient-1.1.68}/aient.egg-info/PKG-INFO +1 -1
- {aient-1.1.66 → aient-1.1.68}/pyproject.toml +1 -1
- {aient-1.1.66 → aient-1.1.68}/LICENSE +0 -0
- {aient-1.1.66 → aient-1.1.68}/README.md +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/__init__.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/core/__init__.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/core/log_config.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/core/models.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/core/request.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/core/test/test_base_api.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/core/test/test_geminimask.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/core/test/test_image.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/core/test/test_payload.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/core/utils.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/models/__init__.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/models/audio.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/models/base.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/__init__.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/arXiv.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/config.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/excute_command.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/get_time.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/image.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/list_directory.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/read_file.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/read_image.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/readonly.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/registry.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/run_python.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/websearch.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/plugins/write_file.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/utils/__init__.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/utils/prompt.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient/utils/scripts.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient.egg-info/SOURCES.txt +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient.egg-info/dependency_links.txt +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient.egg-info/requires.txt +0 -0
- {aient-1.1.66 → aient-1.1.68}/aient.egg-info/top_level.txt +0 -0
- {aient-1.1.66 → aient-1.1.68}/setup.cfg +0 -0
- {aient-1.1.66 → aient-1.1.68}/test/test_Web_crawler.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/test/test_ddg_search.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/test/test_google_search.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/test/test_ollama.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/test/test_plugin.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/test/test_search.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/test/test_url.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/test/test_whisper.py +0 -0
- {aient-1.1.66 → aient-1.1.68}/test/test_yjh.py +0 -0
@@ -390,7 +390,7 @@ async def fetch_cloudflare_response_stream(client, url, headers, payload, model)
|
|
390
390
|
async def fetch_cohere_response_stream(client, url, headers, payload, model):
|
391
391
|
timestamp = int(datetime.timestamp(datetime.now()))
|
392
392
|
async with client.stream('POST', url, headers=headers, json=payload) as response:
|
393
|
-
error_message = await check_response(response, "
|
393
|
+
error_message = await check_response(response, "fetch_cohere_response_stream")
|
394
394
|
if error_message:
|
395
395
|
yield error_message
|
396
396
|
return
|
@@ -67,6 +67,7 @@ class chatgpt(BaseLLM):
|
|
67
67
|
cut_history_by_function_name: str = "",
|
68
68
|
cache_messages: list = None,
|
69
69
|
logger: logging.Logger = None,
|
70
|
+
check_done: bool = False,
|
70
71
|
) -> None:
|
71
72
|
"""
|
72
73
|
Initialize Chatbot with API key (from https://platform.openai.com/account/api-keys)
|
@@ -86,6 +87,7 @@ class chatgpt(BaseLLM):
|
|
86
87
|
self.function_call_max_loop = function_call_max_loop
|
87
88
|
self.cut_history_by_function_name = cut_history_by_function_name
|
88
89
|
self.latest_file_content = {}
|
90
|
+
self.check_done = check_done
|
89
91
|
|
90
92
|
if logger:
|
91
93
|
self.logger = logger
|
@@ -465,6 +467,14 @@ class chatgpt(BaseLLM):
|
|
465
467
|
missing_required_params = []
|
466
468
|
|
467
469
|
if self.use_plugins == True:
|
470
|
+
if self.check_done:
|
471
|
+
# self.logger.info(f"worker Response: {full_response}")
|
472
|
+
if not full_response.strip().endswith('[done]'):
|
473
|
+
raise Exception(f"Response is not ended with [done]: {full_response}")
|
474
|
+
elif not full_response.strip():
|
475
|
+
raise Exception(f"Response is empty")
|
476
|
+
else:
|
477
|
+
full_response = full_response.strip().rstrip('[done]')
|
468
478
|
full_response = full_response.replace("<tool_code>", "").replace("</tool_code>", "")
|
469
479
|
function_parameter = parse_function_xml(full_response)
|
470
480
|
if function_parameter:
|
@@ -711,7 +721,7 @@ class chatgpt(BaseLLM):
|
|
711
721
|
self.logger.info(f"api_key: {kwargs.get('api_key', self.api_key)}")
|
712
722
|
|
713
723
|
# 发送请求并处理响应
|
714
|
-
for i in range(
|
724
|
+
for i in range(30):
|
715
725
|
if self.print_log:
|
716
726
|
replaced_text = json.loads(re.sub(r';base64,([A-Za-z0-9+/=]+)', ';base64,***', json.dumps(json_post)))
|
717
727
|
replaced_text_str = json.dumps(replaced_text, indent=4, ensure_ascii=False)
|
@@ -763,6 +773,9 @@ class chatgpt(BaseLLM):
|
|
763
773
|
except httpx.RemoteProtocolError:
|
764
774
|
continue
|
765
775
|
except Exception as e:
|
776
|
+
if "Response is" in str(e):
|
777
|
+
self.logger.error(f"{e}")
|
778
|
+
continue
|
766
779
|
self.logger.error(f"发生了未预料的错误:{e}")
|
767
780
|
import traceback
|
768
781
|
self.logger.error(traceback.format_exc())
|
@@ -770,7 +783,7 @@ class chatgpt(BaseLLM):
|
|
770
783
|
e = "您输入了无效的API URL,请使用正确的URL并使用`/start`命令重新设置API URL。具体错误如下:\n\n" + str(e)
|
771
784
|
raise Exception(f"{e}")
|
772
785
|
# 最后一次重试失败,向上抛出异常
|
773
|
-
if i ==
|
786
|
+
if i == 11:
|
774
787
|
raise Exception(f"{e}")
|
775
788
|
|
776
789
|
def ask_stream(
|
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
|
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
|