AIDeveloper-PC/gui_ai_developer/models/requirement.py

43 lines
1.1 KiB
Python
Raw Normal View History

2026-01-31 09:32:00 +00:00
"""
需求模型
"""
from typing import Dict, Any
class Requirement:
"""需求数据模型"""
def __init__(self, req_id: str, title: str, description: str,
confidence: int = 0, priority: str = ""):
"""
初始化需求
Args:
req_id: 需求ID
title: 需求标题
description: 需求描述
confidence: 置信度 (0-100)
priority: 优先级 (//)
"""
self.req_id = req_id
self.title = title
self.description = description
self.confidence = confidence
self.priority = priority
self.checked = True
self.req_type = "功能性"
def to_dict(self) -> Dict[str, Any]:
"""转换为字典"""
return {
'req_id': self.req_id,
'title': self.title,
'description': self.description,
'confidence': self.confidence,
'priority': self.priority,
'type': self.req_type
}
def __str__(self) -> str:
return f"{self.req_id}: {self.title}"