|
@@ -8,6 +8,7 @@ import orjson
|
|
|
import requests
|
|
|
from google.generativeai.types import (HarmBlockThreshold, HarmCategory)
|
|
|
from loguru import logger
|
|
|
+import traceback
|
|
|
|
|
|
|
|
|
CACHE_DIR = '/app/cache/'
|
|
@@ -62,11 +63,18 @@ class GoogleAI(object):
|
|
|
'timeout': 600,
|
|
|
},
|
|
|
)
|
|
|
- text = orjson.loads(response.text.strip())['text']
|
|
|
+ # 打印响应内容用于调试
|
|
|
+ logger.info(f"[+]Response text: {response.text}")
|
|
|
+ try:
|
|
|
+ text = orjson.loads(response.text.strip())['text']
|
|
|
+ except orjson.JSONDecodeError as json_error:
|
|
|
+ logger.error(f"[内容分析] JSON解析错误, 响应内容: {response.text}, 错误信息: {json_error}")
|
|
|
+ return
|
|
|
+ # text = orjson.loads(response.text.strip())['text']
|
|
|
genai.delete_file(name=video.name)
|
|
|
return text
|
|
|
except Exception as e:
|
|
|
- logger.error(f"[内容分析] 处理异常,异常信息{e}")
|
|
|
+ logger.error(f"[内容分析] 处理异常, 异常类型: {type(e).__name__}, 异常信息: {e}\n{traceback.format_exc()}")
|
|
|
return
|
|
|
|
|
|
|