Skip to content

Commit 77e4ed9

Browse files
committed
wew
1 parent e47ec03 commit 77e4ed9

File tree

2 files changed

+67
-62
lines changed

2 files changed

+67
-62
lines changed

tldw_chatbook/UI/Ingest_Window.py

Lines changed: 61 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,67 @@ def compose_tldw_api_form(self, media_type: str) -> ComposeResult:
145145
# --- Media-Type Specific Option Containers have been removed from this common method ---
146146
# They will be added to the media-type specific views/containers directly.
147147

148+
# --- Inserted Media-Type Specific Options ---
149+
if media_type == "video":
150+
with Container(id=TLDW_API_VIDEO_OPTIONS_ID, classes="tldw-api-media-specific-options"): # ID of container itself is fine
151+
yield Static("Video Specific Options", classes="sidebar-title")
152+
yield Label("Transcription Model:")
153+
yield Input("deepdml/faster-whisper-large-v3-turbo-ct2", id=f"tldw-api-video-transcription-model-{media_type}")
154+
yield Label("Transcription Language (e.g., 'en'):")
155+
yield Input("en", id=f"tldw-api-video-transcription-language-{media_type}")
156+
yield Checkbox("Enable Speaker Diarization", False, id=f"tldw-api-video-diarize-{media_type}")
157+
yield Checkbox("Include Timestamps in Transcription", True, id=f"tldw-api-video-timestamp-{media_type}")
158+
yield Checkbox("Enable VAD (Voice Activity Detection)", False, id=f"tldw-api-video-vad-{media_type}")
159+
yield Checkbox("Perform Confabulation Check of Analysis", False, id=f"tldw-api-video-confab-check-{media_type}")
160+
with Horizontal(classes="ingest-form-row"):
161+
with Vertical(classes="ingest-form-col"):
162+
yield Label("Start Time (HH:MM:SS or secs):")
163+
yield Input(id=f"tldw-api-video-start-time-{media_type}", placeholder="Optional")
164+
with Vertical(classes="ingest-form-col"):
165+
yield Label("End Time (HH:MM:SS or secs):")
166+
yield Input(id=f"tldw-api-video-end-time-{media_type}", placeholder="Optional")
167+
elif media_type == "audio":
168+
with Container(id=TLDW_API_AUDIO_OPTIONS_ID, classes="tldw-api-media-specific-options"):
169+
yield Static("Audio Specific Options", classes="sidebar-title")
170+
yield Label("Transcription Model:")
171+
yield Input("deepdml/faster-distil-whisper-large-v3.5", id=f"tldw-api-audio-transcription-model-{media_type}")
172+
yield Label("Transcription Language (e.g., 'en'):")
173+
yield Input("en", id=f"tldw-api-audio-transcription-language-{media_type}")
174+
yield Checkbox("Enable Speaker Diarization", False, id=f"tldw-api-audio-diarize-{media_type}")
175+
yield Checkbox("Include Timestamps in Transcription", True, id=f"tldw-api-audio-timestamp-{media_type}")
176+
yield Checkbox("Enable VAD (Voice Activity Detection)", False, id=f"tldw-api-audio-vad-{media_type}")
177+
# TODO: Add other audio specific fields from ProcessAudioRequest: confab (e.g. id=f"tldw-api-audio-confab-check-{media_type}")
178+
elif media_type == "pdf":
179+
pdf_engine_options = [(engine, engine) for engine in PdfEngine.__args__]
180+
with Container(id=TLDW_API_PDF_OPTIONS_ID, classes="tldw-api-media-specific-options"):
181+
yield Static("PDF Specific Options", classes="sidebar-title")
182+
yield Label("PDF Parsing Engine:")
183+
yield Select(pdf_engine_options, id=f"tldw-api-pdf-engine-{media_type}", value="pymupdf4llm")
184+
elif media_type == "ebook":
185+
ebook_extraction_options = [("filtered", "filtered"), ("markdown", "markdown"), ("basic", "basic")]
186+
with Container(id=TLDW_API_EBOOK_OPTIONS_ID, classes="tldw-api-media-specific-options"):
187+
yield Static("Ebook Specific Options", classes="sidebar-title")
188+
yield Label("Ebook Extraction Method:")
189+
yield Select(ebook_extraction_options, id=f"tldw-api-ebook-extraction-method-{media_type}", value="filtered")
190+
elif media_type == "document":
191+
with Container(id=TLDW_API_DOCUMENT_OPTIONS_ID, classes="tldw-api-media-specific-options"):
192+
yield Static("Document Specific Options", classes="sidebar-title")
193+
# yield Label("Note: Document specific options are minimal beyond common settings.") # Placeholder - can be removed or made more specific if needed
194+
# If adding specific fields, ensure their IDs are dynamic e.g. id=f"tldw-api-doc-some-option-{media_type}"
195+
elif media_type == "xml":
196+
with Container(id=TLDW_API_XML_OPTIONS_ID, classes="tldw-api-media-specific-options"):
197+
yield Static("XML Specific Options (Note: Only one local file at a time)", classes="sidebar-title")
198+
yield Checkbox("Auto Summarize XML Content", False, id=f"tldw-api-xml-auto-summarize-{media_type}")
199+
elif media_type == "mediawiki_dump":
200+
with Container(id=TLDW_API_MEDIAWIKI_OPTIONS_ID, classes="tldw-api-media-specific-options"):
201+
yield Static("MediaWiki Dump Specific Options (Note: Only one local file at a time)", classes="sidebar-title")
202+
yield Label("Wiki Name (for identification):")
203+
yield Input(id=f"tldw-api-mediawiki-wiki-name-{media_type}", placeholder="e.g., my_wiki_backup")
204+
yield Label("Namespaces (comma-sep IDs, optional):")
205+
yield Input(id=f"tldw-api-mediawiki-namespaces-{media_type}", placeholder="e.g., 0,14")
206+
yield Checkbox("Skip Redirect Pages (recommended)", True, id=f"tldw-api-mediawiki-skip-redirects-{media_type}")
207+
# --- End of Inserted Media-Type Specific Options ---
208+
148209
yield Static("Local Database Options", classes="sidebar-title")
149210
yield Checkbox("Overwrite if media exists in local DB", False, id=f"tldw-api-overwrite-db-{media_type}")
150211

