MCPcopy Create free account
hub / github.com/OpenRaiser/NanoResearch / _parse_actions

Method _parse_actions

nanoresearch/feishu_bot_core.py:354–380  ·  view source on GitHub ↗
(self, response: str)

Source from the content-addressed store, hash-verified

352 return "\n\n".join(parts)
353
354 def _parse_actions(self, response: str) -> tuple[str, list[tuple[str, str]]]:
355 actions: list[tuple[str, str]] = []
356 reply_lines: list[str] = []
357 prefix = f"##ACT_{self._action_nonce}_"
358
359 for line in response.split("\n"):
360 stripped = line.strip()
361 if stripped.startswith(prefix):
362 tag = stripped[len(prefix):]
363 if tag.startswith("RUN:"):
364 actions.append(("RUN", tag[4:].strip()))
365 elif tag == "STATUS":
366 actions.append(("STATUS", ""))
367 elif tag == "STOP":
368 actions.append(("STOP", ""))
369 elif tag == "EXPORT":
370 actions.append(("EXPORT", ""))
371 elif tag == "LIST":
372 actions.append(("LIST", ""))
373 elif tag.startswith("REMEMBER:"):
374 actions.append(("REMEMBER", tag[9:].strip()))
375 else:
376 reply_lines.append(line)
377 else:
378 reply_lines.append(line)
379
380 return "\n".join(reply_lines).strip(), actions
381
382 async def _condense_memory(self, memory) -> None:
383 old_msgs = memory.messages[:-memory.KEEP_RECENT]

Callers 1

_handle_chat_asyncMethod · 0.95

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected