mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(copilot): Address new review comments
- Guard metadata store() with try/except so failure doesn't orphan the already-uploaded transcript (coderabbit Major) - Fix OrbitLoader size from 20 to 14 to match static icons - Filter output.files to confirmed strings instead of unchecked cast
This commit is contained in:
@@ -374,14 +374,20 @@ async def upload_transcript(
|
||||
|
||||
# Store metadata alongside the transcript so the next turn can detect
|
||||
# staleness and only compress the gap instead of the full history.
|
||||
meta = {"message_count": message_count, "uploaded_at": time.time()}
|
||||
mwid, mfid, mfname = _meta_storage_path_parts(user_id, session_id)
|
||||
await storage.store(
|
||||
workspace_id=mwid,
|
||||
file_id=mfid,
|
||||
filename=mfname,
|
||||
content=json.dumps(meta).encode("utf-8"),
|
||||
)
|
||||
# Wrapped in try/except so a metadata write failure doesn't orphan
|
||||
# the already-uploaded transcript — the next turn will just fall back
|
||||
# to full gap fill (msg_count=0).
|
||||
try:
|
||||
meta = {"message_count": message_count, "uploaded_at": time.time()}
|
||||
mwid, mfid, mfname = _meta_storage_path_parts(user_id, session_id)
|
||||
await storage.store(
|
||||
workspace_id=mwid,
|
||||
file_id=mfid,
|
||||
filename=mfname,
|
||||
content=json.dumps(meta).encode("utf-8"),
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning(f"[Transcript] Failed to write metadata for {session_id}: {e}")
|
||||
|
||||
logger.info(
|
||||
f"[Transcript] Uploaded {new_size}B "
|
||||
|
||||
@@ -105,7 +105,7 @@ function ToolIcon({
|
||||
);
|
||||
}
|
||||
if (isStreaming) {
|
||||
return <OrbitLoader size={20} />;
|
||||
return <OrbitLoader size={14} />;
|
||||
}
|
||||
|
||||
const iconClass = "text-neutral-400";
|
||||
@@ -494,7 +494,9 @@ function getFileAccordionData(
|
||||
const content = getStringField(output, "content", "text", "_raw");
|
||||
const message = getStringField(output, "message");
|
||||
// For Glob/list results, try to show file list
|
||||
const files = Array.isArray(output.files) ? (output.files as string[]) : null;
|
||||
const files = Array.isArray(output.files)
|
||||
? output.files.filter((f: unknown): f is string => typeof f === "string")
|
||||
: null;
|
||||
|
||||
return {
|
||||
title: message ?? "File output",
|
||||
|
||||
Reference in New Issue
Block a user