@@ -241,66 +302,6 @@ def compose(self) -> ComposeResult:
241302
# For now, we assume compose_tldw_api_form is generic enough or will be adapted.
242303
yield from self.compose_tldw_api_form(media_type=media_type)
243304

244-
# Add media-specific options here
245-
if media_type == "video":
246-
with Container(id=TLDW_API_VIDEO_OPTIONS_ID, classes="tldw-api-media-specific-options"): # ID of container itself is fine
247-
yield Static("Video Specific Options", classes="sidebar-title")
248-
yield Label("Transcription Model:")
249-
yield Input("deepdml/faster-whisper-large-v3-turbo-ct2", id=f"tldw-api-video-transcription-model-{media_type}")
250-
yield Label("Transcription Language (e.g., 'en'):")
251-
yield Input("en", id=f"tldw-api-video-transcription-language-{media_type}")
252-
yield Checkbox("Enable Speaker Diarization", False, id=f"tldw-api-video-diarize-{media_type}")
253-
yield Checkbox("Include Timestamps in Transcription", True, id=f"tldw-api-video-timestamp-{media_type}")
254-
yield Checkbox("Enable VAD (Voice Activity Detection)", False, id=f"tldw-api-video-vad-{media_type}")
255-
yield Checkbox("Perform Confabulation Check of Analysis", False, id=f"tldw-api-video-confab-check-{media_type}")
256-
with Horizontal(classes="ingest-form-row"):
257-
with Vertical(classes="ingest-form-col"):
258-
yield Label("Start Time (HH:MM:SS or secs):")
259-
yield Input(id=f"tldw-api-video-start-time-{media_type}", placeholder="Optional")
260-
with Vertical(classes="ingest-form-col"):
261-
yield Label("End Time (HH:MM:SS or secs):")
262-
yield Input(id=f"tldw-api-video-end-time-{media_type}", placeholder="Optional")
263-
elif media_type == "audio":
264-
with Container(id=TLDW_API_AUDIO_OPTIONS_ID, classes="tldw-api-media-specific-options"):
265-
yield Static("Audio Specific Options", classes="sidebar-title")
266-
yield Label("Transcription Model:")
267-
yield Input("deepdml/faster-distil-whisper-large-v3.5", id=f"tldw-api-audio-transcription-model-{media_type}")
268-
yield Label("Transcription Language (e.g., 'en'):")
269-
yield Input("en", id=f"tldw-api-audio-transcription-language-{media_type}")
270-
yield Checkbox("Enable Speaker Diarization", False, id=f"tldw-api-audio-diarize-{media_type}")
271-
yield Checkbox("Include Timestamps in Transcription", True, id=f"tldw-api-audio-timestamp-{media_type}")
272-
yield Checkbox("Enable VAD (Voice Activity Detection)", False, id=f"tldw-api-audio-vad-{media_type}")
273-
# TODO: Add other audio specific fields from ProcessAudioRequest: confab (e.g. id=f"tldw-api-audio-confab-check-{media_type}")
274-
elif media_type == "pdf":
275-
pdf_engine_options = [(engine, engine) for engine in PdfEngine.__args__]
276-
with Container(id=TLDW_API_PDF_OPTIONS_ID, classes="tldw-api-media-specific-options"):
277-
yield Static("PDF Specific Options", classes="sidebar-title")
278-
yield Label("PDF Parsing Engine:")
279-
yield Select(pdf_engine_options, id=f"tldw-api-pdf-engine-{media_type}", value="pymupdf4llm")
280-
elif media_type == "ebook":
281-
ebook_extraction_options = [("filtered", "filtered"), ("markdown", "markdown"), ("basic", "basic")]
282-
with Container(id=TLDW_API_EBOOK_OPTIONS_ID, classes="tldw-api-media-specific-options"):
283-
yield Static("Ebook Specific Options", classes="sidebar-title")
284-
yield Label("Ebook Extraction Method:")
285-
yield Select(ebook_extraction_options, id=f"tldw-api-ebook-extraction-method-{media_type}", value="filtered")
286-
elif media_type == "document":
287-
with Container(id=TLDW_API_DOCUMENT_OPTIONS_ID, classes="tldw-api-media-specific-options"):
288-
yield Static("Document Specific Options", classes="sidebar-title")
289-
# yield Label("Note: Document specific options are minimal beyond common settings.") # Placeholder - can be removed or made more specific if needed
290-
# If adding specific fields, ensure their IDs are dynamic e.g. id=f"tldw-api-doc-some-option-{media_type}"
291-
elif media_type == "xml":
292-
with Container(id=TLDW_API_XML_OPTIONS_ID, classes="tldw-api-media-specific-options"):
293-
yield Static("XML Specific Options (Note: Only one local file at a time)", classes="sidebar-title")
294-
yield Checkbox("Auto Summarize XML Content", False, id=f"tldw-api-xml-auto-summarize-{media_type}")
295-
elif media_type == "mediawiki_dump":
296-
with Container(id=TLDW_API_MEDIAWIKI_OPTIONS_ID, classes="tldw-api-media-specific-options"):
297-
yield Static("MediaWiki Dump Specific Options (Note: Only one local file at a time)", classes="sidebar-title")
298-
yield Label("Wiki Name (for identification):")
299-
yield Input(id=f"tldw-api-mediawiki-wiki-name-{media_type}", placeholder="e.g., my_wiki_backup")
300-
yield Label("Namespaces (comma-sep IDs, optional):")
301-
yield Input(id=f"tldw-api-mediawiki-namespaces-{media_type}", placeholder="e.g., 0,14")
302-
yield Checkbox("Skip Redirect Pages (recommended)", True, id=f"tldw-api-mediawiki-skip-redirects-{media_type}")
303-
304305

305306

306307
#

tldw_chatbook/css/tldw_cli.tcss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,11 +1326,15 @@ MetricsScreen Label.-info-message {
13261326
}
13271327

13281328
.ingest-textarea-small {
1329-
height: 3;
1329+
height: auto;
1330+
max-height: 10;
1331+
overflow-y: hidden;
13301332
margin-bottom: 1;
13311333
}
13321334
.ingest-textarea-medium {
1333-
height: 5;
1335+
height: auto;
1336+
max-height: 15;
1337+
overflow-y: hidden;
13341338
margin-bottom: 1;
13351339
}
13361340
.ingest-form-row {

0 commit comments

Comments
 (0)