-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(source): add timeout to add-research imports #262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -111,7 +111,7 @@ Supported source types: URLs, YouTube videos, files (PDF, text, Markdown, Word, | |||||
| | `list` | - | - | `source list` | | ||||||
| | `add <content>` | URL/file/text | - | `source add "https://..."` | | ||||||
| | `add-drive <id> <title>` | Drive file ID | - | `source add-drive abc123 "Doc"` | | ||||||
| | `add-research <query>` | Search query | `--mode [fast|deep]`, `--from [web|drive]`, `--import-all`, `--no-wait` | `source add-research "AI" --mode deep --no-wait` | | ||||||
| | `add-research <query>` | Search query | `--mode [fast|deep]`, `--from [web|drive]`, `--import-all`, `--timeout FLOAT`, `--no-wait` | `source add-research "AI" --mode deep --timeout 600` | | ||||||
|
||||||
| | `add-research <query>` | Search query | `--mode [fast|deep]`, `--from [web|drive]`, `--import-all`, `--timeout FLOAT`, `--no-wait` | `source add-research "AI" --mode deep --timeout 600` | | |
| | `add-research <query>` | Search query | `--mode [fast|deep]`, `--from [web|drive]`, `--import-all`, `--timeout`, `--no-wait` | `source add-research "AI" --mode deep --timeout 600` | |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -540,24 +540,32 @@ async def _run(): | |||||||||||||||||||||||
| help="Search mode (default: fast)", | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| @click.option("--import-all", is_flag=True, help="Import all found sources") | ||||||||||||||||||||||||
| @click.option( | ||||||||||||||||||||||||
| "--timeout", | ||||||||||||||||||||||||
| type=float, | ||||||||||||||||||||||||
| default=1800.0, | ||||||||||||||||||||||||
| show_default=True, | ||||||||||||||||||||||||
| help="Retry budget in seconds when --import-all is used", | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
Comment on lines
+544
to
+549
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency with other commands in the
Suggested change
|
||||||||||||||||||||||||
| @click.option( | ||||||||||||||||||||||||
| "--no-wait", | ||||||||||||||||||||||||
| is_flag=True, | ||||||||||||||||||||||||
| help="Start research and return immediately (use 'research status/wait' to monitor)", | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| @with_client | ||||||||||||||||||||||||
| def source_add_research( | ||||||||||||||||||||||||
| ctx, query, notebook_id, search_source, mode, import_all, no_wait, client_auth | ||||||||||||||||||||||||
| ctx, query, notebook_id, search_source, mode, import_all, timeout, no_wait, client_auth | ||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||
| """Search web or drive and add sources from results. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| \b | ||||||||||||||||||||||||
| Examples: | ||||||||||||||||||||||||
| source add-research "machine learning" # Search web | ||||||||||||||||||||||||
| source add-research "project docs" --from drive # Search Google Drive | ||||||||||||||||||||||||
| source add-research "AI papers" --mode deep # Deep search | ||||||||||||||||||||||||
| source add-research "tutorials" --import-all # Auto-import all results | ||||||||||||||||||||||||
| source add-research "topic" --mode deep --no-wait # Non-blocking deep search | ||||||||||||||||||||||||
| source add-research "AI papers" --mode deep # Deep search | ||||||||||||||||||||||||
| source add-research "tutorials" --import-all # Auto-import all results | ||||||||||||||||||||||||
| source add-research "tutorials" --import-all --timeout 600 # Limit import retry budget | ||||||||||||||||||||||||
| source add-research "topic" --mode deep --no-wait # Non-blocking deep search | ||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||
| nb_id = require_notebook(notebook_id) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -606,6 +614,7 @@ async def _run(): | |||||||||||||||||||||||
| nb_id_resolved, | ||||||||||||||||||||||||
| task_id, | ||||||||||||||||||||||||
| sources, | ||||||||||||||||||||||||
| max_elapsed=timeout, | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| console.print(f"[green]Imported {len(imported)} sources[/green]") | ||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.