mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-13 01:06:03 +00:00
fix(rag): align knowledge engine plugin actions
This commit is contained in:
committed by
huanghuoguoguo
parent
76582a578e
commit
565a6df77a
@@ -33,6 +33,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.
|
||||
@@ -294,14 +295,8 @@ function DisabledTooltipIcon({ text }: { text: string }) {
|
||||
/**
|
||||
* 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({
|
||||
|
||||
@@ -42,6 +42,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