mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-08 06:46:02 +00:00
fix(rag): align knowledge engine plugin actions
This commit is contained in:
@@ -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<string, string> = {
|
||||
'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({
|
||||
|
||||
@@ -41,6 +41,18 @@ export function isDynamicFormItemType(
|
||||
}
|
||||
|
||||
export function parseDynamicFormItemType(value: string): DynamicFormItemType {
|
||||
const typeMap: Record<string, DynamicFormItemType> = {
|
||||
[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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user