← 返回 Skills 市场
scikkk

Chatbot

作者 scikkk · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
381
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install chatbot
功能描述
Build real-time voice chatbot applications with natural conversation flow and customizable personalities. Use when users want to create voice assistants, con...
使用说明 (SKILL.md)

SenseAudio Voice Chatbot

Build real-time voice chatbot applications with natural conversation flow, emotion recognition, and customizable personalities.

What This Skill Does

  • Create voice-enabled chatbot applications
  • Support real-time voice dialogue with low latency
  • Enable multi-turn conversations with context
  • Customize chatbot personality and knowledge
  • Integrate with existing applications

Implementation Guide

Step 1: Get Available Agents

import requests

def get_available_agents(page=1, size=10):
    url = "https://api.senseaudio.cn/v1/realtime/agents"
    headers = {"Authorization": f"Bearer {API_KEY}"}
    params = {"page": page, "size": size}

    response = requests.get(url, headers=headers, params=params)
    return response.json()

# Example response:
# {
#   "total": 10,
#   "list": [
#     {
#       "id": "690f53770e9d9d60d98ba7a8",
#       "title": "Customer Service Agent",
#       "avatar": "https://example.com/avatar.jpg",
#       "intro": "Professional customer service assistant"
#     }
#   ]
# }

Step 2: Create Dialogue Session

def create_dialogue_session(agent_id, new_dialogue=True, conv_id=None):
    url = "https://api.senseaudio.cn/v1/realtime/invoke"
    headers = {
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json"
    }

    payload = {
        "agent_id": agent_id,
        "new_dialogue": new_dialogue
    }

    if not new_dialogue and conv_id:
        payload["conv_id"] = conv_id

    response = requests.post(url, headers=headers, json=payload)
    return response.json()

# Returns:
# {
#   "conv_id": "9b8260e2-19d9-4609-abe7-3b74ac16b677",
#   "app_id": "d4432b04117aj77r7755c2d8e86e140b",
#   "room_id": "lO81loRAfmUMFIwY",
#   "room_user_id": 360706506,
#   "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
# }

Step 3: Connect to Real-Time Voice

import asyncio
import websockets
import json

async def voice_chatbot_session(room_id, token, app_id):
    # Use WebRTC or WebSocket for real-time audio
    # This is a simplified example

    session_info = {
        "room_id": room_id,
        "token": token,
        "app_id": app_id
    }

    # Connect to voice service
    # Implementation depends on the real-time communication protocol
    # Typically uses WebRTC for browser-based applications

    return session_info

Step 4: Manage Conversation State

class VoiceChatbot:
    def __init__(self, agent_id, api_key):
        self.agent_id = agent_id
        self.api_key = api_key
        self.conv_id = None
        self.room_id = None
        self.session_active = False

    def start_conversation(self):
        """Start a new conversation"""
        result = create_dialogue_session(
            agent_id=self.agent_id,
            new_dialogue=True
        )

        self.conv_id = result["conv_id"]
        self.room_id = result["room_id"]
        self.session_active = True

        return result

    def continue_conversation(self):
        """Continue existing conversation"""
        if not self.conv_id:
            raise ValueError("No active conversation to continue")

        result = create_dialogue_session(
            agent_id=self.agent_id,
            new_dialogue=False,
            conv_id=self.conv_id
        )

        self.room_id = result["room_id"]
        return result

    def check_status(self):
        """Check if agent is running"""
        url = "https://api.senseaudio.cn/v1/realtime/status"
        headers = {"Authorization": f"Bearer {self.api_key}"}
        params = {"room_id": self.room_id}

        response = requests.get(url, headers=headers, params=params)
        return response.json()

    def end_conversation(self):
        """Stop the agent"""
        url = "https://api.senseaudio.cn/v1/realtime/leave"
        headers = {
            "Authorization": f"Bearer {self.api_key}",
            "Content-Type": "application/json"
        }
        payload = {"room_id": self.room_id}

        response = requests.post(url, headers=headers, json=payload)
        self.session_active = False
        return response.json()

Advanced Features

Web-Based Voice Chatbot

\x3C!DOCTYPE html>
\x3Chtml>
\x3Chead>
    \x3Ctitle>Voice Chatbot\x3C/title>
