@@ -11,10 +11,10 @@ def add_rag_git_issue_task(config: RAGGitIssueConfig):
1111 g .get_repo (config .repo_name )
1212
1313 issue_task = GitIssueTask (
14- issue_id = '' ,
14+ issue_id = "" ,
1515 node_type = GitIssueTaskNodeType .REPO ,
1616 bot_id = config .bot_id ,
17- repo_name = config .repo_name
17+ repo_name = config .repo_name ,
1818 )
1919 res = issue_task .save ()
2020 issue_task .send ()
@@ -26,17 +26,26 @@ class GitIssueTask(GitTask):
2626 issue_id : str
2727 node_type : GitIssueTaskNodeType
2828
29- def __init__ (self ,
30- issue_id ,
31- node_type : GitIssueTaskNodeType ,
32- bot_id ,
33- repo_name ,
34- status = TaskStatus .NOT_STARTED ,
35- from_id = None ,
36- id = None
37- ):
38- super ().__init__ (bot_id = bot_id , type = TaskType .GIT_ISSUE , from_id = from_id , id = id , status = status ,
39- repo_name = repo_name )
29+ def __init__ (
30+ self ,
31+ issue_id ,
32+ node_type : GitIssueTaskNodeType ,
33+ bot_id ,
34+ repo_name ,
35+ status = TaskStatus .NOT_STARTED ,
36+ from_id = None ,
37+ id = None ,
38+ retry_count = 0 ,
39+ ):
40+ super ().__init__ (
41+ bot_id = bot_id ,
42+ type = TaskType .GIT_ISSUE ,
43+ from_id = from_id ,
44+ id = id ,
45+ status = status ,
46+ repo_name = repo_name ,
47+ retry_count = retry_count ,
48+ )
4049 self .issue_id = issue_id
4150 self .node_type = GitIssueTaskNodeType (node_type )
4251
@@ -75,27 +84,28 @@ def handle_repo_node(self):
7584 if len (task_list ) > 0 :
7685 result = self .get_table ().insert (task_list ).execute ()
7786 for record in result .data :
78- issue_task = GitIssueTask (id = record ["id" ],
79- issue_id = record ["issue_id" ],
80- repo_name = record ["repo_name" ],
81- node_type = record ["node_type" ],
82- bot_id = record ["bot_id" ],
83- status = record ["status" ],
84- from_id = record ["from_task_id" ]
85- )
87+ issue_task = GitIssueTask (
88+ id = record ["id" ],
89+ issue_id = record ["issue_id" ],
90+ repo_name = record ["repo_name" ],
91+ node_type = record ["node_type" ],
92+ bot_id = record ["bot_id" ],
93+ status = record ["status" ],
94+ from_id = record ["from_task_id" ],
95+ )
8696 issue_task .send ()
8797
88- return (self .get_table ().update (
89- {"status" : TaskStatus .COMPLETED .value })
90- .eq ("id" , self .id )
91- .execute ())
98+ return (
99+ self .get_table ()
100+ .update ({"status" : TaskStatus .COMPLETED .value })
101+ .eq ("id" , self .id )
102+ .execute ()
103+ )
92104
93105 def handle_issue_node (self ):
94106 issue_retrieval .add_knowledge_by_issue (
95107 RAGGitIssueConfig (
96- repo_name = self .repo_name ,
97- bot_id = self .bot_id ,
98- issue_id = self .issue_id
108+ repo_name = self .repo_name , bot_id = self .bot_id , issue_id = self .issue_id
99109 )
100110 )
101111 return self .update_status (TaskStatus .COMPLETED )
0 commit comments