Skip to content

Commit 74b7633

Browse files
committed
chore: remove leading slash from API URLs in tool_code.py
1 parent c9fc207 commit 74b7633

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/common/utils/tool_code.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def _generate_mcp_server_code(self, _code, params, name=None, description=None):
184184

185185
func_code = ast.unparse(node)
186186
# 有些模型不支持name是中文,例如: deepseek, 其他模型未知
187-
functions.append(f"@mcp.tool(description='{description}')\n{func_code}\n")
187+
functions.append(f"@mcp.tool(description='{name} {description}')\n{func_code}\n")
188188
else:
189189
other_code.append(ast.unparse(node))
190190

@@ -240,7 +240,7 @@ def get_app_mcp_config(self, api_key, name, description):
240240
from typing import Optional
241241
242242
def _get_chat_id() -> Optional[str]:
243-
url = f"http://127.0.0.1:8080/{chat_path}/api/open"
243+
url = f"http://127.0.0.1:8080{chat_path}/api/open"
244244
headers = {{
245245
'accept': '*/*',
246246
'Authorization': f'Bearer {api_key}'
@@ -254,7 +254,7 @@ def _get_chat_id() -> Optional[str]:
254254
255255
256256
def _chat_with_ai(chat_id: str, message: str) -> Optional[str]:
257-
url = f"http://127.0.0.1:8080/{chat_path}/api/chat_message/{{chat_id}}"
257+
url = f"http://127.0.0.1:8080{chat_path}/api/chat_message/{{chat_id}}"
258258
headers = {{"Content-Type": "application/json", "Authorization": f'Bearer {api_key}'}}
259259
payload = {{
260260
"message": message,

0 commit comments

Comments
 (0)