Update gitea/dev.py
This commit is contained in:
@@ -6,6 +6,8 @@ license: MIT
|
|||||||
description: Interact with Gitea repositories - native tool calling optimized for high-tier LLMs with robust error handling
|
description: Interact with Gitea repositories - native tool calling optimized for high-tier LLMs with robust error handling
|
||||||
requirements: pydantic, httpx
|
requirements: pydantic, httpx
|
||||||
changelog:
|
changelog:
|
||||||
|
1.4.2:
|
||||||
|
- Fixed renamed update_file to replace file, as update implied diff
|
||||||
1.4.1:
|
1.4.1:
|
||||||
- Fixed redundant __user__ checks in _get_token, _get_repo, _get_branch, _get_org
|
- Fixed redundant __user__ checks in _get_token, _get_repo, _get_branch, _get_org
|
||||||
- Fixed merge_pull_request: proper conflict detection, merged status check, and empty response handling
|
- Fixed merge_pull_request: proper conflict detection, merged status check, and empty response handling
|
||||||
@@ -555,7 +557,7 @@ class Tools:
|
|||||||
f"Error: Unexpected failure during file fetch: {type(e).__name__}: {e}"
|
f"Error: Unexpected failure during file fetch: {type(e).__name__}: {e}"
|
||||||
)
|
)
|
||||||
|
|
||||||
async def update_file(
|
async def replace_file(
|
||||||
self,
|
self,
|
||||||
path: str,
|
path: str,
|
||||||
content: str,
|
content: str,
|
||||||
@@ -738,7 +740,7 @@ class Tools:
|
|||||||
except httpx.HTTPStatusError as e:
|
except httpx.HTTPStatusError as e:
|
||||||
error_msg = self._format_error(e, f"file creation for '{path}'")
|
error_msg = self._format_error(e, f"file creation for '{path}'")
|
||||||
if e.response.status_code == 422:
|
if e.response.status_code == 422:
|
||||||
return f"Error: File already exists: `{path}`. Use `update_file()` to modify it instead."
|
return f"Error: File already exists: `{path}`. Use `replace_file()` to modify it instead."
|
||||||
return f"Error: Failed to create file. {error_msg}"
|
return f"Error: Failed to create file. {error_msg}"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return f"Error: Unexpected failure during file creation: {type(e).__name__}: {e}"
|
return f"Error: Unexpected failure during file creation: {type(e).__name__}: {e}"
|
||||||
|
|||||||
Reference in New Issue
Block a user