合并分支

* Merge branch 'main' into feature/modal-cluster-gemini
* FIX 修复拼接网格图的异步失效问题
* FIX 修复拼接网格图的异步失效问题
* Merge branch 'main' into feature/modal-cluster-gemini
* Merge branch 'main' into feature/modal-cluster-gemini
* FIX 调高合成网格图容器配置
* Merge branch 'main' into feature/modal-cluster-gemini
* FIX 修复带图片模态推理接口
* PERF 优化Gemini Prompt词
* Merge remote-tracking branch 'origin/main' into feature/modal-cluster-gemini
* ADD 增加网格图片创建接口 ADD gemini推理打点增加商品封面模态 PERF gemini打点结果相邻时间线同商品合并
* Merge branch 'main' into feature/modal-cluster-gemini
* FIX 429重试机制
* FIX 修复Gemini推理函数入参
* Merge branch 'main' into feature/modal-cluster-gemini
* PERF gemini修改参数类型 ADD 增加批量删除Gemini文件接口
* PERF gemini修改prompt
* Merge branch 'feature/modal-cluster' into feature/modal-cluster-gemini
* PERF gemini修改prompt
* 录制HLS时 结果复制到S3挂载点增加一个fallback处理
* Merge branch 'feature/modal-cluster' into feature/modal-cluster-gemini
* PERF gemini修改prompt
* PERF gemini增加图像模态
* PERF gemini增加图像模态
* fix : TikHub的Logger换为Loguru
* fix : 修复直播切分视频接口
* Merge branch 'feature/modal-cluster' into feature/modal-cluster-gemini
* PERF tikhub接口增加随机延迟
* Merge remote-tracking branch 'origin/feature/modal-cluster' into feature/modal-cluster
* 合并分支
* fix : hls录制缓存读写问题
* FIX 修改冲突
* ADD 增加获取直播间指定商品数量接口
* Merge branch 'feature/modal-cluster' into feature/modal-cluster-gemini
* PERF 修改tikhub到aws
* fix : 增加s3分片上传接口
* PERF Gemini推理直接从参数列表获取商品列表 ADD Tikhub增加获取置顶|讲解中商品接口
* PERF Gemini推理直接从参数获取商品列表
* Merge branch 'feature/modal-cluster' into feature/modal-cluster-gemini
* fix 处理jpg图片的codec_name应为mjpg
* Merge branch 'feature/modal-cluster' into feature/modal-cluster-gemini
* PERF 优化返回值
* fix 获取媒体metadata的类型报错,modal client升级到1.0.2
* Merge branch 'feature/modal-cluster' into feature/modal-cluster-gemini
* PERF 风控后爬虫直接退出避免cookie失效 PERF 分离tikhub api, 使用更低的保持时间以更换IP FIX 修复Dict键不存在报错的bug
* fix 一些webhook相关的bug,添加了更详细的接口说明
* 更新直播录制为可跳转时间的hls流接口,用于替代掉腾讯VOD+火山云拉流转推,片段保证每片开头为关键帧,时间精度准确到毫秒级
* ADD 增加直播间商品增量缓存触发器
* Merge branch 'feature/modal-cluster' into feature/modal-cluster-gemini
* PERF 调整gemini prompt
* - KVCache类改为可拓展,基于环境变量设置KV space - test 环境配置与CF测试环境对齐
* FIX 修复Gemini推理视频切条的问题 PERF 优化视频切条函数性能
* ADD 基本完成gemini视频推理API
* ADD 添加内联的tikhub
* 对齐预发环境

---------

Merge request URL: https://g-ldyi2063.coding.net/p/dev/d/modalDeploy/git/merge/4799
Co-authored-by: 康宇佳,shuohigh@gmail.com
This commit is contained in:
康宇佳 2025-06-13 15:25:37 +08:00 committed by Coding
parent 8e958b56d1
commit 8d57e593f8
1 changed files with 34 additions and 33 deletions

View File

@ -45,40 +45,8 @@ with downloader_image.imports():
:return: 图片路径 :return: 图片路径
""" """
try: try:
cell_height = image_size + text_height
cell_width = image_size
# 提取图片路径和文字说明
image_paths = []
captions = []
for info in image_info_list:
captions.append(info["title"])
if "resize:200" in info["cover"]:
info["cover"] = info["cover"].replace("resize:200", f"resize:{image_size}")
image_paths.append(info["cover"])
# 检查输入
if len(image_paths) != len(captions):
raise ValueError("图片数量与文字说明数量不匹配")
# 处理图片(包括从网络获取)
loaded_images = []
for path in image_paths:
if path.startswith(('http://', 'https://')):
try:
response = requests.get(path)
response.raise_for_status()
img = Image.open(BytesIO(response.content))
loaded_images.append(img)
except requests.RequestException as e:
raise FileNotFoundError(f"无法从网络获取图片: {path}, 错误: {e}")
elif os.path.exists(path):
img = Image.open(path)
loaded_images.append(img)
else:
raise FileNotFoundError(f"找不到图片文件: {path}")
# 计算网格大小 # 计算网格大小
n = len(image_paths) n = len(image_info_list)
max_cols = min(4, n) # 最大列数为6或图片数量 max_cols = min(4, n) # 最大列数为6或图片数量
min_rows = math.ceil(n / max_cols) # 最小行数 min_rows = math.ceil(n / max_cols) # 最小行数
@ -100,6 +68,39 @@ with downloader_image.imports():
if best_rows > 4 or best_cols > 4: if best_rows > 4 or best_cols > 4:
raise ValueError(f"图片数量({n})过多无法在4x4网格内合理展示") raise ValueError(f"图片数量({n})过多无法在4x4网格内合理展示")
cell_height = image_size + text_height
cell_width = image_size
# 提取图片路径和文字说明
image_paths = []
captions = []
for info in image_info_list:
captions.append(info["title"])
if "resize:200" in info["cover"]:
info["cover"] = info["cover"].replace("resize:200", f"resize:{image_size}")
image_paths.append(info["cover"])
# 检查输入
if len(image_paths) != len(captions):
raise ValueError("图片数量与文字说明数量不匹配")
# 处理图片(包括从网络获取)
loaded_images = []
for path in image_paths:
if path.startswith(('http://', 'https://')):
try:
async with httpx.AsyncClient(timeout=60) as client:
response = await client.get(path)
response.raise_for_status()
img = Image.open(BytesIO(response.content))
loaded_images.append(img)
except requests.RequestException as e:
raise FileNotFoundError(f"无法从网络获取图片: {path}, 错误: {e}")
elif os.path.exists(path):
img = Image.open(path)
loaded_images.append(img)
else:
raise FileNotFoundError(f"找不到图片文件: {path}")
# 创建画布 # 创建画布
canvas_width = best_cols * (cell_width + separator) - separator canvas_width = best_cols * (cell_width + separator) - separator
canvas_height = best_rows * (cell_height + separator) - separator canvas_height = best_rows * (cell_height + separator) - separator