Undefined-bot 2.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Undefined/__init__.py +3 -0
- Undefined/__main__.py +6 -0
- Undefined/ai.py +1215 -0
- Undefined/config.py +371 -0
- Undefined/end_summary_storage.py +48 -0
- Undefined/faq.py +244 -0
- Undefined/handlers.py +1247 -0
- Undefined/injection_response_agent.py +131 -0
- Undefined/main.py +126 -0
- Undefined/memory.py +120 -0
- Undefined/onebot.py +512 -0
- Undefined/rate_limit.py +130 -0
- Undefined/render.py +123 -0
- Undefined/scheduled_task_storage.py +88 -0
- Undefined/services/__init__.py +1 -0
- Undefined/services/queue_manager.py +206 -0
- Undefined/skills/README.md +53 -0
- Undefined/skills/__init__.py +10 -0
- Undefined/skills/agents/README.md +144 -0
- Undefined/skills/agents/__init__.py +116 -0
- Undefined/skills/agents/entertainment_agent/config.json +17 -0
- Undefined/skills/agents/entertainment_agent/handler.py +220 -0
- Undefined/skills/agents/entertainment_agent/intro.md +25 -0
- Undefined/skills/agents/entertainment_agent/prompt.md +20 -0
- Undefined/skills/agents/entertainment_agent/tools/__init__.py +1 -0
- Undefined/skills/agents/entertainment_agent/tools/ai_draw_one/config.json +34 -0
- Undefined/skills/agents/entertainment_agent/tools/ai_draw_one/handler.py +62 -0
- Undefined/skills/agents/entertainment_agent/tools/ai_study_helper/config.json +22 -0
- Undefined/skills/agents/entertainment_agent/tools/ai_study_helper/handler.py +35 -0
- Undefined/skills/agents/entertainment_agent/tools/get_current_time/config.json +12 -0
- Undefined/skills/agents/entertainment_agent/tools/get_current_time/handler.py +5 -0
- Undefined/skills/agents/entertainment_agent/tools/horoscope/config.json +24 -0
- Undefined/skills/agents/entertainment_agent/tools/horoscope/handler.py +141 -0
- Undefined/skills/agents/entertainment_agent/tools/minecraft_skin/config.json +43 -0
- Undefined/skills/agents/entertainment_agent/tools/minecraft_skin/handler.py +55 -0
- Undefined/skills/agents/entertainment_agent/tools/novel_search/config.json +25 -0
- Undefined/skills/agents/entertainment_agent/tools/novel_search/handler.py +31 -0
- Undefined/skills/agents/entertainment_agent/tools/renjian/config.json +12 -0
- Undefined/skills/agents/entertainment_agent/tools/renjian/handler.py +30 -0
- Undefined/skills/agents/entertainment_agent/tools/wenchang_dijun/config.json +12 -0
- Undefined/skills/agents/entertainment_agent/tools/wenchang_dijun/handler.py +44 -0
- Undefined/skills/agents/file_analysis_agent/__init__.py +1 -0
- Undefined/skills/agents/file_analysis_agent/config.json +21 -0
- Undefined/skills/agents/file_analysis_agent/handler.py +248 -0
- Undefined/skills/agents/file_analysis_agent/intro.md +22 -0
- Undefined/skills/agents/file_analysis_agent/prompt.md +36 -0
- Undefined/skills/agents/file_analysis_agent/tools/__init__.py +1 -0
- Undefined/skills/agents/file_analysis_agent/tools/analyze_code/config.json +17 -0
- Undefined/skills/agents/file_analysis_agent/tools/analyze_code/handler.py +427 -0
- Undefined/skills/agents/file_analysis_agent/tools/analyze_multimodal/config.json +25 -0
- Undefined/skills/agents/file_analysis_agent/tools/analyze_multimodal/handler.py +178 -0
- Undefined/skills/agents/file_analysis_agent/tools/cleanup_temp/config.json +16 -0
- Undefined/skills/agents/file_analysis_agent/tools/cleanup_temp/handler.py +35 -0
- Undefined/skills/agents/file_analysis_agent/tools/detect_file_type/config.json +17 -0
- Undefined/skills/agents/file_analysis_agent/tools/detect_file_type/handler.py +221 -0
- Undefined/skills/agents/file_analysis_agent/tools/download_file/config.json +21 -0
- Undefined/skills/agents/file_analysis_agent/tools/download_file/handler.py +124 -0
- Undefined/skills/agents/file_analysis_agent/tools/extract_archive/config.json +25 -0
- Undefined/skills/agents/file_analysis_agent/tools/extract_archive/handler.py +190 -0
- Undefined/skills/agents/file_analysis_agent/tools/extract_docx/config.json +17 -0
- Undefined/skills/agents/file_analysis_agent/tools/extract_docx/handler.py +78 -0
- Undefined/skills/agents/file_analysis_agent/tools/extract_pdf/config.json +21 -0
- Undefined/skills/agents/file_analysis_agent/tools/extract_pdf/handler.py +67 -0
- Undefined/skills/agents/file_analysis_agent/tools/extract_pptx/config.json +17 -0
- Undefined/skills/agents/file_analysis_agent/tools/extract_pptx/handler.py +73 -0
- Undefined/skills/agents/file_analysis_agent/tools/extract_xlsx/config.json +17 -0
- Undefined/skills/agents/file_analysis_agent/tools/extract_xlsx/handler.py +101 -0
- Undefined/skills/agents/file_analysis_agent/tools/get_current_time/config.json +12 -0
- Undefined/skills/agents/file_analysis_agent/tools/get_current_time/handler.py +5 -0
- Undefined/skills/agents/file_analysis_agent/tools/read_text_file/config.json +21 -0
- Undefined/skills/agents/file_analysis_agent/tools/read_text_file/handler.py +90 -0
- Undefined/skills/agents/info_agent/config.json +17 -0
- Undefined/skills/agents/info_agent/handler.py +220 -0
- Undefined/skills/agents/info_agent/intro.md +22 -0
- Undefined/skills/agents/info_agent/prompt.md +27 -0
- Undefined/skills/agents/info_agent/tools/__init__.py +1 -0
- Undefined/skills/agents/info_agent/tools/baiduhot/config.json +18 -0
- Undefined/skills/agents/info_agent/tools/baiduhot/handler.py +49 -0
- Undefined/skills/agents/info_agent/tools/base64/config.json +22 -0
- Undefined/skills/agents/info_agent/tools/base64/handler.py +44 -0
- Undefined/skills/agents/info_agent/tools/douyinhot/config.json +18 -0
- Undefined/skills/agents/info_agent/tools/douyinhot/handler.py +53 -0
- Undefined/skills/agents/info_agent/tools/get_current_time/config.json +12 -0
- Undefined/skills/agents/info_agent/tools/get_current_time/handler.py +5 -0
- Undefined/skills/agents/info_agent/tools/gold_price/config.json +12 -0
- Undefined/skills/agents/info_agent/tools/gold_price/handler.py +58 -0
- Undefined/skills/agents/info_agent/tools/hash/config.json +22 -0
- Undefined/skills/agents/info_agent/tools/hash/handler.py +43 -0
- Undefined/skills/agents/info_agent/tools/history/config.json +12 -0
- Undefined/skills/agents/info_agent/tools/history/handler.py +37 -0
- Undefined/skills/agents/info_agent/tools/net_check/config.json +17 -0
- Undefined/skills/agents/info_agent/tools/net_check/handler.py +117 -0
- Undefined/skills/agents/info_agent/tools/news_tencent/config.json +17 -0
- Undefined/skills/agents/info_agent/tools/news_tencent/handler.py +38 -0
- Undefined/skills/agents/info_agent/tools/qq_level_query/config.json +29 -0
- Undefined/skills/agents/info_agent/tools/qq_level_query/handler.py +48 -0
- Undefined/skills/agents/info_agent/tools/speed/config.json +17 -0
- Undefined/skills/agents/info_agent/tools/speed/handler.py +37 -0
- Undefined/skills/agents/info_agent/tools/tcping/config.json +21 -0
- Undefined/skills/agents/info_agent/tools/tcping/handler.py +53 -0
- Undefined/skills/agents/info_agent/tools/weather_query/config.json +22 -0
- Undefined/skills/agents/info_agent/tools/weather_query/handler.py +207 -0
- Undefined/skills/agents/info_agent/tools/weibohot/config.json +18 -0
- Undefined/skills/agents/info_agent/tools/weibohot/handler.py +49 -0
- Undefined/skills/agents/info_agent/tools/whois/config.json +17 -0
- Undefined/skills/agents/info_agent/tools/whois/handler.py +63 -0
- Undefined/skills/agents/naga_code_analysis_agent/config.json +17 -0
- Undefined/skills/agents/naga_code_analysis_agent/handler.py +222 -0
- Undefined/skills/agents/naga_code_analysis_agent/intro.md +17 -0
- Undefined/skills/agents/naga_code_analysis_agent/prompt.md +19 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/__init__.py +1 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/get_current_time/config.json +12 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/get_current_time/handler.py +5 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/glob/config.json +17 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/glob/handler.py +37 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/list_directory/config.json +17 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/list_directory/handler.py +31 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/read_file/config.json +17 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/read_file/handler.py +66 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/read_naga_intro/config.json +12 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/read_naga_intro/handler.py +327 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/search_file_content/config.json +25 -0
- Undefined/skills/agents/naga_code_analysis_agent/tools/search_file_content/handler.py +46 -0
- Undefined/skills/agents/scheduler_agent/__init__.py +1 -0
- Undefined/skills/agents/scheduler_agent/config.json +17 -0
- Undefined/skills/agents/scheduler_agent/handler.py +218 -0
- Undefined/skills/agents/scheduler_agent/intro.md +17 -0
- Undefined/skills/agents/scheduler_agent/prompt.md +67 -0
- Undefined/skills/agents/scheduler_agent/tools/__init__.py +1 -0
- Undefined/skills/agents/scheduler_agent/tools/create_schedule_task/config.json +37 -0
- Undefined/skills/agents/scheduler_agent/tools/create_schedule_task/handler.py +68 -0
- Undefined/skills/agents/scheduler_agent/tools/delete_schedule_task/config.json +19 -0
- Undefined/skills/agents/scheduler_agent/tools/delete_schedule_task/handler.py +26 -0
- Undefined/skills/agents/scheduler_agent/tools/get_current_time/config.json +12 -0
- Undefined/skills/agents/scheduler_agent/tools/get_current_time/handler.py +5 -0
- Undefined/skills/agents/scheduler_agent/tools/list_schedule_tasks/config.json +11 -0
- Undefined/skills/agents/scheduler_agent/tools/list_schedule_tasks/handler.py +47 -0
- Undefined/skills/agents/scheduler_agent/tools/update_schedule_task/config.json +39 -0
- Undefined/skills/agents/scheduler_agent/tools/update_schedule_task/handler.py +46 -0
- Undefined/skills/agents/social_agent/config.json +17 -0
- Undefined/skills/agents/social_agent/handler.py +220 -0
- Undefined/skills/agents/social_agent/intro.md +17 -0
- Undefined/skills/agents/social_agent/prompt.md +19 -0
- Undefined/skills/agents/social_agent/tools/__init__.py +1 -0
- Undefined/skills/agents/social_agent/tools/bilibili_search/config.json +21 -0
- Undefined/skills/agents/social_agent/tools/bilibili_search/handler.py +68 -0
- Undefined/skills/agents/social_agent/tools/bilibili_user_info/config.json +17 -0
- Undefined/skills/agents/social_agent/tools/bilibili_user_info/handler.py +68 -0
- Undefined/skills/agents/social_agent/tools/get_current_time/config.json +12 -0
- Undefined/skills/agents/social_agent/tools/get_current_time/handler.py +5 -0
- Undefined/skills/agents/social_agent/tools/music_global_search/config.json +21 -0
- Undefined/skills/agents/social_agent/tools/music_global_search/handler.py +47 -0
- Undefined/skills/agents/social_agent/tools/music_info_get/config.json +22 -0
- Undefined/skills/agents/social_agent/tools/music_info_get/handler.py +35 -0
- Undefined/skills/agents/social_agent/tools/music_lyrics/config.json +22 -0
- Undefined/skills/agents/social_agent/tools/music_lyrics/handler.py +26 -0
- Undefined/skills/agents/social_agent/tools/video_random_recommend/config.json +21 -0
- Undefined/skills/agents/social_agent/tools/video_random_recommend/handler.py +21 -0
- Undefined/skills/agents/web_agent/config.json +17 -0
- Undefined/skills/agents/web_agent/handler.py +221 -0
- Undefined/skills/agents/web_agent/intro.md +14 -0
- Undefined/skills/agents/web_agent/prompt.md +16 -0
- Undefined/skills/agents/web_agent/tools/__init__.py +1 -0
- Undefined/skills/agents/web_agent/tools/crawl_webpage/config.json +21 -0
- Undefined/skills/agents/web_agent/tools/crawl_webpage/handler.py +102 -0
- Undefined/skills/agents/web_agent/tools/get_current_time/config.json +12 -0
- Undefined/skills/agents/web_agent/tools/get_current_time/handler.py +5 -0
- Undefined/skills/agents/web_agent/tools/web_search/config.json +21 -0
- Undefined/skills/agents/web_agent/tools/web_search/handler.py +29 -0
- Undefined/skills/tools/README.md +85 -0
- Undefined/skills/tools/__init__.py +120 -0
- Undefined/skills/tools/debug/config.json +17 -0
- Undefined/skills/tools/debug/handler.py +35 -0
- Undefined/skills/tools/end/config.json +17 -0
- Undefined/skills/tools/end/handler.py +24 -0
- Undefined/skills/tools/get_current_time/config.json +12 -0
- Undefined/skills/tools/get_current_time/handler.py +5 -0
- Undefined/skills/tools/get_forward_msg/config.json +17 -0
- Undefined/skills/tools/get_forward_msg/handler.py +131 -0
- Undefined/skills/tools/get_group_member_info/config.json +38 -0
- Undefined/skills/tools/get_group_member_info/handler.py +142 -0
- Undefined/skills/tools/get_messages_by_time/config.json +30 -0
- Undefined/skills/tools/get_messages_by_time/handler.py +128 -0
- Undefined/skills/tools/get_picture/config.json +45 -0
- Undefined/skills/tools/get_picture/handler.py +191 -0
- Undefined/skills/tools/get_recent_messages/config.json +30 -0
- Undefined/skills/tools/get_recent_messages/handler.py +88 -0
- Undefined/skills/tools/qq_like/config.json +22 -0
- Undefined/skills/tools/qq_like/handler.py +58 -0
- Undefined/skills/tools/render_html/config.json +26 -0
- Undefined/skills/tools/render_html/handler.py +39 -0
- Undefined/skills/tools/render_latex/config.json +26 -0
- Undefined/skills/tools/render_latex/handler.py +78 -0
- Undefined/skills/tools/render_markdown/config.json +26 -0
- Undefined/skills/tools/render_markdown/handler.py +63 -0
- Undefined/skills/tools/save_memory/config.json +17 -0
- Undefined/skills/tools/save_memory/handler.py +17 -0
- Undefined/skills/tools/send_message/config.json +21 -0
- Undefined/skills/tools/send_message/handler.py +60 -0
- Undefined/skills/tools/send_private_message/config.json +21 -0
- Undefined/skills/tools/send_private_message/handler.py +35 -0
- Undefined/utils/__init__.py +0 -0
- Undefined/utils/common.py +186 -0
- Undefined/utils/history.py +284 -0
- Undefined/utils/scheduler.py +286 -0
- Undefined/utils/sender.py +140 -0
- undefined_bot-2.1.0.dist-info/METADATA +259 -0
- undefined_bot-2.1.0.dist-info/RECORD +211 -0
- undefined_bot-2.1.0.dist-info/WHEEL +4 -0
- undefined_bot-2.1.0.dist-info/entry_points.txt +2 -0
- undefined_bot-2.1.0.dist-info/licenses/LICENSE +7 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from typing import Any, Dict
|
|
2
|
+
import logging
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
async def execute(args: Dict[str, Any], context: Dict[str, Any]) -> str:
|
|
8
|
+
try:
|
|
9
|
+
async with httpx.AsyncClient(timeout=15.0) as client:
|
|
10
|
+
logger.info("获取今日黄金价格")
|
|
11
|
+
|
|
12
|
+
response = await client.get("https://v2.xxapi.cn/api/goldprice")
|
|
13
|
+
response.raise_for_status()
|
|
14
|
+
data = response.json()
|
|
15
|
+
|
|
16
|
+
if data.get("code") != 200:
|
|
17
|
+
return f"获取黄金价格失败: {data.get('msg')}"
|
|
18
|
+
|
|
19
|
+
price_data = data.get("data", {})
|
|
20
|
+
result = "【今日黄金价格】\n\n"
|
|
21
|
+
|
|
22
|
+
# 银行投资金条价格
|
|
23
|
+
bank_gold = price_data.get("bank_gold_bar_price", [])
|
|
24
|
+
if bank_gold:
|
|
25
|
+
result += "【银行投资金条价格】\n"
|
|
26
|
+
for item in bank_gold:
|
|
27
|
+
result += f"{item.get('bank', '')}: {item.get('price', '')}元/克\n"
|
|
28
|
+
result += "\n"
|
|
29
|
+
|
|
30
|
+
# 黄金回收价格
|
|
31
|
+
recycle_price = price_data.get("gold_recycle_price", [])
|
|
32
|
+
if recycle_price:
|
|
33
|
+
result += "【黄金回收价格】\n"
|
|
34
|
+
for item in recycle_price:
|
|
35
|
+
result += f"{item.get('gold_type', '')}: {item.get('recycle_price', '')}元/克 ({item.get('updated_date', '')})\n"
|
|
36
|
+
result += "\n"
|
|
37
|
+
|
|
38
|
+
# 贵金属品牌价格
|
|
39
|
+
precious_metal = price_data.get("precious_metal_price", [])
|
|
40
|
+
if precious_metal:
|
|
41
|
+
result += "【贵金属品牌价格】\n"
|
|
42
|
+
for item in precious_metal:
|
|
43
|
+
result += f"{item.get('brand', '')}:\n"
|
|
44
|
+
result += f" 金条价: {item.get('bullion_price', '')}元/克\n"
|
|
45
|
+
result += f" 黄金价: {item.get('gold_price', '')}元/克\n"
|
|
46
|
+
result += f" 铂金价: {item.get('platinum_price', '')}元/克\n"
|
|
47
|
+
result += f" 更新日期: {item.get('updated_date', '')}\n\n"
|
|
48
|
+
|
|
49
|
+
return result
|
|
50
|
+
|
|
51
|
+
except httpx.TimeoutException:
|
|
52
|
+
return "请求超时,请稍后重试"
|
|
53
|
+
except httpx.HTTPStatusError as e:
|
|
54
|
+
logger.error(f"HTTP 错误: {e}")
|
|
55
|
+
return f"获取黄金价格失败: {e}"
|
|
56
|
+
except Exception as e:
|
|
57
|
+
logger.exception(f"获取黄金价格失败: {e}")
|
|
58
|
+
return f"获取黄金价格失败: {e}"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "function",
|
|
3
|
+
"function": {
|
|
4
|
+
"name": "hash",
|
|
5
|
+
"description": "字符串哈希加密工具,支持MD4、MD5、SHA1、SHA256、SHA512五种加密算法。",
|
|
6
|
+
"parameters": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"text": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "需要加密的字符串"
|
|
12
|
+
},
|
|
13
|
+
"algorithm": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "加密算法",
|
|
16
|
+
"enum": ["md4", "md5", "sha1", "sha256", "sha512"]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": ["text", "algorithm"]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from typing import Any, Dict
|
|
2
|
+
import logging
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
async def execute(args: Dict[str, Any], context: Dict[str, Any]) -> str:
|
|
8
|
+
text = args.get("text")
|
|
9
|
+
algorithm = args.get("algorithm")
|
|
10
|
+
|
|
11
|
+
if not text:
|
|
12
|
+
return "❌ 文本不能为空"
|
|
13
|
+
if not algorithm:
|
|
14
|
+
return "❌ 算法不能为空"
|
|
15
|
+
if algorithm not in ["md4", "md5", "sha1", "sha256", "sha512"]:
|
|
16
|
+
return "❌ 算法必须是 md4、md5、sha1、sha256 或 sha512"
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
async with httpx.AsyncClient(timeout=10.0) as client:
|
|
20
|
+
params = {
|
|
21
|
+
"type": algorithm,
|
|
22
|
+
"text": text
|
|
23
|
+
}
|
|
24
|
+
logger.info(f"Hash {algorithm}: {text[:50]}...")
|
|
25
|
+
|
|
26
|
+
response = await client.get("https://v2.xxapi.cn/api/hash", params=params)
|
|
27
|
+
response.raise_for_status()
|
|
28
|
+
data = response.json()
|
|
29
|
+
|
|
30
|
+
if data.get("code") != 200:
|
|
31
|
+
return f"Hash加密失败: {data.get('msg')}"
|
|
32
|
+
|
|
33
|
+
result = data.get("data")
|
|
34
|
+
return f"{algorithm.upper()}加密结果:\n{result}"
|
|
35
|
+
|
|
36
|
+
except httpx.TimeoutException:
|
|
37
|
+
return "请求超时,请稍后重试"
|
|
38
|
+
except httpx.HTTPStatusError as e:
|
|
39
|
+
logger.error(f"HTTP 错误: {e}")
|
|
40
|
+
return f"请求失败: {e}"
|
|
41
|
+
except Exception as e:
|
|
42
|
+
logger.exception(f"Hash加密失败: {e}")
|
|
43
|
+
return f"加密失败: {e}"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from typing import Any, Dict
|
|
2
|
+
import logging
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
async def execute(args: Dict[str, Any], context: Dict[str, Any]) -> str:
|
|
8
|
+
try:
|
|
9
|
+
async with httpx.AsyncClient(timeout=15.0) as client:
|
|
10
|
+
logger.info("获取历史上的今天")
|
|
11
|
+
|
|
12
|
+
response = await client.get("https://v2.xxapi.cn/api/history")
|
|
13
|
+
response.raise_for_status()
|
|
14
|
+
data = response.json()
|
|
15
|
+
|
|
16
|
+
if data.get("code") != 200:
|
|
17
|
+
return f"获取历史事件失败: {data.get('msg')}"
|
|
18
|
+
|
|
19
|
+
history_list = data.get("data", [])
|
|
20
|
+
if not history_list:
|
|
21
|
+
return "暂无历史事件数据"
|
|
22
|
+
|
|
23
|
+
result = "【历史上的今天】\n\n"
|
|
24
|
+
|
|
25
|
+
for idx, event in enumerate(history_list, 1):
|
|
26
|
+
result += f"{idx}. {event}\n"
|
|
27
|
+
|
|
28
|
+
return result
|
|
29
|
+
|
|
30
|
+
except httpx.TimeoutException:
|
|
31
|
+
return "请求超时,请稍后重试"
|
|
32
|
+
except httpx.HTTPStatusError as e:
|
|
33
|
+
logger.error(f"HTTP 错误: {e}")
|
|
34
|
+
return f"获取历史事件失败: {e}"
|
|
35
|
+
except Exception as e:
|
|
36
|
+
logger.exception(f"获取历史事件失败: {e}")
|
|
37
|
+
return f"获取历史事件失败: {e}"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "function",
|
|
3
|
+
"function": {
|
|
4
|
+
"name": "net_check",
|
|
5
|
+
"description": "全方位网络检测工具,支持DNS解析、ICMP Ping、HTTP/HTTPS请求等多维度检测。返回域名解析结果、延迟数据、网站响应状态和证书有效期等信息。",
|
|
6
|
+
"parameters": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"host": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "要检测的域名或IP,例如:example.com"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"required": ["host"]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
from typing import Any, Dict
|
|
2
|
+
import logging
|
|
3
|
+
import httpx
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
logger = logging.getLogger(__name__)
|
|
7
|
+
|
|
8
|
+
API_TOKEN = os.getenv("XXAPI_API_TOKEN", "")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
async def execute(args: Dict[str, Any], context: Dict[str, Any]) -> str:
|
|
12
|
+
host = args.get("host")
|
|
13
|
+
|
|
14
|
+
if not host:
|
|
15
|
+
return "❌ 主机地址不能为空"
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
async with httpx.AsyncClient(timeout=30.0) as client:
|
|
19
|
+
params = {"host": host, "key": API_TOKEN}
|
|
20
|
+
logger.info(f"网络检测: {host}")
|
|
21
|
+
|
|
22
|
+
response = await client.get(
|
|
23
|
+
"https://v2.xxapi.cn/api/netCheck", params=params
|
|
24
|
+
)
|
|
25
|
+
response.raise_for_status()
|
|
26
|
+
data = response.json()
|
|
27
|
+
|
|
28
|
+
if data.get("code") != 200:
|
|
29
|
+
return f"网络检测失败: {data.get('msg')}"
|
|
30
|
+
|
|
31
|
+
check_data = data.get("data", {})
|
|
32
|
+
result = f"【{host} 网络检测报告】\n\n"
|
|
33
|
+
|
|
34
|
+
# DNS 解析结果
|
|
35
|
+
dns = check_data.get("dns", {})
|
|
36
|
+
if dns:
|
|
37
|
+
result += "【DNS 解析】\n"
|
|
38
|
+
a_records = dns.get("A", [])
|
|
39
|
+
if a_records:
|
|
40
|
+
result += f"A记录:{', '.join(a_records)}\n"
|
|
41
|
+
aaaa_records = dns.get("AAAA", [])
|
|
42
|
+
if aaaa_records:
|
|
43
|
+
result += f"AAAA记录:{', '.join(aaaa_records)}\n"
|
|
44
|
+
cname = dns.get("CNAME")
|
|
45
|
+
if cname:
|
|
46
|
+
result += f"CNAME:{cname}\n"
|
|
47
|
+
dns_time = dns.get("time", "")
|
|
48
|
+
if dns_time:
|
|
49
|
+
result += f"查询耗时:{dns_time}\n"
|
|
50
|
+
result += "\n"
|
|
51
|
+
|
|
52
|
+
# ICMP Ping 检测
|
|
53
|
+
ping = check_data.get("ping", {})
|
|
54
|
+
if ping:
|
|
55
|
+
result += "【ICMP Ping】\n"
|
|
56
|
+
reachable = ping.get("reachable", False)
|
|
57
|
+
result += f"可达性:{'是' if reachable else '否'}\n"
|
|
58
|
+
if reachable:
|
|
59
|
+
rtt = ping.get("rtt", "")
|
|
60
|
+
if rtt:
|
|
61
|
+
result += f"延迟:{rtt}\n"
|
|
62
|
+
ip = ping.get("ip", "")
|
|
63
|
+
if ip:
|
|
64
|
+
result += f"IP地址:{ip}\n"
|
|
65
|
+
result += "\n"
|
|
66
|
+
|
|
67
|
+
# HTTP 检测
|
|
68
|
+
http = check_data.get("http", {})
|
|
69
|
+
if http:
|
|
70
|
+
result += "【HTTP 检测】\n"
|
|
71
|
+
status = http.get("status", "")
|
|
72
|
+
result += f"状态码:{status}\n"
|
|
73
|
+
ok = http.get("ok", False)
|
|
74
|
+
result += f"请求成功:{'是' if ok else '否'}\n"
|
|
75
|
+
latency = http.get("latency", "")
|
|
76
|
+
if latency:
|
|
77
|
+
result += f"响应时间:{latency}\n"
|
|
78
|
+
redirects = http.get("redirects", 0)
|
|
79
|
+
result += f"跳转次数:{redirects}\n"
|
|
80
|
+
final_url = http.get("final_url", "")
|
|
81
|
+
if final_url:
|
|
82
|
+
result += f"最终URL:{final_url}\n"
|
|
83
|
+
result += "\n"
|
|
84
|
+
|
|
85
|
+
# HTTPS 检测
|
|
86
|
+
https = check_data.get("https", {})
|
|
87
|
+
if https:
|
|
88
|
+
result += "【HTTPS 检测】\n"
|
|
89
|
+
status = https.get("status", "")
|
|
90
|
+
result += f"状态码:{status}\n"
|
|
91
|
+
ok = https.get("ok", False)
|
|
92
|
+
result += f"请求成功:{'是' if ok else '否'}\n"
|
|
93
|
+
latency = https.get("latency", "")
|
|
94
|
+
if latency:
|
|
95
|
+
result += f"响应时间:{latency}\n"
|
|
96
|
+
tls_version = https.get("tls_version", "")
|
|
97
|
+
if tls_version:
|
|
98
|
+
result += f"TLS版本:{tls_version}\n"
|
|
99
|
+
days_left = https.get("days_left", 0)
|
|
100
|
+
result += f"证书剩余天数:{days_left}天\n"
|
|
101
|
+
issuer = https.get("issuer", "")
|
|
102
|
+
if issuer:
|
|
103
|
+
result += f"证书颁发者:{issuer}\n"
|
|
104
|
+
not_after = https.get("not_after", "")
|
|
105
|
+
if not_after:
|
|
106
|
+
result += f"证书到期时间:{not_after}\n"
|
|
107
|
+
|
|
108
|
+
return result
|
|
109
|
+
|
|
110
|
+
except httpx.TimeoutException:
|
|
111
|
+
return "请求超时,请稍后重试"
|
|
112
|
+
except httpx.HTTPStatusError as e:
|
|
113
|
+
logger.error(f"HTTP 错误: {e}")
|
|
114
|
+
return f"网络检测失败: {e}"
|
|
115
|
+
except Exception as e:
|
|
116
|
+
logger.exception(f"网络检测失败: {e}")
|
|
117
|
+
return f"网络检测失败: {e}"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "function",
|
|
3
|
+
"function": {
|
|
4
|
+
"name": "news_tencent",
|
|
5
|
+
"description": "获取腾讯新闻头条。",
|
|
6
|
+
"parameters": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"page": {
|
|
10
|
+
"type": "integer",
|
|
11
|
+
"description": "新闻数量 (1-10)"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"required": []
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from typing import Any, Dict
|
|
2
|
+
import httpx
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
async def execute(args: Dict[str, Any], context: Dict[str, Any]) -> str:
|
|
9
|
+
page = args.get("page", 10)
|
|
10
|
+
url = "https://api.jkyai.top/API/txxwtt.php"
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
async with httpx.AsyncClient(timeout=15.0) as client:
|
|
14
|
+
response = await client.get(url, params={"page": page, "type": "json"})
|
|
15
|
+
response.raise_for_status()
|
|
16
|
+
data = response.json()
|
|
17
|
+
|
|
18
|
+
# 假设数据是一个列表或带有列表的字典
|
|
19
|
+
if isinstance(data, list):
|
|
20
|
+
news_list = data
|
|
21
|
+
elif isinstance(data, dict) and "data" in data:
|
|
22
|
+
news_list = data["data"]
|
|
23
|
+
else:
|
|
24
|
+
news_list = [data] if data else []
|
|
25
|
+
|
|
26
|
+
output = "📰 腾讯新闻头条:\n"
|
|
27
|
+
for item in news_list:
|
|
28
|
+
if isinstance(item, dict):
|
|
29
|
+
title = item.get("title", "")
|
|
30
|
+
url_link = item.get("url", "")
|
|
31
|
+
if title:
|
|
32
|
+
output += f"- {title}\n {url_link}\n"
|
|
33
|
+
|
|
34
|
+
return output if len(output) > 15 else f"未获取到新闻: {data}"
|
|
35
|
+
|
|
36
|
+
except Exception as e:
|
|
37
|
+
logger.exception(f"获取新闻失败: {e}")
|
|
38
|
+
return f"获取新闻失败: {e}"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "function",
|
|
3
|
+
"function": {
|
|
4
|
+
"name": "qq_level_query",
|
|
5
|
+
"description": "查询 QQ 等级信息(需要提供 Cookie)。",
|
|
6
|
+
"parameters": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"qq": {
|
|
10
|
+
"type": "integer",
|
|
11
|
+
"description": "要查询等级的 QQ 号"
|
|
12
|
+
},
|
|
13
|
+
"uin": {
|
|
14
|
+
"type": "integer",
|
|
15
|
+
"description": "提供 Cookie 的 QQ 号 (uin)"
|
|
16
|
+
},
|
|
17
|
+
"skey": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Cookie 中的 skey"
|
|
20
|
+
},
|
|
21
|
+
"pskey": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Cookie 中的 pskey (需 vip.qq.com 域)"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": ["qq", "uin", "skey", "pskey"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from typing import Any, Dict
|
|
2
|
+
import httpx
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
async def execute(args: Dict[str, Any], context: Dict[str, Any]) -> str:
|
|
8
|
+
params = {
|
|
9
|
+
"qq": args.get("qq"),
|
|
10
|
+
"uin": args.get("uin"),
|
|
11
|
+
"skey": args.get("skey"),
|
|
12
|
+
"pskey": args.get("pskey")
|
|
13
|
+
}
|
|
14
|
+
url = "https://api.xingzhige.com/API/QQ_level/"
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
async with httpx.AsyncClient(timeout=15.0) as client:
|
|
18
|
+
response = await client.get(url, params=params)
|
|
19
|
+
response.raise_for_status()
|
|
20
|
+
data = response.json()
|
|
21
|
+
|
|
22
|
+
if isinstance(data, dict):
|
|
23
|
+
nick = data.get("nick")
|
|
24
|
+
qq_level = data.get("QQlevel")
|
|
25
|
+
uin = data.get("uin", params["qq"])
|
|
26
|
+
avatar = data.get("avatar")
|
|
27
|
+
|
|
28
|
+
output_lines = []
|
|
29
|
+
|
|
30
|
+
header = "⭐ QQ等级查询"
|
|
31
|
+
if nick:
|
|
32
|
+
header += f": {nick}"
|
|
33
|
+
if uin:
|
|
34
|
+
header += f" ({uin})"
|
|
35
|
+
output_lines.append(header)
|
|
36
|
+
|
|
37
|
+
if qq_level:
|
|
38
|
+
output_lines.append(f"🆙 等级: {qq_level}")
|
|
39
|
+
|
|
40
|
+
if avatar:
|
|
41
|
+
output_lines.append(f"🖼️ 头像: {avatar}")
|
|
42
|
+
|
|
43
|
+
return "\n".join(output_lines)
|
|
44
|
+
return str(data)
|
|
45
|
+
|
|
46
|
+
except Exception as e:
|
|
47
|
+
logger.exception(f"QQ等级查询失败: {e}")
|
|
48
|
+
return f"QQ等级查询失败: {e}"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "function",
|
|
3
|
+
"function": {
|
|
4
|
+
"name": "speed",
|
|
5
|
+
"description": "网站测速工具,测试指定网站的GET请求响应时间(毫秒),帮助监测网站性能。",
|
|
6
|
+
"parameters": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"url": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "需要测速的网站链接,例如:https://www.example.com"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"required": ["url"]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from typing import Any, Dict
|
|
2
|
+
import logging
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
async def execute(args: Dict[str, Any], context: Dict[str, Any]) -> str:
|
|
8
|
+
url = args.get("url")
|
|
9
|
+
|
|
10
|
+
if not url:
|
|
11
|
+
return "❌ URL不能为空"
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
async with httpx.AsyncClient(timeout=30.0) as client:
|
|
15
|
+
params = {
|
|
16
|
+
"url": url
|
|
17
|
+
}
|
|
18
|
+
logger.info(f"网站测速: {url}")
|
|
19
|
+
|
|
20
|
+
response = await client.get("https://v2.xxapi.cn/api/speed", params=params)
|
|
21
|
+
response.raise_for_status()
|
|
22
|
+
data = response.json()
|
|
23
|
+
|
|
24
|
+
if data.get("code") != 200:
|
|
25
|
+
return f"测速失败: {data.get('msg')}"
|
|
26
|
+
|
|
27
|
+
result = data.get("data")
|
|
28
|
+
return f"网站 {url} 响应时间:\n{result}"
|
|
29
|
+
|
|
30
|
+
except httpx.TimeoutException:
|
|
31
|
+
return "请求超时,请稍后重试"
|
|
32
|
+
except httpx.HTTPStatusError as e:
|
|
33
|
+
logger.error(f"HTTP 错误: {e}")
|
|
34
|
+
return f"测速失败: {e}"
|
|
35
|
+
except Exception as e:
|
|
36
|
+
logger.exception(f"网站测速失败: {e}")
|
|
37
|
+
return f"测速失败: {e}"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "function",
|
|
3
|
+
"function": {
|
|
4
|
+
"name": "tcping",
|
|
5
|
+
"description": "TCPing测试工具,使用TCP协议测试指定IP或域名的端口延迟,即使目标端口禁Ping也能检测。",
|
|
6
|
+
"parameters": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"address": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "需要tcping的IP或域名(不需要加http或https)"
|
|
12
|
+
},
|
|
13
|
+
"port": {
|
|
14
|
+
"type": "integer",
|
|
15
|
+
"description": "需要tcping的端口(1-65535)"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"required": ["address", "port"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from typing import Any, Dict
|
|
2
|
+
import logging
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
async def execute(args: Dict[str, Any], context: Dict[str, Any]) -> str:
|
|
8
|
+
address = args.get("address")
|
|
9
|
+
port = args.get("port")
|
|
10
|
+
|
|
11
|
+
if not address:
|
|
12
|
+
return "❌ 地址不能为空"
|
|
13
|
+
if not port:
|
|
14
|
+
return "❌ 端口不能为空"
|
|
15
|
+
if not isinstance(port, int):
|
|
16
|
+
return "❌ 端口必须是整数"
|
|
17
|
+
if port < 1 or port > 65535:
|
|
18
|
+
return "❌ 端口必须在 1-65535 之间"
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
async with httpx.AsyncClient(timeout=30.0) as client:
|
|
22
|
+
params = {
|
|
23
|
+
"address": address,
|
|
24
|
+
"port": port
|
|
25
|
+
}
|
|
26
|
+
logger.info(f"TCPing: {address}:{port}")
|
|
27
|
+
|
|
28
|
+
response = await client.get("https://v2.xxapi.cn/api/tcping", params=params)
|
|
29
|
+
response.raise_for_status()
|
|
30
|
+
data = response.json()
|
|
31
|
+
|
|
32
|
+
if data.get("code") != 200:
|
|
33
|
+
return f"TCPing失败: {data.get('msg')}"
|
|
34
|
+
|
|
35
|
+
result_data = data.get("data", {})
|
|
36
|
+
ping_result = result_data.get("ping")
|
|
37
|
+
result_address = result_data.get("address", address)
|
|
38
|
+
result_port = result_data.get("port", port)
|
|
39
|
+
|
|
40
|
+
output_lines = ["TCPing测试结果:", f"地址:{result_address}", f"端口:{result_port}"]
|
|
41
|
+
if ping_result:
|
|
42
|
+
output_lines.append(f"延迟:{ping_result}")
|
|
43
|
+
|
|
44
|
+
return "\n".join(output_lines)
|
|
45
|
+
|
|
46
|
+
except httpx.TimeoutException:
|
|
47
|
+
return "请求超时,请稍后重试"
|
|
48
|
+
except httpx.HTTPStatusError as e:
|
|
49
|
+
logger.error(f"HTTP 错误: {e}")
|
|
50
|
+
return f"TCPing失败: {e}"
|
|
51
|
+
except Exception as e:
|
|
52
|
+
logger.exception(f"TCPing失败: {e}")
|
|
53
|
+
return f"TCPing失败: {e}"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "function",
|
|
3
|
+
"function": {
|
|
4
|
+
"name": "weather_query",
|
|
5
|
+
"description": "查询指定城市的天气实况、未来预报或生活指数(如穿衣、洗车、运动建议等)。",
|
|
6
|
+
"parameters": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"location": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "城市名称,例如 '北京', 'shanghai'。"
|
|
12
|
+
},
|
|
13
|
+
"query_type": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"enum": ["now", "forecast", "life"],
|
|
16
|
+
"description": "查询类型: 'now'(实况天气, 默认), 'forecast'(未来天气预报), 'life'(生活指数/建议)。"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": ["location"]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|