新增对话处理功能,优化意图识别逻辑,添加结果保存至Excel的功能,更新依赖项以支持新的数据库驱动和ORM,重构代码以提高可读性和维护性,删除冗余文件以简化项目结构。

This commit is contained in:
2025-06-10 17:00:40 +08:00
parent ea705756fa
commit 2e91063ad1
11 changed files with 653 additions and 493 deletions
+10 -10
View File
@@ -23,12 +23,12 @@ class SoftwareName(str, Enum):
# 软件别名映射
ALIASES = {
D3: ["配网D3", "D3软件", "配网工程软件"],
C1: ["储能C1", "C1软件", "储能电站软件", "储能软件"],
Z1: ["西藏Z1", "Z1软件", "西藏电力软件"],
T1: ["技改T1", "T1软件", "技改检修软件"],
T1_LIST: ["技改清单T1", "T1清单软件", "技改检修清单软件"],
MAIN: ["主网软件", "电力建设软件", "主网建设软件", "主网软件"]
D3: "别名包括:配网D3、D3软件、配网工程软件等 其他类似称呼",
C1: "别名包括:储能C1、C1软件、储能电站软件、储能软件等 其他类似称呼",
Z1: "别名包括:西藏Z1、Z1软件、西藏电力软件等 其他类似称呼",
T1: "别名包括:技改T1、T1软件、技改检修软件等 其他类似称呼",
T1_LIST: "别名包括:技改清单T1、T1清单软件、技改检修清单软件等 其他类似称呼",
MAIN: "别名包括:主网软件、电力建设软件、主网建设软件、博微电力建设计价通等 其他类似称呼"
}
# 定义输出模型
@@ -58,7 +58,7 @@ class QueryRewrite(BaseModel):
# 1. 软件问题
# 1.1 软件功能
class SoftwareFunction(BaseModel):
software_name: SoftwareName = Field(description="软件名称")
software_name: SoftwareName = Field(description="软件名称,只能从给定的范围中取值")
function_name: str = Field(description="具体功能名称")
operation: str = Field(description="用户操作意图(如何使用功能、功能入口、功能使用场景)")
software_version: Optional[str] = Field(None, description="软件版本")
@@ -77,7 +77,7 @@ class SoftwareFunction(BaseModel):
# 1.2 故障排查
class TroubleShooting(BaseModel):
software_name: SoftwareName = Field(description="软件名称")
software_name: SoftwareName = Field(description="软件名称,只能从给定的范围中取值")
function_name: str = Field(description="具体功能名称/操作描述")
error_message: str = Field(description="报错信息/异常现象")
software_version: Optional[str] = Field(None, description="软件版本")
@@ -162,7 +162,7 @@ class SoftwareLock(BaseModel):
# 3.3 安装下载类
class InstallationDownload(BaseModel):
software_name: SoftwareName = Field(description="软件/插件名称,与file_name二选一")
software_name: str = Field(description="软件/插件名称,与file_name二选一")
file_name: str = Field(description="文件名,与software_name二选一")
operation_stage: str = Field(description="操作阶段")
os_version: Optional[str] = Field(None, description="操作系统版本")
@@ -182,7 +182,7 @@ class InstallationDownload(BaseModel):
# 3.4 问题排查类
class ProblemDiagnosis(BaseModel):
error_message: str = Field(description="报错信息/异常现象")
software_name: Optional[SoftwareName] = Field(None, description="软件名称")
software_name: Optional[SoftwareName] = Field(None, description="软件名称,只能从给定的范围中取值")
os_version: Optional[str] = Field(None, description="操作系统版本")
def check_required_slots(self) -> Tuple[bool, Dict[str, str]]: