diff --git a/src/langbot/pkg/plugin/connector.py b/src/langbot/pkg/plugin/connector.py index 034dc94f..7ddb88e2 100644 --- a/src/langbot/pkg/plugin/connector.py +++ b/src/langbot/pkg/plugin/connector.py @@ -660,15 +660,6 @@ class PluginRuntimeConnector: async for ret in gen: yield ret - # KnowledgeRetriever methods - async def list_knowledge_retrievers(self, bound_plugins: list[str] | None = None) -> list[dict[str, Any]]: - """List all available KnowledgeRetriever components.""" - if not self.is_enable_plugin: - return [] - - retrievers_data = await self.handler.list_knowledge_retrievers(include_plugins=bound_plugins) - return retrievers_data - async def retrieve_knowledge( self, plugin_author: str, diff --git a/src/langbot/pkg/plugin/handler.py b/src/langbot/pkg/plugin/handler.py index b90f51b1..c65a0056 100644 --- a/src/langbot/pkg/plugin/handler.py +++ b/src/langbot/pkg/plugin/handler.py @@ -979,7 +979,7 @@ class RuntimeConnectionHandler(handler.Handler): except Exception as e: return _make_rag_error_response(e, 'VectorStoreError', collection_id=collection_id) - @self.action(PluginToRuntimeAction.GET_KNOWLEDEGE_FILE_STREAM) + @self.action(PluginToRuntimeAction.GET_KNOWLEDGE_FILE_STREAM) async def get_knowledge_file_stream(data: dict[str, Any]) -> handler.ActionResponse: storage_path = data['storage_path'] try: diff --git a/src/langbot/pkg/rag/service/runtime.py b/src/langbot/pkg/rag/service/runtime.py index 0de1ae88..1dc62bd5 100644 --- a/src/langbot/pkg/rag/service/runtime.py +++ b/src/langbot/pkg/rag/service/runtime.py @@ -107,7 +107,7 @@ class RAGRuntimeService: ) async def get_file_stream(self, storage_path: str) -> bytes: - """Handle GET_KNOWLEDEGE_FILE_STREAM action. + """Handle GET_KNOWLEDGE_FILE_STREAM action. Uses the storage manager abstraction to load file content, regardless of the underlying storage provider. diff --git a/uv.lock b/uv.lock index d391baac..42aa794b 100644 --- a/uv.lock +++ b/uv.lock @@ -2036,7 +2036,7 @@ dev = [ [[package]] name = "langbot-plugin" -version = "0.3.10" +version = "0.3.11" source = { editable = "../langbot-plugin-sdk" } dependencies = [ { name = "aiofiles" }, diff --git a/web/src/app/home/components/dynamic-form/DynamicFormComponent.tsx b/web/src/app/home/components/dynamic-form/DynamicFormComponent.tsx index 9e2df54d..814669f0 100644 --- a/web/src/app/home/components/dynamic-form/DynamicFormComponent.tsx +++ b/web/src/app/home/components/dynamic-form/DynamicFormComponent.tsx @@ -26,6 +26,7 @@ import { Button } from '@/components/ui/button'; import { Copy, Check, Globe, QrCode } from 'lucide-react'; import { copyToClipboard } from '@/app/utils/clipboard'; import { systemInfo } from '@/app/infra/http'; +import { parseDynamicFormItemType } from './DynamicFormItemConfig'; /** * Resolve the value referenced by a `show_if.field` string. @@ -196,14 +197,8 @@ function WebhookUrlField({ /** * Normalize plugin manifest type names to frontend-compatible types */ -function normalizeItemType(type: string): string { - const typeMap: Record = { - 'select-llm-model': DynamicFormItemType.LLM_MODEL_SELECTOR, - 'select-knowledge-bases': DynamicFormItemType.KNOWLEDGE_BASE_MULTI_SELECTOR, - number: DynamicFormItemType.FLOAT, - json: DynamicFormItemType.TEXT, - }; - return typeMap[type] || type; +function normalizeItemType(type: string): DynamicFormItemType { + return parseDynamicFormItemType(type); } export default function DynamicFormComponent({ diff --git a/web/src/app/home/components/dynamic-form/DynamicFormItemConfig.ts b/web/src/app/home/components/dynamic-form/DynamicFormItemConfig.ts index 50ac578a..7785b576 100644 --- a/web/src/app/home/components/dynamic-form/DynamicFormItemConfig.ts +++ b/web/src/app/home/components/dynamic-form/DynamicFormItemConfig.ts @@ -41,6 +41,18 @@ export function isDynamicFormItemType( } export function parseDynamicFormItemType(value: string): DynamicFormItemType { + const typeMap: Record = { + [DynamicFormItemType.SELECT_LLM_MODEL]: + DynamicFormItemType.LLM_MODEL_SELECTOR, + [DynamicFormItemType.SELECT_KNOWLEDGE_BASES]: + DynamicFormItemType.KNOWLEDGE_BASE_MULTI_SELECTOR, + [DynamicFormItemType.NUMBER]: DynamicFormItemType.FLOAT, + [DynamicFormItemType.JSON]: DynamicFormItemType.TEXT, + }; + if (value in typeMap) { + return typeMap[value]; + } + return isDynamicFormItemType(value) ? value : DynamicFormItemType.UNKNOWN; }