-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: add language and instructions support for mind maps #277
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 all commits
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -994,14 +994,21 @@ async def _generate(): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| default=None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| help="Notebook ID (uses current if not set)", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @click.argument("description", default="", required=False) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @click.option("--language", default=None, help="Output language (default: from config or 'en')") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @click.option("--source", "-s", "source_ids", multiple=True, help="Limit to specific source IDs") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @json_option | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @with_client | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def generate_mind_map(ctx, notebook_id, source_ids, json_output, client_auth): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def generate_mind_map(ctx, notebook_id, description, language, source_ids, json_output, client_auth): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Generate mind map. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| \b | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Use --json for machine-readable output. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| \b | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| notebooklm generate mind-map "focus on causal relationships" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| notebooklm generate mind-map --language zh-CN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nb_id = require_notebook(notebook_id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1013,12 +1020,18 @@ async def _run(): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Show status spinner only for console output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if json_output: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result = await client.artifacts.generate_mind_map( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nb_id_resolved, source_ids=sources | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nb_id_resolved, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| source_ids=sources, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| language=resolve_language(language), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| instructions=description or None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with console.status("Generating mind map..."): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result = await client.artifacts.generate_mind_map( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nb_id_resolved, source_ids=sources | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nb_id_resolved, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| source_ids=sources, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| language=resolve_language(language), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| instructions=description or None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
1021
to
1035
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. The logic for resolving the language and instructions is duplicated across the
Suggested change
References
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _output_mind_map_result(result, json_output) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an explicit
--instructionsoption for mind-map generation.The implementation currently supports instructions only via positional
description, but the stated objective requires a dedicated--instructionsflag.Proposed fix (keep positional text for backward compatibility)
`@generate.command`("mind-map") `@click.option`( @@ ) `@click.argument`("description", default="", required=False) +@click.option( + "--instructions", + default=None, + help="Custom instructions for mind map generation", +) `@click.option`("--language", default=None, help="Output language (default: from config or 'en')") `@click.option`("--source", "-s", "source_ids", multiple=True, help="Limit to specific source IDs") `@json_option` `@with_client` -def generate_mind_map(ctx, notebook_id, description, language, source_ids, json_output, client_auth): +def generate_mind_map( + ctx, notebook_id, description, instructions, language, source_ids, json_output, client_auth +): @@ async def _run(): async with NotebookLMClient(client_auth) as client: nb_id_resolved = await resolve_notebook_id(client, nb_id) sources = await resolve_source_ids(client, nb_id_resolved, source_ids) + resolved_instructions = instructions if instructions is not None else (description or None) @@ result = await client.artifacts.generate_mind_map( nb_id_resolved, source_ids=sources, language=resolve_language(language), - instructions=description or None, + instructions=resolved_instructions, ) else: with console.status("Generating mind map..."): result = await client.artifacts.generate_mind_map( nb_id_resolved, source_ids=sources, language=resolve_language(language), - instructions=description or None, + instructions=resolved_instructions, )Also applies to: 1002-1002, 1023-1026, 1031-1034
🤖 Prompt for AI Agents