update commit prev

This commit is contained in:
2026-04-26 16:49:23 -07:00
parent 39ee857559
commit bfd5c20dc3
25 changed files with 231 additions and 77 deletions
+27 -15
View File
@@ -61,11 +61,15 @@ def get_store_schema(store_type: str) -> List[ConfigField]:
return _call_schema(cls, f"store '{store_type}'")
def get_provider_schema(provider_name: str) -> List[ConfigField]:
plugin_class = get_plugin_class(str(provider_name or "").strip())
def get_plugin_schema(plugin_name: str) -> List[ConfigField]:
plugin_class = get_plugin_class(str(plugin_name or "").strip())
if plugin_class is None:
return []
return _call_schema(plugin_class, f"provider '{provider_name}'")
return _call_schema(plugin_class, f"plugin '{plugin_name}'")
def get_provider_schema(provider_name: str) -> List[ConfigField]:
return get_plugin_schema(provider_name)
def get_tool_schema(tool_name: str) -> List[ConfigField]:
@@ -85,8 +89,8 @@ def get_item_schema(item_type: str, item_name: str) -> List[ConfigField]:
normalized_name = str(item_name or "").strip()
if normalized_type.startswith("store-"):
return get_store_schema(normalized_type.replace("store-", "", 1))
if normalized_type == "provider":
return get_provider_schema(normalized_name)
if normalized_type in {"provider", "plugin"}:
return get_plugin_schema(normalized_name)
if normalized_type == "tool":
return get_tool_schema(normalized_name)
return []
@@ -126,25 +130,29 @@ def build_default_store_config(store_type: str, instance_name: str) -> Dict[str,
return config
def build_default_provider_config(provider_name: str) -> Dict[str, Any]:
def build_default_plugin_config(plugin_name: str) -> Dict[str, Any]:
config: Dict[str, Any] = {}
schema = get_provider_schema(provider_name)
schema = get_plugin_schema(plugin_name)
if schema:
for field in schema:
config[field["key"]] = field.get("default", "")
return config
plugin_class = get_plugin_class(str(provider_name or "").strip())
plugin_class = get_plugin_class(str(plugin_name or "").strip())
if plugin_class is None:
return config
try:
for required_key in plugin_class.required_config_keys():
config[str(required_key)] = ""
except Exception:
logger.exception("Failed to load legacy required config keys for provider '%s'", provider_name)
logger.exception("Failed to load legacy required config keys for plugin '%s'", plugin_name)
return config
def build_default_provider_config(provider_name: str) -> Dict[str, Any]:
return build_default_plugin_config(provider_name)
def build_default_tool_config(tool_name: str) -> Dict[str, Any]:
config: Dict[str, Any] = {}
for field in get_tool_schema(tool_name):
@@ -179,14 +187,14 @@ def get_required_config_keys(item_type: str, item_name: str) -> List[str]:
if cls is not None:
for required_key in _required_keys_for(cls):
_add_key(required_key)
elif normalized_type == "provider":
elif normalized_type in {"provider", "plugin"}:
plugin_class = get_plugin_class(normalized_name)
if plugin_class is not None:
try:
for required_key in plugin_class.required_config_keys():
_add_key(required_key)
except Exception:
logger.exception("Failed to load required config keys for provider '%s'", normalized_name)
logger.exception("Failed to load required config keys for plugin '%s'", normalized_name)
return required_keys
@@ -199,14 +207,18 @@ def get_configurable_store_types() -> List[str]:
return sorted(set(options))
def get_configurable_provider_types() -> List[str]:
def get_configurable_plugin_types() -> List[str]:
options: List[str] = []
for provider_name in list_plugins().keys():
if get_provider_schema(provider_name):
options.append(str(provider_name))
for plugin_name in list_plugins().keys():
if get_plugin_schema(plugin_name):
options.append(str(plugin_name))
return sorted(set(options))
def get_configurable_provider_types() -> List[str]:
return get_configurable_plugin_types()
def get_configurable_tool_types() -> List[str]:
options: List[str] = []
try: