Compare commits

...

2 Commits

Author SHA1 Message Date
sp.wack
f2902d0407 Update openhands/server/routes/files.py 2025-05-12 18:49:16 +04:00
openhands
960dff71ad Fix git changes endpoint response model to match actual return type 2025-05-09 22:54:23 +00:00

View File

@@ -226,7 +226,7 @@ def zip_current_workspace(request: Request) -> FileResponse | JSONResponse:
@app.get(
'/git/changes',
response_model=dict[str, Any],
response_model=dict[str, list[dict[str, str]]],
responses={
404: {'description': 'Not a git repository', 'model': dict},
500: {'description': 'Error getting changes', 'model': dict},
@@ -236,7 +236,7 @@ async def git_changes(
request: Request,
conversation_id: str,
user_id: str = Depends(get_user_id),
) -> dict[str, Any] | JSONResponse:
) -> dict[str, list[dict[str, str]]] | JSONResponse:
runtime: Runtime = request.state.conversation.runtime
conversation_store = await ConversationStoreImpl.get_instance(
config,
@@ -257,6 +257,7 @@ async def git_changes(
status_code=404,
content={'error': 'Not a git repository'},
)
# Wrap the list in a dictionary to match the response_model
return changes
except AgentRuntimeUnavailableError as e:
logger.error(f'Runtime unavailable: {e}')