12345678910111213141516171819202122232425262728293031323334353637 |
- using UnityEngine;
- using System.Collections.Generic;
- namespace LLM.Editor.Analysis
- {
- /// <summary>
- /// A static registry that holds all the available "tools" (Context Providers)
- /// that the LLM can use to query the project.
- /// </summary>
- public static class ContextProviderRegistry
- {
- private static readonly Dictionary<string, IContextProvider> _providers = new();
- // This static constructor will be used in the next phase to register all our tools.
- static ContextProviderRegistry()
- {
- RegisterProvider("ComponentData", new ComponentDataProvider());
- RegisterProvider("SourceCode", new SourceCodeProvider());
- RegisterProvider("ProjectSettings", new ProjectSettingsProvider());
- RegisterProvider("FindAssets", new FindAssetsProvider());
- RegisterProvider("FindInScene", new FindInSceneProvider());
- RegisterProvider("ConsoleLog", new ConsoleLogProvider());
- }
- private static void RegisterProvider(string dataType, IContextProvider provider)
- {
- if (string.IsNullOrEmpty(dataType) || provider == null) return;
- _providers[dataType] = provider;
- }
- public static IContextProvider GetProvider(string dataType)
- {
- _providers.TryGetValue(dataType, out var provider);
- return provider;
- }
- }
- }
|