feat: refactor API key configuration and enhance application initialization
- Renamed `check_environment` to `check_api_key_configured` for clarity, simplifying the API key validation logic. - Removed the blocking behavior of the API key check during application startup, allowing the app to run while providing a prompt for configuration. - Updated `LocalAgentApp` to accept an `api_configured` parameter, enabling conditional messaging for API key setup. - Enhanced the `SandboxRunner` to support backup management and improved execution result handling with detailed metrics. - Integrated data governance strategies into the `HistoryManager`, ensuring compliance and improved data management. - Added privacy settings and metrics tracking across various components to enhance user experience and application safety.
This commit is contained in:
@@ -444,47 +444,93 @@ REQUIREMENT_CHECK_SYSTEM = """你是一个需求完整性检查器。判断用
|
||||
2. 明确的操作动作(做什么处理)
|
||||
3. 关键参数已指定或有合理默认值
|
||||
|
||||
【关键信息分类】
|
||||
- critical_fields: 缺失后无法执行的关键信息(如:水印类型、目标格式、分类依据)
|
||||
- missing_info: 所有缺失的信息(包括可以使用默认值的)
|
||||
|
||||
【严重程度判断】
|
||||
1. 关键信息缺失(is_complete=false, confidence<0.5):
|
||||
- 缺少操作类型(如:不知道是文字水印还是图片水印)
|
||||
- 缺少必需参数(如:转换格式未指定、分类依据不明)
|
||||
- 存在多种理解方式且无法确定
|
||||
|
||||
2. 一般信息缺失(is_complete=false, confidence=0.5-0.7):
|
||||
- 缺少次要参数但有合理默认值(如:透明度、字体大小)
|
||||
- 描述不够精确但可以推断(如:"整理文件"可推断为按类型分类)
|
||||
|
||||
3. 信息完整但置信度低(is_complete=true, confidence<0.7):
|
||||
- 所有关键信息都有,但描述模糊
|
||||
- 可能存在理解偏差
|
||||
|
||||
4. 信息完整且置信度高(is_complete=true, confidence>=0.7):
|
||||
- 所有关键信息明确
|
||||
- 描述清晰无歧义
|
||||
|
||||
【输出格式】
|
||||
{
|
||||
"is_complete": true或false,
|
||||
"confidence": 0.0到1.0,
|
||||
"reason": "判断理由",
|
||||
"critical_fields": ["关键缺失字段1", "关键缺失字段2"], // 仅当存在关键信息缺失时
|
||||
"missing_info": ["所有缺失信息"],
|
||||
"suggested_defaults": {
|
||||
"参数名": "建议的默认值"
|
||||
}
|
||||
}
|
||||
|
||||
【示例】
|
||||
【示例1 - 关键信息缺失】
|
||||
输入:"给图片加水印"
|
||||
输出:
|
||||
{
|
||||
"is_complete": false,
|
||||
"confidence": 0.3,
|
||||
"reason": "缺少水印类型、内容、位置等关键信息,无法确定用户意图",
|
||||
"critical_fields": ["水印类型", "水印内容"],
|
||||
"missing_info": ["水印类型", "水印内容", "水印位置", "透明度"],
|
||||
"suggested_defaults": {}
|
||||
}
|
||||
|
||||
【示例2 - 一般信息缺失】
|
||||
输入:"给图片加文字水印,内容是'版权所有'"
|
||||
输出:
|
||||
{
|
||||
"is_complete": false,
|
||||
"confidence": 0.6,
|
||||
"reason": "水印类型和内容已明确,但缺少位置信息",
|
||||
"critical_fields": [],
|
||||
"missing_info": ["水印位置", "透明度", "字体大小"],
|
||||
"suggested_defaults": {
|
||||
"position": "右下角",
|
||||
"opacity": 50,
|
||||
"font_size": 24
|
||||
}
|
||||
}
|
||||
|
||||
【示例3 - 信息完整】
|
||||
输入:"把图片转成jpg"
|
||||
输出:
|
||||
{
|
||||
"is_complete": true,
|
||||
"confidence": 0.8,
|
||||
"reason": "目标格式明确,质量可使用默认值85%",
|
||||
"critical_fields": [],
|
||||
"missing_info": [],
|
||||
"suggested_defaults": {
|
||||
"quality": 85
|
||||
}
|
||||
}
|
||||
|
||||
输入:"给图片加水印"
|
||||
输出:
|
||||
{
|
||||
"is_complete": false,
|
||||
"confidence": 0.3,
|
||||
"reason": "缺少水印类型、内容、位置等关键信息",
|
||||
"suggested_defaults": {}
|
||||
}
|
||||
|
||||
输入:"给图片右下角加上'版权所有'的文字水印"
|
||||
【示例4 - 信息完整且详细】
|
||||
输入:"给图片右下角加上'版权所有'的白色文字水印,透明度50%"
|
||||
输出:
|
||||
{
|
||||
"is_complete": true,
|
||||
"confidence": 0.9,
|
||||
"reason": "水印类型、内容、位置都已明确,其他参数可用默认值",
|
||||
"confidence": 0.95,
|
||||
"reason": "水印类型、内容、位置、颜色、透明度都已明确",
|
||||
"critical_fields": [],
|
||||
"missing_info": [],
|
||||
"suggested_defaults": {
|
||||
"opacity": 50,
|
||||
"font_size": 24,
|
||||
"color": "white"
|
||||
"font_size": 24
|
||||
}
|
||||
}"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user