MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / create_reading_reports_for_selection

Function create_reading_reports_for_selection

agents/feedback-agent/main.py:193–231  ·  view source on GitHub ↗

Create reading reports for selected papers and route them back to the same chat.

(
    user_id: str,
    selected: Set[int],
    papers: List[Dict],
    target_id: Optional[str],
    use_chat_id: bool,
    send_to_feishu: bool,
    selection_push_id: Optional[str] = None,
)

Source from the content-addressed store, hash-verified

191
192
193def create_reading_reports_for_selection(
194 user_id: str,
195 selected: Set[int],
196 papers: List[Dict],
197 target_id: Optional[str],
198 use_chat_id: bool,
199 send_to_feishu: bool,
200 selection_push_id: Optional[str] = None,
201) -> List[Dict[str, Any]]:
202 """Create reading reports for selected papers and route them back to the same chat."""
203 if not selected or not send_to_feishu:
204 return []
205
206 paper_ids: List[int] = []
207 for paper_num in sorted(selected):
208 idx = int(paper_num) - 1
209 if not (0 <= idx < len(papers)):
210 continue
211 paper = papers[idx]
212 resolved_id = paper.get("id")
213 paper_ids.append(int(resolved_id) if resolved_id is not None else int(paper_num))
214
215 reading_agent = importlib.import_module("agents.reading-agent.main")
216 kwargs: Dict[str, Any] = {
217 "user_id": user_id,
218 "paper_ids": paper_ids,
219 "papers": papers,
220 "send_to_feishu": True,
221 "request_metadata": {
222 "selection_push_id": selection_push_id,
223 } if selection_push_id else None,
224 }
225
226 if use_chat_id and target_id:
227 kwargs["chat_id"] = target_id
228 elif target_id:
229 kwargs["feishu_user_id"] = target_id
230
231 return reading_agent.create_reading_report(**kwargs)
232
233
234def parse_user_reply(reply: str, papers: List[Dict] = None) -> Set[int]:

Callers 1

process_feedbackFunction · 0.85

Calls 2

getMethod · 0.80
create_reading_reportMethod · 0.45

Tested by

no test coverage detected