\x3C/head>
\x3Cbody>
    \x3Cdiv id="chatbot">
        \x3Cbutton id="startBtn">Start Conversation\x3C/button>
        \x3Cbutton id="stopBtn" disabled>Stop Conversation\x3C/button>
        \x3Cdiv id="status">Ready\x3C/div>
    \x3C/div>

    \x3Cscript>
        let chatbot = null;
        let roomId = null;

        document.getElementById('startBtn').onclick = async () => {
            const response = await fetch('/api/start-chatbot', {
                method: 'POST',
                headers: {'Content-Type': 'application/json'},
                body: JSON.stringify({agent_id: 'YOUR_AGENT_ID'})
            });

            const data = await response.json();
            roomId = data.room_id;

            // Initialize WebRTC connection
            await initializeVoiceConnection(data);

            document.getElementById('startBtn').disabled = true;
            document.getElementById('stopBtn').disabled = false;
            document.getElementById('status').textContent = 'Connected';
        };

        document.getElementById('stopBtn').onclick = async () => {
            await fetch('/api/stop-chatbot', {
                method: 'POST',
                headers: {'Content-Type': 'application/json'},
                body: JSON.stringify({room_id: roomId})
            });

            document.getElementById('startBtn').disabled = false;
            document.getElementById('stopBtn').disabled = true;
            document.getElementById('status').textContent = 'Disconnected';
        };

        async function initializeVoiceConnection(sessionData) {
            // WebRTC setup code here
            // Use sessionData.token for authentication
        }
    \x3C/script>
\x3C/body>
\x3C/html>

Multi-User Support

class ChatbotManager:
    def __init__(self, api_key):
        self.api_key = api_key
        self.active_sessions = {}

    def create_session(self, user_id, agent_id):
        chatbot = VoiceChatbot(agent_id, self.api_key)
        session_info = chatbot.start_conversation()

        self.active_sessions[user_id] = {
            "chatbot": chatbot,
            "session_info": session_info,
            "started_at": datetime.now()
        }

        return session_info

    def get_session(self, user_id):
        return self.active_sessions.get(user_id)

    def end_session(self, user_id):
        if user_id in self.active_sessions:
            session = self.active_sessions[user_id]
            session["chatbot"].end_conversation()
            del self.active_sessions[user_id]

Conversation Analytics

def track_conversation_metrics(conv_id, room_id):
    metrics = {
        "conv_id": conv_id,
        "room_id": room_id,
        "start_time": datetime.now(),
        "end_time": None,
        "duration": None,
        "user_messages": 0,
        "agent_responses": 0
    }

    return metrics

def update_metrics(metrics, event_type):
    if event_type == "user_message":
        metrics["user_messages"] += 1
    elif event_type == "agent_response":
        metrics["agent_responses"] += 1
    elif event_type == "session_end":
        metrics["end_time"] = datetime.now()
        metrics["duration"] = (metrics["end_time"] - metrics["start_time"]).total_seconds()

    return metrics

Use Cases

Customer Service Bot

def create_customer_service_bot(agent_id):
    """Create a customer service voice bot"""

    chatbot = VoiceChatbot(agent_id, API_KEY)

    # Start conversation
    session = chatbot.start_conversation()

    # Monitor status
    while chatbot.session_active:
        status = chatbot.check_status()
        if status["status"] == "STOPPED":
            break

        time.sleep(5)

    return session

Educational Assistant

def create_learning_assistant(agent_id, student_id):
    """Create personalized learning assistant"""

    chatbot = VoiceChatbot(agent_id, API_KEY)

    # Start new lesson
    session = chatbot.start_conversation()

    # Track learning progress
    metrics = track_conversation_metrics(
        session["conv_id"],
        session["room_id"]
    )

    return session, metrics

Companion Bot

def create_companion_bot(agent_id, user_id):
    """Create emotional support companion"""

    chatbot = VoiceChatbot(agent_id, API_KEY)

    # Continue previous conversation if exists
    if has_previous_conversation(user_id):
        conv_id = get_previous_conv_id(user_id)
        session = chatbot.continue_conversation()
    else:
        session = chatbot.start_conversation()

    return session

Error Handling

