|
|
@@ -6,6 +6,16 @@ from app.infra.shared import AsyncHttpClient
|
|
|
class AigcDecodeServer:
|
|
|
base_url: str = "https://aigc-api.aiddit.com"
|
|
|
|
|
|
+ @staticmethod
|
|
|
+ def _sanitize_images(posts: List[Dict]) -> List[Dict]:
|
|
|
+ for post in posts:
|
|
|
+ images = post.get("images")
|
|
|
+ if images:
|
|
|
+ post["images"] = [
|
|
|
+ img for img in images if img and img.startswith(("http://", "https://"))
|
|
|
+ ]
|
|
|
+ return posts
|
|
|
+
|
|
|
async def submit_decode(
|
|
|
self, config_id: int, posts: List[Dict], skip_completed: bool = False
|
|
|
) -> Dict:
|
|
|
@@ -18,7 +28,7 @@ class AigcDecodeServer:
|
|
|
"params": {
|
|
|
"configId": config_id,
|
|
|
"skipCompleted": skip_completed,
|
|
|
- "posts": posts,
|
|
|
+ "posts": self._sanitize_images(posts),
|
|
|
}
|
|
|
}
|
|
|
async with AsyncHttpClient() as client:
|