MCPcopy Create free account
hub / github.com/InternScience/SciReason / LarkReporter

Class LarkReporter

opencompass/utils/lark.py:8–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7
8class LarkReporter:
9
10 def __init__(self, url: str):
11 self.url = url
12
13 def post(self,
14 content: Union[str, List[List[Dict]]],
15 title: Optional[str] = None):
16 """Post a message to Lark.
17
18 When title is None, message must be a str. otherwise msg can be in rich
19 text format (see
20 https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json#45e0953e
21 for details).
22 """
23 if title is None:
24 assert isinstance(content, str)
25 msg = {'msg_type': 'text', 'content': {'text': content}}
26 else:
27 if isinstance(content, str):
28 content = [[{'tag': 'text', 'text': content}]]
29 msg = {
30 'msg_type': 'post',
31 'content': {
32 'post': {
33 'zh_cn': {
34 'title': title,
35 'content': content
36 }
37 }
38 }
39 }
40 requests.post(self.url, data=json.dumps(msg))
41
42
43def parse_args():

Callers 7

__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
mainFunction · 0.90
lark.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected