Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
5d12014
docs: update version badge for dev
actions-user Mar 31, 2025
1707635
docs: update version badge for dev to 0.2.0-dev.250331 (#90)
marc-romu Mar 31, 2025
1d2a89d
refactor(providers): migrated providers to a separate project
marc-romu Mar 31, 2025
d159723
remove readme from resources in mistralai provider
marc-romu Mar 31, 2025
2f7f173
fix(providers): fix openai build errors
marc-romu Mar 31, 2025
be07e42
fix(providers): openai build errors
marc-romu Mar 31, 2025
7add44b
merge from main (#93)
marc-romu Mar 31, 2025
0f42a37
feat(providers): migrate providers to separate project (#95)
marc-romu Mar 31, 2025
6168615
ci
marc-romu Mar 31, 2025
515aac5
chore(branch): merge main into marc-romu/chat
actions-user Mar 31, 2025
e547d09
chore(branch): merge main into dev
actions-user Mar 31, 2025
d984f49
chore(branch): update dev from main (#96)
marc-romu Mar 31, 2025
0062eaa
chore(branch): merge dev into marc-romu/chat
actions-user Mar 31, 2025
95ddedf
chore: auto-generated Resources.Designer in MistralAI provider
marc-romu Mar 31, 2025
c894f82
Merge branch 'marc-romu/chat' of https://github.com/architects-toolki…
marc-romu Mar 31, 2025
865da38
fix(settings): settings menu was hidden behind other windows.
marc-romu Mar 31, 2025
6857077
fix(settings): settings menu is no longer hidden behind other windows…
marc-romu Mar 31, 2025
24c040d
fix(chat): chat window is no longer freezing rhino.
marc-romu Mar 31, 2025
f91b5b6
refactor(chat): prevent errors when initializing chat
marc-romu Mar 31, 2025
02b74f8
fix(chat): Prevent UI freezing and make chat window non-blocking (#98)
marc-romu Mar 31, 2025
b831812
Merge remote-tracking branch 'origin/marc-romu/workflows' into update…
actions-user Apr 1, 2025
2f342ed
rector(aifilectx): rename AI Context component to AI File Context
marc-romu Apr 1, 2025
345f32d
rector(aifilectx): rename aicontext component to aifilecontext (#100)
marc-romu Apr 1, 2025
766a1b7
chore: update development version date to 0.2.0-dev.250401
actions-user Apr 1, 2025
6b4c0b8
chore: update development version date to 0.2.0-dev.250401 (#101)
marc-romu Apr 1, 2025
af1ef6e
Revert "chore: update development version date to 0.2.0-dev.250401"
marc-romu Apr 1, 2025
53ee1db
Revert "chore: update development version date to 0.2.0-dev.250401" (…
marc-romu Apr 1, 2025
66031b0
fix(workflows): too aggressive changelog commit in chore-version-dev-…
marc-romu Apr 1, 2025
b4532ca
docs: new release checklist
marc-romu Apr 1, 2025
f5e20cf
Merge remote-tracking branch 'origin/main' into update-branch/marc-ro…
actions-user Apr 2, 2025
6b4a1cf
feat(context): Enhance context management system to support multiple …
marc-romu Apr 2, 2025
96a7304
fix(context): missing reference
marc-romu Apr 2, 2025
c44242a
docs: rename aicontext to aifiltecontext
marc-romu Apr 2, 2025
dcdc59e
refactor(AIContextManager): Enhance context filtering with negative f…
marc-romu Apr 2, 2025
0ec3624
Merge branch 'dev' into marc-romu/chat
marc-romu Apr 2, 2025
453c3cb
feat(context): enhance context management system to support multiple …
marc-romu Apr 2, 2025
382a14d
docs: update version badge for dev
actions-user Apr 2, 2025
83544ee
docs: update version badge for dev to 0.2.0-dev.250402 (#108)
marc-romu Apr 2, 2025
71c96f0
Merge remote-tracking branch 'origin/main' into update-branch/dev-fro…
actions-user Apr 2, 2025
f7eac9e
chore(branch): update dev from main (#111)
marc-romu Apr 2, 2025
ee3db50
Merge remote-tracking branch 'origin/dev' into update-branch/marc-rom…
actions-user Apr 2, 2025
26fab66
docs(release_checklist): simplification of release checklist
marc-romu Apr 5, 2025
846af4c
Merge branch 'marc-romu/chat' of https://github.com/architects-toolki…
marc-romu Apr 5, 2025
96e3691
chore(aboutdialog): added ai disclaimer
marc-romu Apr 5, 2025
3630383
chore(aboutdialog): thanks to opensource projects
marc-romu Apr 5, 2025
9a41c80
chore(context): updated context message
marc-romu Apr 5, 2025
6d61ff6
refactor
marc-romu Apr 6, 2025
28329ba
refactor(about): add scroll bar
marc-romu Apr 6, 2025
988419e
ci: changed version to 0.2.0-dev.250406
marc-romu Apr 6, 2025
ee164bd
refactor(about): improvements in text and visualization of the about …
marc-romu Apr 6, 2025
7f01d18
docs: update changelog with 1 closed issues
actions-user Apr 6, 2025
6bfd7c4
refactor(about): improvements in the text and visualization of the ab…
marc-romu Apr 6, 2025
e48e318
docs: update version badge for dev
actions-user Apr 6, 2025
2d28f0d
docs: update version badge for dev to 0.2.0-dev.250406 (#116)
marc-romu Apr 6, 2025
0da4d6e
fix(aichat): allow only one open chat dialog per component
marc-romu Apr 6, 2025
b01f230
fix(aichat): issue when chat dialog remained hidden behind other rhin…
marc-romu Apr 6, 2025
8273c6e
fix(aichat): eventual freezing of all Rhino-related dialogs on init t…
marc-romu Apr 6, 2025
d195273
fix(aichat): several usability improvements in the ai chat dialog (#117)
marc-romu Apr 6, 2025
92df27e
chore: preparation for 0.2.0-alpha release
marc-romu Apr 6, 2025
7382e31
docs: update version badge for dev
actions-user Apr 6, 2025
598be6f
docs: update version badge for dev to 0.2.0-alpha (#118)
marc-romu Apr 6, 2025
535dbfd
refactor(providermanager): added warning line when two providers are …
marc-romu Apr 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
- name: "component: AI GroupTitle"
color: "000"
description: "Issues related to the AI GroupTitle component"
- name: "component: AI Context"
- name: "component: AI File Context"
color: "000"
description: "Issues related to the AI Context component"
description: "Issues related to the AI File Context component"
- name: "component: AI Chat"
color: "000"
description: "Issues related to the Chat component"
Expand Down
1 change: 1 addition & 0 deletions .windsurfrules
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
- Components should be named with the pattern [Category][Action][Type]Component (e.g., AITextGenerateComponent).
- Consider using AIStatefulAsyncComponentBase since it already implements most of the required structure to manage AI methods, states and async operations.
8. When asked for a PR/commit title or description, follow the rules in @.github/PULL_REQUEST_TEMPLATE.md
9. Make only targeted edits to existing code.

When the user asks you to add, change, deprecate, remove, fix, or security edit the code, if changes are relevant, mention them in the @CHANGELOG.md file under the "Unreleased" section. Do not modify other parts of the file. Subsections should be limited to and ordered as follows: Added, Changed, Deprecated, Removed, Fixed, Security
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]



## [0.2.0-alpha] - 2025-04-06

### Added

- Added modular provider architecture:
- Created new provider project structure (SmartHopper.Providers.MistralAI) with dedicated resources.
- Created new provider project structure (SmartHopper.Providers.OpenAI) with dedicated resources.
- Added IAIProviderFactory interface for dynamic provider discovery.
- Implemented ProviderManager for runtime loading and management of providers.
- Added IsEnabled property to IAIProvider interface to allow disabling template or experimental providers.
- Created SmartHopper.Providers.Template project as a guide for implementing new providers.
- Added the new AIChat component with interactive chat interface and proper icon.
- Added WebView-based chat interface with AIChatComponent, WebChatDialog class, HtmlChatRenderer utility class, and ChatResourceManager.
- Added RunOnlyOnInputChanges property to StatefulAsyncComponentBase to control component execution behavior.
Expand All @@ -21,9 +32,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- HTML tags like underline in Markdown text.
- Dedicated Markdown class in the Converters namespace for centralized markdown processing.
- Added a "Supported Data Types" section to README.md documenting currently supported and planned Grasshopper-native types.
- New update-changelog-issues action and github-pr-update-changelog-issues to automatically mention missing closed issues in the changelog.

### Changed

- Refactored AI provider architecture:
- Migrated MistralAI provider to a separate project (SmartHopper.Providers.MistralAI).
- Migrated OpenAI provider to a separate project (SmartHopper.Providers.OpenAI).
- Updated SmartHopperSettings to use ProviderManager for provider discovery.
- Modified AIStatefulAsyncComponentBase to use the new provider handling approach.
- Changed provider discovery to load assemblies from the main application directory instead of a separate "Providers" subdirectory.
- Enhanced ProviderManager to only register providers that have IsEnabled set to true.
- Added warning log when duplicate AI providers are encountered during registration instead of silently ignoring them.
- Modified AIChatComponent to always run when the Run parameter is true, regardless of input changes.
- Improved version badge workflow to also update badges when color doesn't match the requirements based on version type.
- Improved ChatDialog UI with numerous enhancements:
Expand All @@ -33,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Message selection and copying capabilities with a context menu.
- Automatic message height adjustment based on content and removal of visible scrollbars.
- Improved scrolling behavior.
- Allow only one chat dialog to be open per AI Chat Component. When running the component again, if there is a linked chat dialog, it will be focused instead of opening a new one.
- Enhanced About dialog:
- Decreased font size.
- Defined a minimum size.
Expand All @@ -51,9 +72,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Create platform-specific zip files (Rhino8-Windows, Rhino8-Mac) instead of a single zip with subfolders.
- Improved error handling in the AIStatefulAsyncComponentBase.
- Updated settings menu to use Eto.Forms and Eto.Drawing.
- Renamed the AI Context component to AI File Context.
- Enhanced context management system:
- Support for multiple simultaneous context providers
- Automatic time and environment context in AIChatComponent
- Filtering capabilities for context by provider ID and specific context keys
- Context filtering with comma-separated lists for multiple criteria
- Exclusion filtering with minus prefix (e.g., "-time" excludes the time provider while including all others)
- Modified AboutDialog to inform users about the nature and limitations of AI-generated content

### Removed

- Removed MistralAI provider from SmartHopper.Config project as part of the modular architecture implementation.
- Removed OpenAI provider from SmartHopper.Config project as part of the modular architecture implementation.
- Removed dependency on HtmlAgilityPack

### Fixed
Expand All @@ -65,6 +96,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixes "Bug: Settings menu hides sometimes" ([#94](https://github.com/architects-toolkit/SmartHopper/issues/94)).
- Fixes "Bug: AI Chat component freezes all Rhino!" ([#85](https://github.com/architects-toolkit/SmartHopper/issues/85)).
- Fixes "Bug: Settings Menu is incompatible with Mac" ([#12](https://github.com/architects-toolkit/SmartHopper/issues/12)).
- Fixes "AI disclaimer in chat and about" ([#114](https://github.com/architects-toolkit/SmartHopper/issues/114)).
- Fixed a bug opening the chat dialog that eventually froze the application.
- Fixed a bug where the chat dialog was not on top when clicking on it from the windows taskbar.

## [0.1.2-alpha] - 2025-03-17

Expand Down
13 changes: 11 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ Are you skilled in coding and want to contribute to SmartHopper? You can help fi
- Create a new branch referencing the issue you want to fix or feature you want to add
- Submit a Pull Request following the [Pull Request Guidelines](#pull-request-guidelines) explained below

### 4. **Release Checklist**

Before submitting a release, please ensure you have completed the checks in the [RELEASE_CHECKLIST.md](RELEASE_CHECKLIST.md).

## Discussion Forum

We have a discussion forum available for you to engage with the community:
- General discussions: [SmartHopper Discussions](https://github.com/architects-toolkit/SmartHopper/discussions/categories/general)
- Feature requests: [Ideas](https://github.com/architects-toolkit/SmartHopper/discussions/categories/ideas)
- Support questions: [Q&A](https://github.com/architects-toolkit/SmartHopper/discussions/categories/q-a)

## Pull Request Guidelines

1. Focus each PR on a single feature or bug fix
Expand Down Expand Up @@ -123,5 +134,3 @@ Describe the testing you've done to validate your changes.
- [ ] PR title follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.1.0/) format
- [ ] PR description follows [Pull Request Description Template](https://github.com/architects-toolkit/SmartHopper/blob/main/CONTRIBUTING.md#pull-request-description-template)
```


6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SmartHopper - AI-Powered Grasshopper3D Plugin

[![Version](https://img.shields.io/badge/version-0%2E2%2E0--dev%2E250401-brown)](https://github.com/architects-toolkit/SmartHopper/releases)
[![Status](https://img.shields.io/badge/status-Unstable%20Development-brown)](https://github.com/architects-toolkit/SmartHopper/releases)
[![Version](https://img.shields.io/badge/version-0%2E2%2E0--alpha-orange)](https://github.com/architects-toolkit/SmartHopper/releases)
[![Status](https://img.shields.io/badge/status-Alpha-orange)](https://github.com/architects-toolkit/SmartHopper/releases)
[![Grasshopper](https://img.shields.io/badge/plugin_for-Grasshopper3D-darkgreen?logo=rhinoceros)](https://www.rhino3d.com/)
[![MistralAI](https://img.shields.io/badge/AI--powered-MistralAI-orange)](https://mistral.ai/)
[![OpenAI](https://img.shields.io/badge/AI--powered-OpenAI-blue?logo=openai)](https://openai.com/)
Expand Down Expand Up @@ -45,7 +45,7 @@ SmartHopper is not yet available through Food4Rhino. We will be releasing it soo
| AI List Filter (AiListFilter)<br><sub>Process items in lists (reorder, shuffle, filter, etc.) based on AI-driven rules</sub> | ⚪ | 🟡 | 🟠 | 🟢 |
| AI List Generate (AiListGenerate)<br><sub>Generate lists dynamically using AI algorithms</sub> | ⚪ | - | - | - |
| AI GroupTitle (AiGroupTitle)<br><sub>Group components and set a meaningful title to the group</sub> | ⚪ | - | - | - |
| AI Context (AiContext)<br><sub>Set a context for the current document</sub> | ⚪ | 🟡 | 🟠 | 🟢 |
| AI File Context (AiFileContext)<br><sub>Set a context for the current document</sub> | ⚪ | 🟡 | 🟠 | 🟢 |
| AI Chat (AiChat)<br><sub>Interactive AI-powered conversational interface</sub> | ⚪ | 🟡 | - | - |
| AI Chat Input (AiChatInput)<br><sub>Send some data from your Grasshopper to the AI Chat</sub> | ⚪ | - | - | - |
| AI Chat Output (AiChatOutput)<br><sub>Receive some data from the AI Chat to your Grasshopper</sub> | ⚪ | - | - | - |
Expand Down
74 changes: 74 additions & 0 deletions RELEASE_CHECKLIST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Release Checklist

This document outlines the necessary checks before releasing SmartHopper at different stages of development. The checklist is progressive, with more stringent requirements for later stages of release.

## Alpha Release Checklist

Alpha releases are early development versions intended for internal testing and limited external testing. They may contain bugs and incomplete features.

- [ ] All projects build successfully
- [ ] Basic functionality works as expected
- [ ] Plugin loads in Grasshopper without crashing
- [ ] Core components function at a basic level
- [ ] CHANGELOG.md is updated with new features and known issues
- [ ] README.md is updated with basic installation instructions
- [ ] All dependencies are properly included in the package

## Beta Release Checklist

Beta releases are more stable than alpha releases and are intended for wider testing. They may still contain some bugs but should be more feature-complete.

*Include all Alpha checks, plus:*

- [ ] All planned features for this version are implemented (even if not fully polished)
- [ ] Major bugs identified in alpha are fixed
- [ ] Basic error messages are implemented
- [ ] All providers load properly
- [ ] Basic user documentation is available
- [ ] Performance testing has been conducted for core functionality
- [ ] Code has been reviewed for obvious security issues

## Release Candidate (RC) Checklist

RC releases should be very close to the final product. They should be feature-complete and mostly bug-free.

*Include all Beta checks, plus:*

- [ ] All features are complete and working as expected
- [ ] All known critical and high-priority bugs are fixed
- [ ] All UI elements are properly styled and consistent
- [ ] Components are functional across supported platforms (Windows/Mac)
- [ ] Error messages are clear and helpful
- [ ] All providers have been tested with their respective AI services
- [ ] Documentation is complete and accurate
- [ ] Installation and uninstallation processes work correctly
- [ ] Resource usage (memory, CPU) is within acceptable limits
- [ ] Third-party dependencies are up-to-date and secure

## General Release Checklist

General releases are production-ready and should be stable, secure, and well-documented.

*Include all RC checks, plus:*

- [ ] All known bugs are fixed or documented as known issues
- [ ] All features are fully documented with examples
- [ ] Security review is complete
- [ ] Accessibility standards are met where applicable
- [ ] All automated tests pass
- [ ] Manual testing on all supported platforms is complete
- [ ] User feedback from RC has been addressed
- [ ] License and copyright information is up-to-date
- [ ] Release notes are complete and accurate
- [ ] Support resources are in place
- [ ] Community announcements are ready

## Additional Considerations

| **Consideration** | **Alpha** | **Beta** | **RC** | **General** |
|--------------|-------|------|----|---------|
| **Version Compatibility** | Breaking changes allowed | Minimize breaking changes | Strictly limit breaking changes | No breaking changes without migration guide |
| **Documentation Requirements** | Basic README | Core feature docs | Full feature documentation | Comprehensive guides and tutorials |
| **Testing Coverage** | Basic functionality | Extended edge case testing | Performance and cross-platform | Full regression test suite |
| **Provider Compatibility** | Min. one provider | Major providers functional | All providers functional | Thorough provider service testing |
| **UI/UX Requirements** | Basic functionality | Mostly complete UI | Polished and consistent | Fully intuitive and refined UI |
15 changes: 15 additions & 0 deletions SmartHopper.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartHopper.Menu", "src\Sma
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartHopper.Components.Test", "src\SmartHopper.Components.Test\SmartHopper.Components.Test.csproj", "{B932CFFA-0C82-4A1F-92F2-003CDE1C94AE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartHopper.Providers.MistralAI", "src\SmartHopper.Providers.MistralAI\SmartHopper.Providers.MistralAI.csproj", "{F2063A0F-FDF2-4AD2-8C92-1E374B991752}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartHopper.Providers.OpenAI", "src\SmartHopper.Providers.OpenAI\SmartHopper.Providers.OpenAI.csproj", "{087FFA5E-1049-459D-9C68-1C0B8E7F9EBC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -45,6 +49,15 @@ Global
{B932CFFA-0C82-4A1F-92F2-003CDE1C94AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B932CFFA-0C82-4A1F-92F2-003CDE1C94AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B932CFFA-0C82-4A1F-92F2-003CDE1C94AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B932CFFA-0C82-4A1F-92F2-003CDE1C94AE}.Release|Any CPU.Build.0 = Release|Any CPU
{F2063A0F-FDF2-4AD2-8C92-1E374B991752}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F2063A0F-FDF2-4AD2-8C92-1E374B991752}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2063A0F-FDF2-4AD2-8C92-1E374B991752}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2063A0F-FDF2-4AD2-8C92-1E374B991752}.Release|Any CPU.Build.0 = Release|Any CPU
{087FFA5E-1049-459D-9C68-1C0B8E7F9EBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{087FFA5E-1049-459D-9C68-1C0B8E7F9EBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{087FFA5E-1049-459D-9C68-1C0B8E7F9EBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{087FFA5E-1049-459D-9C68-1C0B8E7F9EBC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -56,5 +69,7 @@ Global
{A932CFFA-0C82-4A1F-92F2-003CDE1C94AC} = {05A44F09-190D-434E-A91B-0ECA631110FE}
{B932CFFA-0C82-4A1F-92F2-003CDE1C94AD} = {05A44F09-190D-434E-A91B-0ECA631110FE}
{B932CFFA-0C82-4A1F-92F2-003CDE1C94AE} = {05A44F09-190D-434E-A91B-0ECA631110FE}
{F2063A0F-FDF2-4AD2-8C92-1E374B991752} = {05A44F09-190D-434E-A91B-0ECA631110FE}
{087FFA5E-1049-459D-9C68-1C0B8E7F9EBC} = {05A44F09-190D-434E-A91B-0ECA631110FE}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion Solution.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<SolutionVersion>0.2.0-dev.250401</SolutionVersion>
<SolutionVersion>0.2.0-alpha</SolutionVersion>
</PropertyGroup>
</Project>
27 changes: 26 additions & 1 deletion src/SmartHopper.Components/AI/AIChatComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Grasshopper.Kernel;
using Grasshopper.Kernel.Types;
using SmartHopper.Config.Models;
using SmartHopper.Core.AI;
using SmartHopper.Core.AI.Chat;
using SmartHopper.Core.ComponentBase;

Expand All @@ -29,6 +30,9 @@ namespace SmartHopper.Components.AI
/// </summary>
public class AIChatComponent : AIStatefulAsyncComponentBase
{
private TimeContextProvider _timeProvider;
private EnvironmentContextProvider _environmentProvider;

/// <summary>
/// Initializes a new instance of the AIChatComponent class.
/// </summary>
Expand All @@ -42,6 +46,26 @@ public AIChatComponent()
{
// Set RunOnlyOnInputChanges to false to ensure the component always runs when the Run parameter is true
RunOnlyOnInputChanges = false;

// Create and register time and environment context providers
_timeProvider = new TimeContextProvider();
_environmentProvider = new EnvironmentContextProvider();

AIContextManager.RegisterProvider(_timeProvider);
AIContextManager.RegisterProvider(_environmentProvider);
}

/// <summary>
/// Called when the component is removed from the canvas
/// </summary>
/// <param name="document">The Grasshopper document</param>
public override void RemovedFromDocument(GH_Document document)
{
// Unregister the context providers
AIContextManager.UnregisterProvider(_timeProvider);
AIContextManager.UnregisterProvider(_environmentProvider);

base.RemovedFromDocument(document);
}

/// <summary>
Expand Down Expand Up @@ -137,7 +161,8 @@ public override async System.Threading.Tasks.Task DoWorkAsync(CancellationToken
actualProvider,
_component.GetModel(),
_component.GetEndpoint(),
_progressReporter);
_progressReporter,
_component.InstanceGuid); // Pass the component's instance GUID

// Process the chat
await chatWorker.ProcessChatAsync(token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,25 @@ namespace SmartHopper.Components.AI
/// <summary>
/// Component that provides context for AI queries
/// </summary>
public class AIContextComponent : GH_Component, IAIContextProvider
public class AIFileContextComponent : GH_Component, IAIContextProvider
{
private string _context;

/// <summary>
/// Constructor for the AI Context component
/// Gets the provider identifier
/// </summary>
public AIContextComponent()
: base("AI Context", "AICtx",
public string ProviderId => "file";

/// <summary>
/// Constructor for the AI File Context component
/// </summary>
public AIFileContextComponent()
: base("AI File Context", "AIFileCtx",
"Defines the current file context for AI-powered components",
"SmartHopper", "AI")
{
// Register this component as the context provider
AIContextManager.SetContextProvider(this);
// Register this component as a context provider
AIContextManager.RegisterProvider(this);
}

protected override void RegisterInputParams(GH_InputParamManager pManager)
Expand Down
2 changes: 1 addition & 1 deletion src/SmartHopper.Components/List/AIListEvaluate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private static async Task<Dictionary<string, List<GH_Boolean>>> ProcessData(Dict
var evaluationResult = await ListTools.EvaluateListAsync(
currentList.Value,
question,
messages => parent.GetResponse(messages));
messages => parent.GetResponse(messages, contextProviderFilter: "-environment,-time"));

if (!evaluationResult.Success)
{
Expand Down
Loading
Loading