|
36 | 36 | from src.ai import bucketer |
37 | 37 | from src.pipeline.ppt_pipeline import PPTPipeline |
38 | 38 | from src.ai.transcriber import IncompleteAudioError, NoAudioStreamError |
| 39 | +from src.runtime import config |
39 | 40 |
|
40 | 41 | if TYPE_CHECKING: |
41 | 42 | from src.data.database import Database |
@@ -202,19 +203,20 @@ def _get_transcript(self, existing: dict | None, course_id: str, |
202 | 203 | ) |
203 | 204 | return existing["transcript"], None |
204 | 205 |
|
205 | | - # Try official transcript before firing up ASR. |
206 | | - try: |
207 | | - official = self._client.get_transcript_segments(sub_id) |
208 | | - if self._official_transcript_usable(official): |
209 | | - text = " ".join(s["text"] for s in official) |
210 | | - self._reporter.info( |
211 | | - f" Using official transcript " |
212 | | - f"({len(text)} chars, {len(official)} segments)" |
213 | | - ) |
214 | | - self._db.update_transcript(sub_id, text) |
215 | | - return text, official |
216 | | - except Exception: |
217 | | - pass # fall through to ASR |
| 206 | + # Try official transcript before firing up ASR (config-gated). |
| 207 | + if config.USE_OFFICIAL_TRANSCRIPT: |
| 208 | + try: |
| 209 | + official = self._client.get_transcript_segments(sub_id) |
| 210 | + if self._official_transcript_usable(official): |
| 211 | + text = " ".join(s["text"] for s in official) |
| 212 | + self._reporter.info( |
| 213 | + f" Using official transcript " |
| 214 | + f"({len(text)} chars, {len(official)} segments)" |
| 215 | + ) |
| 216 | + self._db.update_transcript(sub_id, text) |
| 217 | + return text, official |
| 218 | + except Exception: |
| 219 | + pass # fall through to ASR |
218 | 220 |
|
219 | 221 | # Pull the audio handle. ``schedule`` is idempotent — usually the |
220 | 222 | # previous lecture already kicked it off (Phase C), but for the |
|
0 commit comments