def safe_chatbot_operation(operation, *args, **kwargs):
    try:
        return operation(*args, **kwargs)
    except requests.exceptions.HTTPError as e:
        if e.response.status_code == 400:
            if "400087" in str(e.response.content):
                return {"error": "Insufficient quota"}
            return {"error": "Invalid parameters"}
        elif e.response.status_code == 401:
            return {"error": "Unauthorized"}
        elif e.response.status_code == 404:
            return {"error": "Conversation not found"}
        else:
            return {"error": f"HTTP error: {e.response.status_code}"}
    except Exception as e:
        return {"error": f"Unexpected error: {str(e)}"}

Output Format

  • Session credentials (room_id, token)
  • Conversation ID for continuity
  • Status information
  • Analytics and metrics

Tips for Best Results

  • Always check agent status before operations
  • Properly end sessions to free resources
  • Handle network interruptions gracefully
  • Store conv_id for conversation continuity
  • Monitor quota usage
  • Implement timeout mechanisms

Example Usage

User request: "Create a voice chatbot for customer support"

Skill actions:

  1. Get list of available agents
  2. Select appropriate customer service agent
  3. Create dialogue session
  4. Set up WebRTC connection
  5. Implement conversation management
  6. Add status monitoring
  7. Provide integration code

Reference

See SenseAudio Agent API documentation in references/ directory.

安全使用建议
This skill appears to do what it says: it calls senseaudio.cn realtime APIs and needs an API key. Before installing: (1) confirm the SENSEAUDIO_API_KEY requirement (registry metadata currently omits it) and store the key securely with least privilege; (2) review senseaudio.cn privacy and data retention policies because audio and conversation data will be transmitted to that service; (3) validate the skill source (https://github.com/anthropics/skills and the provider homepage) and prefer testing in an isolated environment first; (4) if you rely on automated tooling, update the registry metadata to include the required credential so permission prompts are accurate.
功能分析
Type: OpenClaw Skill Name: chatbot Version: 1.0.0 The skill bundle provides legitimate boilerplate code and instructions for integrating with the SenseAudio voice chatbot API (api.senseaudio.cn). The Python snippets in SKILL.md demonstrate standard API interactions, such as session management and status monitoring, without any signs of data exfiltration, malicious execution, or harmful prompt injection.
能力评估
Purpose & Capability
The SKILL.md describes building real-time voice chatbots and shows code that calls senseaudio.cn realtime APIs. Requesting an API key for senseaudio is consistent with that purpose and no unrelated services or credentials are requested.
Instruction Scope
The runtime instructions are focused on using the senseaudio.cn API (create session, join room, manage conversation) and WebRTC/WebSocket for audio. They reference an API key (API_KEY) and tokens returned by the service. The instructions do not request reading local files, other environment variables, or scanning system state. Note: SKILL.md references an API_KEY env var but the registry metadata omitted that requirement — see environment_proportionality.
Install Mechanism
This is an instruction-only skill with no install spec and no code files, so nothing is written to disk by an installer. That lowers install-time risk.
Credentials
The skill requires a SENSEAUDIO_API_KEY (mapped to API_KEY in examples) which is appropriate for the described purpose. However, the registry metadata lists no required env vars or primary credential while SKILL.md declares required_credentials (SENSEAUDIO_API_KEY). This metadata mismatch should be resolved before trusting automated installation or permission grants. Also be aware that audio and conversational data (and tokens) will be sent to senseaudio.cn as part of normal operation.
Persistence & Privilege
The skill does not request 'always: true' or elevated persistence and is user-invocable only. There is no indication it modifies other skills or global agent settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install chatbot
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /chatbot 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of the SenseAudio Voice Chatbot skill. - Enables real-time, voice-enabled chatbot applications with natural conversation flow. - Supports multi-turn dialogue, emotion recognition, and customizable personalities. - Provides implementation examples for session management, agent selection, and integration with web or Python applications. - Includes guidance for multi-user management and conversation analytics tracking. - Requires a SenseAudio API key for use.
元数据
Slug chatbot
版本 1.0.0
许可证 MIT-0
累计安装 2
当前安装数 2
历史版本数 1
常见问题

Chatbot 是什么?

Build real-time voice chatbot applications with natural conversation flow and customizable personalities. Use when users want to create voice assistants, con... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 381 次。

如何安装 Chatbot?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install chatbot」即可一键安装,无需额外配置。

Chatbot 是免费的吗?

是的,Chatbot 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Chatbot 支持哪些平台?

Chatbot 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Chatbot?

由 scikkk(@scikkk)开发并维护,当前版本 v1.0.0。

💬 留言讨论