@@ -104,11 +104,11 @@ def do_main(self, task_query, tag_id, task, context, **kwargs):
104104
105105 break
106106 else :
107- messages .append ({
108- "role" : "assistant" ,
109- "content" : subquestion_response ,
110- })
111107 if "<search>" in subquestion_response :
108+ messages .append ({
109+ "role" : "assistant" ,
110+ "content" : subquestion_response ,
111+ })
112112 search = search_plan_extraction (subquestion_response )
113113 # 有时候会缺失</search>训练时需要优化<search>内容,不需要直接换行
114114 if len (search ) == 0 :
@@ -117,6 +117,9 @@ def do_main(self, task_query, tag_id, task, context, **kwargs):
117117 try :
118118 sub_queries , logic_forms = parse_logic_form_with_str (search )
119119 logic_forms = self .logic_node_parser .parse_logic_form_set (logic_forms , sub_queries , task_query )
120+ if not logic_forms :
121+ logic_node .sub_query = search
122+ logic_forms = [logic_node ]
120123 except Exception as e :
121124 logger .warning (f"kag model think can not extra lf from { search } { e } " )
122125 logic_node .sub_query = search
@@ -142,7 +145,7 @@ def do_main(self, task_query, tag_id, task, context, **kwargs):
142145 "query" : target_query ,
143146 "logic_form_node" : logic_forms [0 ]
144147 })
145- retriever_output = self .do_retrieval (task_query = target_query , tag_id = tag_id , task = cur_task ,
148+ retriever_output = self .do_retrieval (task_query = target_query , tag_id = cur_turn_tag_name , task = cur_task ,
146149 context = context , ** kwargs )
147150
148151 recall_information_list = []
@@ -158,7 +161,7 @@ def do_main(self, task_query, tag_id, task, context, **kwargs):
158161 "content" : recall_str ,
159162 })
160163 except Exception as e :
161- logger .error (f"kag flow exception! { e } " , exc_info = True )
164+ logger .error (f"kag flow exception! { e } search= { search } " , exc_info = True )
162165 self .report_content (
163166 reporter ,
164167 cur_turn_tag_name ,
@@ -167,6 +170,11 @@ def do_main(self, task_query, tag_id, task, context, **kwargs):
167170 "INIT" ,
168171 step = task .name ,
169172 )
173+ else :
174+ messages .append ({
175+ "role" : "assistant" ,
176+ "content" : subquestion_response ,
177+ })
170178
171179 context .kwargs ["messages" ] = messages
172180 return retriever_output
0 commit comments