MCPcopy
hub / github.com/zai-org/ChatGLM3 / extract_code

Function extract_code

composite_demo/demo_tool.py:46–50  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

44
45
46def extract_code(text: str) -> str:
47 pattern = r'```([^\n]*)\n(.*?)```'
48 matches = re.findall(pattern, text, re.DOTALL)
49 print(matches)
50 return matches[-1][1]
51
52
53# Append a conversation into history, while show it in a new markdown block

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected