Skill: conversation-summary (version 1.0.1)

--- name: conversation-summary description: 会话小结 - 输入对话内容，调用API返回会话摘要，支持增量更新历史摘要。 emoji: 📝 author: openclaw version: 1.0.0 license: MIT requires: bins: - python3 pip: - requests tools: - name: summarize_conversation description: 对对话内容进行小结，生成会话摘要 parameters: type: object properties: chat_list: type: string description: "对话内容列表，JSON格式的对话记录，例如：[{\"role\":\"user\",\"content\":\"你好\"}]" history_summary: type: string description: "历史会话摘要（可选），用于增量更新摘要，默认为空" required: [chat_list] --- # Conversation Summary - Agent Instructions Use this skill to generate summaries for conversation content. ## Usage When the user requests any of the following: - "帮我总结一下这段对话" - "生成会话小结" - "对这些聊天记录做个摘要" - "总结一下我们刚才聊了什么" Use the `summarize_conversation` tool to call the summary API. ## Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | chat_list | string | Yes | JSON formatted conversation content | | history_summary | string | No | Previous summary for incremental update | ### chat_list Format Example ```json [ {"role": "user", "content": "今天天气怎么样？"}, {"role": "assistant", "content": "今天天气晴朗，气温25度。"} ] ``` ## Response The API returns JSON with: - `code`: Status code, 0 means success - `message`: Status message - `data.summary`: Generated conversation summary ## Error Handling - If the API returns a non-zero code, report the error message to the user - If the request fails, check network connectivity - Ensure chat_list is valid JSON format before calling

path: _meta.json
content: slug: conversation-summary
version: 1.0.0

path: package.json
content: {
  "name": "conversation-summary",
  "version": "1.0.0",
  "description": "会话小结 - 输入对话内容，返回会话摘要",
  "author": "openclaw",
  "license": "MIT",
  "keywords": ["conversation", "summary", "ai", "chat"],
  "scripts": {
    "postinstall": "chmod +x scripts/conversation_summary.py"
  },
  "dependencies": {
    "requests": "^2.31.0"
  },
  "skill": {
    "entry": "SKILL.md",
    "platform": ["linux", "darwin", "win32"]
  }
}


path: scripts/conversation_summary.py
content: #!/usr/bin/env python3
"""
Conversation Summary - Call API to generate conversation summaries
"""
import os
import sys
import json
import requests

# ============================================================================
# CONFIGURATION
# ============================================================================
SUMMARY_API_URL = "https://iautomark.sdm.qq.com/assistant-analyse/v1/assistant/poc/summary/trigger"

def summarize_conversation(chat_list: str, history_summary: str = "") -> dict:
    """
    Call the summary API to generate a conversation summary.
    
    Args:
        chat_list: JSON formatted conversation content
        history_summary: Previous summary for incremental update (optional)
    
    Returns:
        dict: API response with summary or error
    """
    if not chat_list or chat_list.strip() == "":
        return {"status": "error", "error": "chat_list 参数不能为空，请提供对话内容"}
    
    try:
        response = requests.post(
            SUMMARY_API_URL,
            headers={"Content-Type": "application/json"},
            json={
                "chatList": chat_list,
                "historySummary": history_summary or ""
            },
            timeout=30
        )
        
        if not response.ok:
            return {
                "status": "error",
                "error": f"API 请求失败: HTTP {response.status_code} {response.reason}"
            }
        
        result = response.json()
        
        if result.get("code") != 0:
            return {
                "status": "error",
                "error": f"会话小结生成失败: {result.get('message', '未知错误')}"
            }
        
        return {
            "status": "completed",
            "summary": result.get("data", {}).get("summary", "无法生成摘要"),
            "message": "会话小结生成成功"
        }
        
    except requests.exceptions.Timeout:
        return {"status": "error", "error": "请求超时，请稍后重试"}
    except requests.exceptions.RequestException as e:
        return {"status": "error", "error": f"网络请求错误: {str(e)}"}
    except json.JSONDecodeError:
        return {"status": "error", "error": "API 返回数据格式错误"}
    except Exception as e:
        return {"status": "error", "error": f"未知错误: {str(e)}"}


def main():
    if len(sys.argv) < 2:
        print(json.dumps({
            "error": "Usage: python conversation_summary.py <chat_list> [history_summary]"
        }, ensure_ascii=False, indent=2))
        sys.exit(1)
    
    chat_list = sys.argv[1]
    history_summary = sys.argv[2] if len(sys.argv) > 2 else ""
    
    result = summarize_conversation(chat_list, history_summary)
    
    print(json.dumps(result, ensure_ascii=False, indent=2))
    sys.exit(0 if result.get("status") == "completed" else 1)


if __name__ == "__main__":
    main()


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)