Skill: conversation-summarizer (version 1.0.0)

--- name: conversation-summary description: Generate summaries for conversation content with incremental update support. emoji: 📝 author: lyue82665-droid version: 1.0.0 license: MIT requires: bins: - python3 pip: - requests tools: - name: summarize_conversation description: Generate a summary for conversation content. parameters: type: object properties: chat_list: type: string description: "JSON formatted conversation list, e.g., [{\"role\":\"user\",\"content\":\"hello\"}]" history_summary: type: string description: "Previous summary for incremental update (optional)" 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: - "Summarize this conversation" - "Generate a summary" - "What did we talk about" Use the `summarize_conversation` tool to call the summary API. ## How to Call ```bash python3 scripts/conversation_summary.py '<chat_list_json>' '<history_summary>' ``` ### 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": "How is the weather today?"}, {"role": "assistant", "content": "It is sunny, 25 degrees."} ] ``` ## Response The script returns JSON with: - `status`: "completed" or "error" - `summary`: Generated conversation summary - `error`: Error message if failed ## 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: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)