feat(frontend): field-level multi_entity toggle in extraction settings

- evaluation_points.ts: LLMFieldConfig type, LLMFieldType union,
  VLMField.multi_entity
- ExtractionSettings.tsx:
  - LLM fields render as colored buttons (green=multi_entity, gray=normal)
  - Click to toggle individual field multi_entity when switch is on
  - Toggle switch on: converts all string fields to {name, multi_entity:true}
  - Toggle switch off: converts back to plain strings
  - New fields default to multi_entity:true when switch is on

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 19:34:45 +08:00
parent 5d3cb2ba34
commit bc3e26c93e
2 changed files with 86 additions and 26 deletions
+18 -2
View File
@@ -55,19 +55,33 @@ interface MultiEntityConfig {
*/
type MultiEntityExpandMode = 'awareness'; // AI感知模式
/**
* LLM 字段配置(支持字段级多实体标记)
*/
interface LLMFieldConfig {
name: string; // 字段名称(完整路径)
multi_entity?: boolean; // 是否对此字段做多实体展开(默认 false)
}
/**
* LLM 字段类型:支持旧格式字符串和新格式对象
*/
type LLMFieldType = string | LLMFieldConfig;
/**
* 抽取配置类型定义
*/
interface ExtactionConfigType {
multi_entity?: MultiEntityConfig; // 多实体抽取配置(控制抽取阶段是否按实体展开字段
multi_entity?: MultiEntityConfig; // 多实体抽取配置(EP级开关,作为旧格式str字段的fallback
llm: {
fields: string[];
fields: LLMFieldType[]; // 支持 "字段名" 或 {"name": "字段名", "multi_entity": true}
prompt_setting: LLMPromptSetting;
};
vlm: {
fields: Array<{
name: string;
type: VLMFieldType; // 多模态字段类型 默认、货币、打印、印章、骑缝章、英文、数字、手写、自定义
multi_entity?: boolean; // 是否对此字段做多实体展开
template?: string; // 自定义类型的提示词模板(仅当 type 为 custom 时使用)
}>;
prompt_setting: VLMPromptSetting;
@@ -329,6 +343,8 @@ export type {
ExtactionConfigType,
MultiEntityConfig,
MultiEntityExpandMode,
LLMFieldConfig,
LLMFieldType,
VLMPromptSetting,
VLMFieldType,
LLMPromptSetting,