rag_refresh: retry attach up to 3x (transient 400 while file processes)
This commit is contained in:
1 parent
49376813ae
commit
49638ba36a
1 file changed
+7
-1
+7
-1
@@ -91,7 +91,13 @@ for name in DOCS:
|
||||
print(f"rag_refresh: upload failed for {name}: {e}", file=sys.stderr)
|
||||
continue
|
||||
fid = resp.get("id")
|
||||
code, _ = api(f"/api/v1/knowledge/{KB_ID}/file/add", {"file_id": fid})
|
||||
# attach can 400 transiently right after upload (file still processing) — retry
|
||||
code = None
|
||||
for attempt in range(3):
|
||||
code, _ = api(f"/api/v1/knowledge/{KB_ID}/file/add", {"file_id": fid})
|
||||
if code == 200:
|
||||
break
|
||||
time.sleep(5 * (attempt + 1))
|
||||
if code != 200:
|
||||
print(f"rag_refresh: attach failed for {name}: {code}", file=sys.stderr)
|
||||
continue
|
||||
|
||||
Reference in new issue
Block a user