tingwu_new
All checks were successful
Deploy to Server / deploy (push) Successful in 21s

This commit is contained in:
jeremygan2021
2026-03-11 20:31:09 +08:00
parent 44d90e643f
commit b0aa902f89
5 changed files with 156 additions and 2 deletions

View File

@@ -218,6 +218,8 @@ class TranscriptionTaskViewSet(viewsets.ModelViewSet):
if t_resp.status_code == 200:
transcription_data = t_resp.json()
logger.info(f"Downloaded transcription keys: {transcription_data.keys() if isinstance(transcription_data, dict) else 'Not a dict'}")
# 保存原始数据
task.transcription_data = transcription_data
else:
logger.warning(f"Failed to download transcription: {t_resp.status_code}")
transcription_data = {}
@@ -234,6 +236,8 @@ class TranscriptionTaskViewSet(viewsets.ModelViewSet):
if t_resp.status_code == 200:
transcription_data = t_resp.json()
logger.info(f"Downloaded transcription keys: {transcription_data.keys() if isinstance(transcription_data, dict) else 'Not a dict'}")
# 保存原始数据
task.transcription_data = transcription_data
except Exception as e:
logger.error(f"Error downloading transcription nested url: {e}")
@@ -300,6 +304,8 @@ class TranscriptionTaskViewSet(viewsets.ModelViewSet):
s_resp = requests.get(summarization)
if s_resp.status_code == 200:
summarization = s_resp.json()
# 保存原始数据
task.summary_data = summarization
else:
logger.warning(f"Failed to download summarization: {s_resp.status_code}")
summarization = {}
@@ -317,6 +323,19 @@ class TranscriptionTaskViewSet(viewsets.ModelViewSet):
else:
# 尝试从章节摘要中提取
chapters = task_result.get('Chapters', [])
# 处理 AutoChapters
auto_chapters = task_result.get('AutoChapters', {})
if isinstance(auto_chapters, str) and auto_chapters.startswith('http'):
try:
import requests
logger.info(f"Downloading auto chapters from {auto_chapters}")
ac_resp = requests.get(auto_chapters)
if ac_resp.status_code == 200:
auto_chapters = ac_resp.json()
task.auto_chapters_data = auto_chapters
except Exception as e:
logger.error(f"Error downloading auto chapters: {e}")
summary_parts = []
for chapter in chapters:
if 'Headline' in chapter: