aient 1.1.66__tar.gz → 1.1.67__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.67}/PKG-INFO +1 -1
- {aient-1.1.66 → aient-1.1.67}/aient/models/chatgpt.py +13 -2
- {aient-1.1.66 → aient-1.1.67}/aient.egg-info/PKG-INFO +1 -1
- {aient-1.1.66 → aient-1.1.67}/pyproject.toml +1 -1
- {aient-1.1.66 → aient-1.1.67}/LICENSE +0 -0
- {aient-1.1.66 → aient-1.1.67}/README.md +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/__init__.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/core/__init__.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/core/log_config.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/core/models.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/core/request.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/core/response.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/core/test/test_base_api.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/core/test/test_geminimask.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/core/test/test_image.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/core/test/test_payload.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/core/utils.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/models/__init__.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/models/audio.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/models/base.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/__init__.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/arXiv.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/config.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/excute_command.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/get_time.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/image.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/list_directory.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/read_file.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/read_image.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/readonly.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/registry.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/run_python.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/websearch.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/plugins/write_file.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/utils/__init__.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/utils/prompt.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient/utils/scripts.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient.egg-info/SOURCES.txt +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient.egg-info/dependency_links.txt +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient.egg-info/requires.txt +0 -0
- {aient-1.1.66 → aient-1.1.67}/aient.egg-info/top_level.txt +0 -0
- {aient-1.1.66 → aient-1.1.67}/setup.cfg +0 -0
- {aient-1.1.66 → aient-1.1.67}/test/test_Web_crawler.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/test/test_ddg_search.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/test/test_google_search.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/test/test_ollama.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/test/test_plugin.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/test/test_search.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/test/test_url.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/test/test_whisper.py +0 -0
- {aient-1.1.66 → aient-1.1.67}/test/test_yjh.py +0 -0
@@ -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,12 @@ 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
|
+
else:
|
475
|
+
full_response = full_response.strip().rstrip('[done]')
|
468
476
|
full_response = full_response.replace("<tool_code>", "").replace("</tool_code>", "")
|
469
477
|
function_parameter = parse_function_xml(full_response)
|
470
478
|
if function_parameter:
|
@@ -711,7 +719,7 @@ class chatgpt(BaseLLM):
|
|
711
719
|
self.logger.info(f"api_key: {kwargs.get('api_key', self.api_key)}")
|
712
720
|
|
713
721
|
# 发送请求并处理响应
|
714
|
-
for i in range(
|
722
|
+
for i in range(10):
|
715
723
|
if self.print_log:
|
716
724
|
replaced_text = json.loads(re.sub(r';base64,([A-Za-z0-9+/=]+)', ';base64,***', json.dumps(json_post)))
|
717
725
|
replaced_text_str = json.dumps(replaced_text, indent=4, ensure_ascii=False)
|
@@ -763,6 +771,9 @@ class chatgpt(BaseLLM):
|
|
763
771
|
except httpx.RemoteProtocolError:
|
764
772
|
continue
|
765
773
|
except Exception as e:
|
774
|
+
if "Response is not ended with [done]:" in str(e):
|
775
|
+
self.logger.error(f"Response is not ended with [done]: {e}")
|
776
|
+
continue
|
766
777
|
self.logger.error(f"发生了未预料的错误:{e}")
|
767
778
|
import traceback
|
768
779
|
self.logger.error(traceback.format_exc())
|
@@ -770,7 +781,7 @@ class chatgpt(BaseLLM):
|
|
770
781
|
e = "您输入了无效的API URL,请使用正确的URL并使用`/start`命令重新设置API URL。具体错误如下:\n\n" + str(e)
|
771
782
|
raise Exception(f"{e}")
|
772
783
|
# 最后一次重试失败,向上抛出异常
|
773
|
-
if i ==
|
784
|
+
if i == 11:
|
774
785
|
raise Exception(f"{e}")
|
775
786
|
|
776
787
|
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
|
File without changes
|