用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/advent259141/astrbot_self_manager_skill --skill conversation-manager命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | conversation-manager |
| description | 管理对话记录的列出、清除、切换和删除操作 |
| version | 2.0.0 |
| author | AstrBot Community |
| requires_admin | true |
| requires_computer_use | true |
管理 AI 对话历史记录。
async def list_conversations(context, umo: str):
try:
conversations = await context.conversation_mgr.list_conversations(umo)
if not conversations:
return "当前没有对话记录。"
lines = ["💬 对话列表:\n"]
for i, conv in enumerate(conversations, 1):
conv_id = conv.get("id", "")
title = conv.get("title", f"对话 {i}")
msg_count = conv.get("message_count", 0)
is_current = conv.get("is_current", False)
marker = "👉 " if is_current else " "
lines.append(f"{marker}{i}. **{title}** ({msg_count} 条消息) [ID: {conv_id}]")
return "\n".join(lines)
except Exception as e:
return f"❌ 列出对话失败:{e}"
event = globals().get('event')
if not event.is_admin():
print("❌ 错误:仅管理员可用")
import sys; sys.exit(1)
context = globals().get('context')
umo = event.unified_msg_origin
result = await list_conversations(context, umo)
print(result)
async def clear_conversation(context, umo: str):
try:
await context.conversation_mgr.clear_conversation(umo)
return "✅ 当前对话已清除。"
except Exception as e:
return f"❌ 清除失败:{e}"
result = await clear_conversation(context, umo)
print(result)
async def switch_conversation(context, umo: str, conversation_id: str):
try:
success = await context.conversation_mgr.switch_conversation(umo, conversation_id)
if success:
return f"✅ 已切换到对话「{conversation_id}」。"
else:
return f"❌ 切换失败:对话不存在。"
except Exception as e:
return f"❌ 切换失败:{e}"
# 从用户输入提取对话 ID
result = await switch_conversation(context, umo, conversation_id="<对话ID>")
print(result)
async def delete_conversation(context, umo: str, conversation_id: str):
try:
await context.conversation_mgr.delete_conversation(umo, conversation_id)
return f"✅ 对话「{conversation_id}」已删除。"
except Exception as e:
return f"❌ 删除失败:{e}"
result = await delete_conversation(context, umo, conversation_id="<对话ID>")
print(result)