fix(clover_image): 优化随机图片选取逻辑

- 移除了多余的随机选择代码
- 通过直接在返回语句中使用 random.choice() 来优化图片路径的随机选择
This commit is contained in:
SlyAimer 2025-03-04 23:29:03 +08:00
parent 5677ba2a82
commit 561716d8b6

View file

@ -13,7 +13,6 @@ async def get_image_names():
for file in files: for file in files:
if any(file.endswith(ext) for ext in image_extensions): # 检查文件是否是图片文件 if any(file.endswith(ext) for ext in image_extensions): # 检查文件是否是图片文件
image_names.append(file) image_names.append(file)
random.choice(image_names) # 随机选取一张图片
local_image_path = image_local_path + '/' + random.choice(image_names) # 随机选取一张图片的路径 local_image_path = image_local_path + '/' + random.choice(image_names) # 随机选取一张图片的路径
return local_image_path return local_image_path