fix: 移除未使用的临时目录变量 (#3286)
* Initial plan * fix: 移除未使用的临时目录变量 (ruff check --fix) Co-authored-by: LIghtJUNction <106986785+LIghtJUNction@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: LIghtJUNction <106986785+LIghtJUNction@users.noreply.github.com>
This commit is contained in:
@@ -152,7 +152,6 @@ class Record(BaseMessageComponent):
|
||||
if self.file.startswith("base64://"):
|
||||
bs64_data = self.file.removeprefix("base64://")
|
||||
image_bytes = base64.b64decode(bs64_data)
|
||||
temp_dir = str(AstrbotPaths.astrbot_root / "temp")
|
||||
file_path = str(AstrbotPaths.astrbot_root / "temp" / f"{uuid.uuid4()}.jpg")
|
||||
with open(file_path, "wb") as f:
|
||||
f.write(image_bytes)
|
||||
@@ -241,7 +240,6 @@ class Video(BaseMessageComponent):
|
||||
if url and url.startswith("file:///"):
|
||||
return url[8:]
|
||||
if url and url.startswith("http"):
|
||||
download_dir = str(AstrbotPaths.astrbot_root / "temp")
|
||||
video_file_path = str(
|
||||
AstrbotPaths.astrbot_root / "temp" / f"{uuid.uuid4().hex}"
|
||||
)
|
||||
@@ -443,7 +441,6 @@ class Image(BaseMessageComponent):
|
||||
if url.startswith("base64://"):
|
||||
bs64_data = url.removeprefix("base64://")
|
||||
image_bytes = base64.b64decode(bs64_data)
|
||||
temp_dir = str(AstrbotPaths.astrbot_root / "temp")
|
||||
image_file_path = str(
|
||||
AstrbotPaths.astrbot_root / "temp" / f"{uuid.uuid4()}.jpg"
|
||||
)
|
||||
|
||||
@@ -786,7 +786,6 @@ class WeChatPadProAdapter(Platform):
|
||||
voice_bs64_data = voice_resp.get("Data", {}).get("Base64", None)
|
||||
if voice_bs64_data:
|
||||
voice_bs64_data = base64.b64decode(voice_bs64_data)
|
||||
temp_dir = str(AstrbotPaths.astrbot_root / "temp")
|
||||
file_path = str(
|
||||
AstrbotPaths.astrbot_root
|
||||
/ "temp"
|
||||
|
||||
@@ -214,7 +214,6 @@ class Main(star.Star):
|
||||
file_path = await comp.get_file()
|
||||
if file_path.startswith("http"):
|
||||
name = comp.name if comp.name else uuid.uuid4().hex[:8]
|
||||
temp_dir = str(AstrbotPaths.astrbot_root / "temp")
|
||||
path = str(AstrbotPaths.astrbot_root / "temp" / name)
|
||||
await download_file(file_path, path)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user