Skip to content

Conversation

@johnpierson
Copy link
Member

@johnpierson johnpierson commented Jun 13, 2025

Purpose

This PR adds a fallback to local help files when ML-based node autocomplete suggestions are unavailable and refactors internal access to support the extension.

  • Introduce a new LocalAutoCompleteService to query package and built-in help files.
  • Update NodeAutoCompleteBarViewModel to use local fallback and expose internals.
  • Add a new constructor in SingleResultItem to support port-based instantiation.

20250613-localDNA

Declarations

Check these if you believe they are true

  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB
  • This PR introduces new feature code involve network connecting and is tested with no-network mode.

Release Notes

N/A

Reviewers

@DynamoDS/synapse

FYIs

@DynamoDS/eidos

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-8766

@johnpierson

This comment was marked as outdated.

@johnpierson johnpierson marked this pull request as ready for review June 13, 2025 18:52
@johnpierson johnpierson requested review from Copilot June 13, 2025 18:53

This comment was marked as outdated.

This comment was marked as outdated.

@johnpierson johnpierson requested a review from Copilot June 23, 2025 20:42

This comment was marked as outdated.

@johnpierson johnpierson requested a review from Copilot June 23, 2025 20:50

This comment was marked as outdated.

@BogdanZavu
Copy link
Contributor

For the candidate help file we are looking for
AppData\Roaming\Dynamo\Dynamo Core\3.6\packages\Clockwork for Dynamo 3.x\doc\a9ad1519-73f2-4015-97e3-03c6b9a484eb.dyn
That is indeed the creation name but perhaps we should look for category as help - which in this case is more human readable e.g Clockwork.Display.Create.

@BogdanZavu
Copy link
Contributor

@johnpierson can you recommend some packages that worth installing while testing this ?
We are doing all this in an worker thread but still I'm wondering if this could be problematic performance wise if it happens to target a big package with lots of custom nodes and help files and/or a lot of packages are installed. We are narrowing down on every step so we should probably be fine.

This is a very nice enhancement overall! LGTM!

@johnpierson
Copy link
Member Author

johnpierson commented Jun 27, 2025

@johnpierson can you recommend some packages that worth installing while testing this ? We are doing all this in an worker thread but still I'm wondering if this could be problematic performance wise if it happens to target a big package with lots of custom nodes and help files and/or a lot of packages are installed. We are narrowing down on every step so we should probably be fine.

I would say that the following are good (but not sure which ones actually have .md docs in the docs folder, Rhythm doesn't but can pretty quickly I think).

  • Clockwork
  • Rhythm
  • Orchid
  • GeniusLoci

@johnpierson
Copy link
Member Author

For the candidate help file we are looking for AppData\Roaming\Dynamo\Dynamo Core\3.6\packages\Clockwork for Dynamo 3.x\doc\a9ad1519-73f2-4015-97e3-03c6b9a484eb.dyn That is indeed the creation name but perhaps we should look for category as help - which in this case is more human readable e.g Clockwork.Display.Create.

I fixed this to search based on category and node name. However, clockwork does not ship .dyn samples within the docs folder. Only .md. 🫠 His .md files instruct the user to download from Github. So the search won't find nodes for clockwork using this method. But it is fixed! 😃

@johnpierson johnpierson requested a review from Copilot June 27, 2025 03:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a fallback mechanism to use local help files when ML-based node autocomplete suggestions fail, and refactors several classes to support this extension.

  • Introduce LocalAutoCompleteService for querying local package and built-in help files.
  • Update NodeAutoCompleteBarViewModel to invoke the local fallback and expose internals.
  • Extend SingleResultItem with a new constructor for port-based instantiation and adjust assembly accessibility.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/NodeAutoCompleteViewExtension/ViewModels/SingleResultItem.cs Added constructor to create items from a NodeModel and port
src/NodeAutoCompleteViewExtension/ViewModels/NodeAutoCompleteBarViewModel.cs Integrated LocalAutoCompleteService fallback in ML lookup and adjusted AddCluster
src/NodeAutoCompleteViewExtension/Services/LocalAutoCompleteService.cs New service with methods for package and built-in help file search
src/DynamoUtilities/Properties/AssemblyInfo.cs Granted InternalsVisibleTo("NodeAutoCompleteViewExtension")
src/DynamoCore/Models/DynamoModel.cs Changed OpenJsonFile from private to internal
Comments suppressed due to low confidence (6)

src/NodeAutoCompleteViewExtension/Services/LocalAutoCompleteService.cs:79

  • The local variable daName is assigned but never used. It can be removed to clean up the method GetNodeFullName.
                    var daName = $"{selectedNode.Category}.{selectedNode.GetOriginalName()}";

src/NodeAutoCompleteViewExtension/Services/LocalAutoCompleteService.cs:46

  • Add unit tests for TryGetLocalAutoCompleteResult, covering package and built-in fallback paths to ensure this new functionality is validated.
        public List<SingleResultItem> TryGetLocalAutoCompleteResult(NodeModel selectedNode, PortModel selectedPortModel)

src/DynamoCore/Models/DynamoModel.cs:2434

  • Since OpenJsonFile is now internal, consider adding or updating its XML doc comment to explain why external callers need access.
        internal bool OpenJsonFile(

src/DynamoUtilities/Properties/AssemblyInfo.cs:34

  • [nitpick] Add a brief comment explaining why this internal exposure is needed to help future maintainers understand its purpose.
[assembly: InternalsVisibleTo("NodeAutoCompleteViewExtension")]

src/NodeAutoCompleteViewExtension/ViewModels/SingleResultItem.cs:21

  • This new constructor lacks an XML doc comment. Consider adding a <summary> that explains its parameters and intended use.
        public SingleResultItem(NodeModel nodeModel, int portToConnect, double score = 1.0)

src/NodeAutoCompleteViewExtension/ViewModels/NodeAutoCompleteBarViewModel.cs:860

  • [nitpick] var is used elsewhere in this file for consistency. Consider reverting to var newNode = ... or updating other declarations to explicit types for a uniform style.
                    NodeModel newNode = dynamoModel.CreateNodeFromNameOrType(Guid.NewGuid(), typeInfo.FullName, true);

johnpierson and others added 3 commits June 30, 2025 11:26
…arViewModel.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@johnpierson johnpierson merged commit 59dd469 into DynamoDS:master Jun 30, 2025
24 of 25 checks passed
@johnpierson johnpierson deleted the dyn8766_LocalDNA branch June 30, 2025 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants