fix(rag): align knowledge engine plugin actions

This commit is contained in:
huanghuoguoguo
2026-05-16 10:34:10 +08:00
parent 711f12d71f
commit 395572c64d
5 changed files with 17 additions and 19 deletions

View File

@@ -32,6 +32,7 @@ import {
TooltipTrigger,
} from '@/components/ui/tooltip';
import { systemInfo } from '@/app/infra/http';
import { parseDynamicFormItemType } from './DynamicFormItemConfig';
/**
* Resolve the value referenced by a `show_if.field` string.
@@ -204,14 +205,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({

View File

@@ -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;
}