improve handling of bad content types

This commit is contained in:
LUIS NOVO 2024-10-27 17:26:56 -03:00
parent 8e91574938
commit 790d59547b
3 changed files with 36 additions and 12 deletions

View file

@ -16,6 +16,7 @@ from youtube_transcript_api import YouTubeTranscriptApi # type: ignore
from youtube_transcript_api.formatters import TextFormatter # type: ignore
from open_notebook.config import CONFIG
from open_notebook.exceptions import UnsupportedTypeException
class SourceState(TypedDict):
@ -513,7 +514,9 @@ def file_type_edge(data: SourceState):
elif data.get("identified_type").startswith("audio"):
return "extract_audio"
else:
return "end"
raise UnsupportedTypeException(
f"Unsupported file type: {data.get('identified_type')}"
)
workflow = StateGraph(SourceState)