beswarm 0.2.54__tar.gz → 0.2.56__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.
- {beswarm-0.2.54 → beswarm-0.2.56}/PKG-INFO +1 -1
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/agents/planact.py +15 -9
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/core/request.py +21 -18
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/core/response.py +1 -1
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/models/chatgpt.py +18 -2
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/prompt.py +5 -4
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm.egg-info/PKG-INFO +1 -1
- {beswarm-0.2.54 → beswarm-0.2.56}/pyproject.toml +1 -1
- {beswarm-0.2.54 → beswarm-0.2.56}/MANIFEST.in +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/README.md +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/__init__.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/agents/chatgroup.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/__init__.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/core/__init__.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/core/log_config.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/core/models.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/core/test/test_base_api.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/core/test/test_geminimask.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/core/test/test_image.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/core/test/test_payload.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/core/utils.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/models/__init__.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/models/audio.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/models/base.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/__init__.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/arXiv.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/config.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/excute_command.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/get_time.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/image.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/list_directory.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/read_file.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/read_image.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/readonly.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/registry.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/run_python.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/websearch.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/plugins/write_file.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/utils/__init__.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/utils/prompt.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/aient/utils/scripts.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/test/test_Web_crawler.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/test/test_ddg_search.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/test/test_google_search.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/test/test_ollama.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/test/test_plugin.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/test/test_search.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/test/test_url.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/test/test_whisper.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/aient/test/test_yjh.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/bemcp/bemcp/__init__.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/bemcp/bemcp/decorator.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/bemcp/bemcp/main.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/bemcp/bemcp/utils.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/bemcp/test/client.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/bemcp/test/server.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/broker.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/core.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/knowledge_graph.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/README.md +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/arduino-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/c-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/chatito-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/commonlisp-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/cpp-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/csharp-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/d-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/dart-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/elisp-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/elixir-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/elm-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/gleam-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/go-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/java-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/javascript-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/lua-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/pony-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/properties-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/python-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/r-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/racket-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/ruby-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/rust-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/solidity-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/swift-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/udev-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/README.md +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/c-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/c_sharp-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/cpp-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/dart-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/elisp-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/elixir-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/elm-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/go-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/hcl-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/java-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/javascript-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/kotlin-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/ocaml-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/php-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/python-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/ql-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/ruby-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/rust-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/scala-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-languages/typescript-tags.scm +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/taskmanager.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/__init__.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/click.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/completion.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/edit_file.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/graph.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/planner.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/repomap.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/request_input.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/screenshot.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/search_arxiv.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/search_web.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/subtasks.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/worker.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/tools/write_csv.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm/utils.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm.egg-info/SOURCES.txt +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm.egg-info/dependency_links.txt +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm.egg-info/requires.txt +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/beswarm.egg-info/top_level.txt +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/setup.cfg +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/test/test_TaskManager.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/test/test_broker.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/test/test_graph.py +0 -0
- {beswarm-0.2.54 → beswarm-0.2.56}/test/test_new_TaskManager.py +0 -0
@@ -95,15 +95,17 @@ class InstructionAgent(BaseAgent):
|
|
95
95
|
conversation_history[0]["content"].append({"type": "text", "text": extracted_content})
|
96
96
|
|
97
97
|
for message in conversation_history:
|
98
|
-
if message.get("content") and isinstance(message["content"], str)
|
99
|
-
|
100
|
-
|
98
|
+
if message.get("content") and isinstance(message["content"], str):
|
99
|
+
if "<knowledge_graph_tree>" in message["content"] and self.graph_tree:
|
100
|
+
message["content"] = replace_xml_content(message["content"], "knowledge_graph_tree", self.graph_tree)
|
101
101
|
|
102
102
|
for index, message in enumerate(raw_conversation_history):
|
103
|
-
if message.get("content") and isinstance(message["content"], str)
|
104
|
-
|
105
|
-
|
106
|
-
|
103
|
+
if message.get("content") and isinstance(message["content"], str):
|
104
|
+
if "<knowledge_graph_tree>" in message["content"] and self.graph_tree:
|
105
|
+
message["content"] = replace_xml_content(message["content"], "knowledge_graph_tree", self.graph_tree)
|
106
|
+
raw_conversation_history[index] = message
|
107
|
+
if "\n\nYour message **must** end with [done] to signify the end of your output." in message["content"]:
|
108
|
+
message["content"] = message["content"].replace("\n\nYour message **must** end with [done] to signify the end of your output.", "")
|
107
109
|
|
108
110
|
return conversation_history
|
109
111
|
|
@@ -166,7 +168,7 @@ class InstructionAgent(BaseAgent):
|
|
166
168
|
"现在开始执行第一步:\n"
|
167
169
|
f"{instruction}"
|
168
170
|
)
|
169
|
-
self.broker.publish({"instruction": instruction, "conversation": message["conversation"]}, self.publish_topic)
|
171
|
+
self.broker.publish({"instruction": instruction + "\n\nYour message **must** end with [done] to signify the end of your output.", "conversation": message["conversation"]}, self.publish_topic)
|
170
172
|
self.last_instruction = None
|
171
173
|
else:
|
172
174
|
self.logger.error("\n❌ 指令智能体生成的指令不符合要求,正在重新生成。")
|
@@ -208,6 +210,9 @@ class WorkerAgent(BaseAgent):
|
|
208
210
|
if response.strip() == '':
|
209
211
|
self.logger.error("\n❌ 工作智能体回复为空,请重新生成指令。")
|
210
212
|
self.broker.publish(message, self.error_topic)
|
213
|
+
elif "HTTP Error', 'status_code': 524" in response:
|
214
|
+
self.logger.error("\n❌ 工作智能体回复超时 100 秒,请重新生成指令。")
|
215
|
+
self.broker.publish(message, self.error_topic)
|
211
216
|
else:
|
212
217
|
self.broker.publish({"status": "new_message", "result": "\n✅ 工作智能体:\n" + response}, self.status_topic)
|
213
218
|
self.broker.publish({
|
@@ -301,7 +306,8 @@ class BrokerWorker:
|
|
301
306
|
shell=os.getenv('SHELL', 'Unknown'), current_time=datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
302
307
|
tools_list=self.tools_json
|
303
308
|
),
|
304
|
-
"print_log": True, "temperature": 0.5, "function_call_max_loop": 100, "logger": self.logger
|
309
|
+
"print_log": True, "temperature": 0.5, "function_call_max_loop": 100, "logger": self.logger,
|
310
|
+
"check_done": True
|
305
311
|
}
|
306
312
|
|
307
313
|
instruction_agent = InstructionAgent(
|
@@ -27,8 +27,6 @@ from .utils import (
|
|
27
27
|
gemini_max_token_65k_models = ["gemini-2.5-pro", "gemini-2.0-pro", "gemini-2.0-flash-thinking", "gemini-2.5-flash"]
|
28
28
|
|
29
29
|
async def get_gemini_payload(request, engine, provider, api_key=None):
|
30
|
-
import re
|
31
|
-
|
32
30
|
headers = {
|
33
31
|
'Content-Type': 'application/json'
|
34
32
|
}
|
@@ -176,6 +174,24 @@ async def get_gemini_payload(request, engine, provider, api_key=None):
|
|
176
174
|
]
|
177
175
|
generation_config = {}
|
178
176
|
|
177
|
+
def process_tool_parameters(data):
|
178
|
+
if isinstance(data, dict):
|
179
|
+
# 移除 Gemini 不支持的 'additionalProperties'
|
180
|
+
data.pop("additionalProperties", None)
|
181
|
+
|
182
|
+
# 将 'default' 值移入 'description'
|
183
|
+
if "default" in data:
|
184
|
+
default_value = data.pop("default")
|
185
|
+
description = data.get("description", "")
|
186
|
+
data["description"] = f"{description}\nDefault: {default_value}"
|
187
|
+
|
188
|
+
# 递归处理
|
189
|
+
for value in data.values():
|
190
|
+
process_tool_parameters(value)
|
191
|
+
elif isinstance(data, list):
|
192
|
+
for item in data:
|
193
|
+
process_tool_parameters(item)
|
194
|
+
|
179
195
|
for field, value in request.model_dump(exclude_unset=True).items():
|
180
196
|
if field not in miss_fields and value is not None:
|
181
197
|
if field == "tools" and "gemini-2.0-flash-thinking" in original_model:
|
@@ -185,22 +201,9 @@ async def get_gemini_payload(request, engine, provider, api_key=None):
|
|
185
201
|
processed_tools = []
|
186
202
|
for tool in value:
|
187
203
|
function_def = tool["function"]
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
# 处理 parameters.properties 中的 default 字段
|
193
|
-
if safe_get(function_def, "parameters", "properties", default=None):
|
194
|
-
for prop_value in function_def["parameters"]["properties"].values():
|
195
|
-
if "additionalProperties" in prop_value:
|
196
|
-
del prop_value["additionalProperties"]
|
197
|
-
if "default" in prop_value:
|
198
|
-
# 将 default 值添加到 description 中
|
199
|
-
default_value = prop_value["default"]
|
200
|
-
description = prop_value.get("description", "")
|
201
|
-
prop_value["description"] = f"{description}\nDefault: {default_value}"
|
202
|
-
# 删除 default 字段
|
203
|
-
del prop_value["default"]
|
204
|
+
if "parameters" in function_def:
|
205
|
+
process_tool_parameters(function_def["parameters"])
|
206
|
+
|
204
207
|
if function_def["name"] != "googleSearch" and function_def["name"] != "googleSearch":
|
205
208
|
processed_tools.append({"function": function_def})
|
206
209
|
|
@@ -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:
|
@@ -627,6 +637,9 @@ class chatgpt(BaseLLM):
|
|
627
637
|
else:
|
628
638
|
all_responses.append(f"[{tool_name}({tool_args}) Result]:\n\n{tool_response}")
|
629
639
|
|
640
|
+
if self.check_done:
|
641
|
+
all_responses.append("Your message **must** end with [done] to signify the end of your output.")
|
642
|
+
|
630
643
|
# 合并所有工具响应
|
631
644
|
function_response = "\n\n".join(all_responses).strip()
|
632
645
|
if missing_required_params:
|
@@ -711,7 +724,7 @@ class chatgpt(BaseLLM):
|
|
711
724
|
self.logger.info(f"api_key: {kwargs.get('api_key', self.api_key)}")
|
712
725
|
|
713
726
|
# 发送请求并处理响应
|
714
|
-
for i in range(
|
727
|
+
for i in range(30):
|
715
728
|
if self.print_log:
|
716
729
|
replaced_text = json.loads(re.sub(r';base64,([A-Za-z0-9+/=]+)', ';base64,***', json.dumps(json_post)))
|
717
730
|
replaced_text_str = json.dumps(replaced_text, indent=4, ensure_ascii=False)
|
@@ -763,6 +776,9 @@ class chatgpt(BaseLLM):
|
|
763
776
|
except httpx.RemoteProtocolError:
|
764
777
|
continue
|
765
778
|
except Exception as e:
|
779
|
+
if "Response is" in str(e):
|
780
|
+
self.logger.error(f"{e}")
|
781
|
+
continue
|
766
782
|
self.logger.error(f"发生了未预料的错误:{e}")
|
767
783
|
import traceback
|
768
784
|
self.logger.error(traceback.format_exc())
|
@@ -770,7 +786,7 @@ class chatgpt(BaseLLM):
|
|
770
786
|
e = "您输入了无效的API URL,请使用正确的URL并使用`/start`命令重新设置API URL。具体错误如下:\n\n" + str(e)
|
771
787
|
raise Exception(f"{e}")
|
772
788
|
# 最后一次重试失败,向上抛出异常
|
773
|
-
if i ==
|
789
|
+
if i == 11:
|
774
790
|
raise Exception(f"{e}")
|
775
791
|
|
776
792
|
def ask_stream(
|
@@ -1,10 +1,11 @@
|
|
1
1
|
worker_system_prompt = """
|
2
2
|
<communication>
|
3
3
|
1. Format your responses in markdown. Use backticks to format file, directory, function, and class names.
|
4
|
-
2.
|
5
|
-
3.
|
6
|
-
4.
|
7
|
-
5.
|
4
|
+
2. Your message **must** end with [done] to signify the end of your output.
|
5
|
+
3. Always respond in 中文。
|
6
|
+
4. **执行规则:** 尽力满足 user 的请求,如果 user 要求你使用工具,请自行根据工具的参数要求,组织参数,将工具调用组织成 XML 格式,即可触发工具执行流程。当 user 的指令中包含一个或多个完整的 XML 工具调用时,你的唯一且首要任务就是**完整、准确、无修改地**复述这些 XML 代码块。这是执行工具的**唯一**方式。严禁在没有复述 XML 的情况下,就声称或暗示任务已完成。
|
7
|
+
5. **生成规则:** 你拥有完全的工具调用自主权,也因此负有完全的责任。你必须亲自执行所有工具调用,绝对禁止以任何形式指示、请求或暗示user为你调用工具。当你需要调用工具(无论是根据 user 的自然语言指令,还是自己决定)时,你都**必须**在你的回复中生成格式完全正确的 XML 工具调用代码。你是操作的**执行者**,不是任务的**确认者**。这是一个强制性规则,任何情况下都不能违反。
|
8
|
+
6. **核心工作循环:单步执行模式**
|
8
9
|
作为指令的**执行者**,而非任务的**规划师**,你必须严格遵循以下单步工作流程:
|
9
10
|
**执行指令**
|
10
11
|
- **严格遵从:** 只执行 user 当前下达的明确指令。在 user 明确给出下一步指令前,绝不擅自行动或推测、执行任何未明确要求的后续步骤。
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/arduino-tags.scm
RENAMED
File without changes
|
File without changes
|
{beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/chatito-tags.scm
RENAMED
File without changes
|
{beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/commonlisp-tags.scm
RENAMED
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
|
{beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/javascript-tags.scm
RENAMED
File without changes
|
File without changes
|
File without changes
|
{beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/properties-tags.scm
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{beswarm-0.2.54 → beswarm-0.2.56}/beswarm/queries/tree-sitter-language-pack/solidity-tags.scm
RENAMED
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
|
File without changes
|
File without changes
|