Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongTang committed Mar 7, 2024
1 parent e8a3dd7 commit 8ccfeba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DynamoVisualProgramming.DynamoCoreNodes" Version="3.1.0-beta4081" />
<PackageReference Include="DynamoVisualProgramming.DynamoServices" Version="3.1.0-beta4081" />
<PackageReference Include="DynamoVisualProgramming.WpfUILibrary" Version="3.1.0-beta4081" />
<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary" Version="3.1.0-beta4081" />
<PackageReference Include="DynamoVisualProgramming.DynamoServices" Version="3.1.0-beta4307" />
<PackageReference Include="DynamoVisualProgramming.WpfUILibrary" Version="3.1.0-beta4307" />
<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary" Version="3.1.0-beta4307" />
<PackageReference Include="OpenAI" Version="1.10.0" />
<PackageReference Include="RestSharp" Version="108.0.1" />
</ItemGroup>
Expand Down
22 changes: 18 additions & 4 deletions src/DynamoAssistantViewExtension/DynamoAssistantWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,25 @@ internal async void SendMessage(string msg)
string response = await conversation.GetResponseFromChatbotAsync();
// Display the chatbot's response
Messages.Add("Copilot:\n" + response + "\n");
//var pythonNode = new PythonNodeModels.PythonNode();
//dynamoModel.ExecuteCommand(new DynamoModel.CreateNodeCommand(pythonNode, 0, 0, false, false));


// Use Regex to split only the Python code from the response
CreatePythonNode(response);

// create a Dynamo note example
CreateNote("A1BE9F01-55C4-495E-B24C-099D018A29CE", "This is a sample Note.", 0, 0, true);
// CreateNote((new Guid()).ToString(), "This is a sample Note.", 0, 0, true);
}

/// <summary>
/// Create a python node in Dynamo, use latest Nuget package for this
/// </summary>
/// <param name="pythonScript"></param>
internal void CreatePythonNode(string pythonScript)
{
var pythonNode = new PythonNodeModels.PythonNode
{
Script = pythonScript
};
dynamoModel.ExecuteCommand(new DynamoModel.CreateNodeCommand(pythonNode, 0, 0, true, false));
}

internal void CreateNote(string nodeId, string noteText, double x, double y, bool defaultPosition)
Expand Down

0 comments on commit 8ccfeba

Please sign in to comment.