mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-05-05 07:08:28 +00:00
improve handling of bad content types
This commit is contained in:
parent
8e91574938
commit
790d59547b
3 changed files with 36 additions and 12 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue