提示词组配置
| 39 | |
| 40 | @dataclass |
| 41 | class PromptGroupConfig: |
| 42 | """提示词组配置""" |
| 43 | name: str # 组名 |
| 44 | prompts: List[str] = field(default_factory=list) # 该组的提示词 |
| 45 | score_threshold: float = 0.5 # 置信度阈值 |
| 46 | min_area: int = 100 # 最小面积 |
| 47 | priority: int = 1 # 去重优先级(越高越优先保留) |
| 48 | description: str = "" # 描述 |
| 49 | |
| 50 | def add_prompt(self, prompt: str): |
| 51 | """添加提示词""" |
| 52 | if prompt not in self.prompts: |
| 53 | self.prompts.append(prompt) |
| 54 | |
| 55 | def remove_prompt(self, prompt: str): |
| 56 | """移除提示词""" |
| 57 | if prompt in self.prompts: |
| 58 | self.prompts.remove(prompt) |
| 59 | |
| 60 | |
| 61 | # ======================== 配置加载器 ======================== |