Skip to content

Commit 1e1d83b

Browse files
committed
remove comments
1 parent dd64ba2 commit 1e1d83b

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

backend/app/api/frames.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,6 @@ async def _forward_frame_request(
157157
cache_key: str | None = None,
158158
cache_ttl: int = 1,
159159
) -> Any:
160-
"""
161-
Send HTTP-like request to the frame – first via the agent websocket (“http”
162-
command), otherwise plain HTTP. A small Redis cache (1 s default) is used
163-
for very chatty endpoints like /state.
164-
"""
165-
166-
# 0) maybe serve from cache
167160
if cache_key and (cached := await redis.get(cache_key)):
168161
return _bytes_or_json(cached)
169162

@@ -178,7 +171,6 @@ async def _forward_frame_request(
178171
else:
179172
body_for_agent = json.dumps(json_body)
180173

181-
# 1) agent first --------------------------------------------------------
182174
if await _use_agent(frame, redis):
183175
agent_resp = await http_get_on_frame(
184176
frame.id,
@@ -189,7 +181,6 @@ async def _forward_frame_request(
189181
)
190182
status, payload = _normalise_agent_response(agent_resp)
191183
if status == 200:
192-
# 2a) store in cache ───────────────────────────────────────────
193184
if cache_key:
194185
if isinstance(payload, (bytes, bytearray)):
195186
await redis.set(cache_key, payload, ex=cache_ttl)
@@ -202,7 +193,6 @@ async def _forward_frame_request(
202193

203194
raise HTTPException(status_code=400, detail=f"Agent error: {status} {payload}")
204195

205-
# 2) plain HTTP fallback -------------------------------------------------
206196
url = _build_frame_url(frame, path, method)
207197
hdrs = _auth_headers(frame)
208198
async with httpx.AsyncClient() as client:
@@ -616,13 +606,12 @@ async def api_frame_get_assets(id: int, db: Session = Depends(get_db), redis: Re
616606
raise HTTPException(status_code=HTTPStatus.NOT_FOUND, detail="Frame not found")
617607

618608
assets_path = frame.assets_path or "/srv/assets"
619-
# 1) prefer the WebSocket agent
609+
620610
if await _use_agent(frame, redis):
621611
assets = await assets_list_on_frame(frame.id, assets_path)
622612
assets.sort(key=lambda a: a["path"])
623613
return {"assets": assets}
624614

625-
# 2) legacy SSH fall-back (unchanged)
626615
ssh = await get_ssh_connection(db, redis, frame)
627616
try:
628617
cmd = f"find {assets_path} -type f -exec stat --format='%s %Y %n' {{}} +"
@@ -667,7 +656,6 @@ async def api_frame_assets_upload(
667656
):
668657
frame = db.get(Frame, id) or _not_found()
669658

670-
# normalise and validate optional sub-directory
671659
subdir = (path or "").lstrip("/")
672660
if "*" in subdir or ".." in subdir or os.path.isabs(subdir):
673661
_bad_request("Invalid character * in path")
@@ -681,7 +669,6 @@ async def api_frame_assets_upload(
681669

682670
data = await file.read()
683671

684-
# one-liner: let remote_exec decide (agent → SSH) and log appropriately
685672
await upload_file(db, redis, frame, combined_path, data)
686673

687674
rel = os.path.relpath(combined_path, assets_path)

gpt.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ patterns=(
2323
# "backend/app/api/tests/test_settings.py"
2424
"backend/app/models/agent.py"
2525
"backend/app/models/frame.py"
26+
"backend/app/models/assets.py"
2627
"backend/app/utils/ssh_utils.py"
2728
"backend/app/utils/remote_exec.py"
2829
"backend/app/tasks/*.py"

0 commit comments

Comments
 (0)