Skill: frankchi2022/ai-girl-selection (version 1.1.1)

--- name: 选妃 description: 每日 AI Girl 选妃 - 从指定目录（目录里要有图片）随机选择 3 张 AI 女孩图片，让用户选择一个最喜欢的，自动保存为新头像并记录偏好。使用场景：(1) 每日早晨执行选妃任务，(2) 需要更新 AI 助手形象时，(3) 需要随机选择图片用于展示或测试 metadata: { "openclaw": { "requires": { "bins": ["python3"] }, "install": [], }, } --- # 选妃 - Daily AI Girl Portrait Selection ## 功能概述 每日随机从指定目录选择 3 张 AI Girl 图片，让你选择最喜欢的一个作为新头像。适合需要更新 AI 助手形象的场景。 # 效果展示 ## 预览界面示例 ![预览界面](assets/demo1.png) **说明**: 上图展示了选妃任务生成的精美 HTML 预览页面，包含 3 张 AI Girl 图片的卡片式布局。 ## 其他截图 ![第二张截图](assets/demo2.png) ## 使用方法 ### 基本用法 只需说： - **"选妃"** - 直接执行选妃任务 - **"开始选妃"** - 同上 ### 工作流程 1. 从 `/Volumes/info/sex/picture/AI girls/` 目录随机选取 3 张图片 2. 发送给你展示，并提供清晰的预览 3. 等待你选择（说"选 1"、"选 2"、"选 3"或文件名） 4. 自动保存你选择的图片作为新头像 5. 记录你的偏好到 `.learnings/AI-GIRL-PREFERENCES.md` 6. 更新头像文件 `~/.openclaw/workspace/avatars/mimi-today.png` ### 配置路径 - **图片源目录**: `/Volumes/info/sex/picture/AI girls/` (可修改) - **头像保存位置**: `~/.openclaw/workspace/avatars/mimi-today.png` - **偏好记录文件**: `.learnings/AI-GIRL-PREFERENCES.md` ## 脚本工具 脚本位于 `scripts/ai-girl-selection.sh`，支持： - ✅ 随机选择 3 张图片 - ✅ 自动保存到预览目录 - ✅ 创建精美的 HTML 预览页面 - ✅ 记录选择偏好 - ✅ 自动更新头像 ## 示例对话 ``` 用户：选妃 Mimi: 🌹 选妃时间 - Daily AI Girl Selection 随机选取了 3 张 AI Girl 图片，请选一个你喜欢的： 1. 20250725_002805.jpg 2. 20250716_000913.jpg 3. 00004-145824367.png 告诉我你的选择吧！(直接说 "选 1/2/3") 😏 ``` ## 输出格式 - **成功**: 保存选择，更新头像，记录偏好 - **错误**: 目录不存在、没有图片、选择无效等 ## 注意事项 - 确保源目录存在且有 JPG/PNG/WebP 图片 - 选择的图片将保存为 `mimi-today.png` 作为当日头像 - 偏好记录包含日期、时间、选择的文件名 - 支持旋转头像（可根据需要添加）

path: scripts/ai-girl-selection.sh
content: #!/bin/bash
# AI Girl Selection Tool
# Daily random selection of 3 AI girl portraits

SOURCE_DIR="/Volumes/info/sex/picture/AI girls"
PREVIEW_DIR="/Users/qifengxiang/.openclaw/workspace"
AVATAR_DIR="/Users/qifengxiang/.openclaw/workspace/avatars"
PREFERENCES_FILE="/Users/qifengxiang/.openclaw/workspace/.learnings/AI-GIRL-PREFERENCES.md"

# Ensure directories exist
mkdir -p "$PREVIEW_DIR" "$AVATAR_DIR" "$(dirname $PREFERENCES_FILE)"

# Get list of image files
get_random_images() {
    cd "$SOURCE_DIR"
    ls -1 | grep -iE '\.(jpg|jpeg|png|webp)$' | sort | awk 'BEGIN{srand()} 
    {arr[NR]=$0} 
    END{
        for(i=1;i<=3;i++){
            idx=int(rand()*NR)+1; 
            print arr[idx]; 
            delete arr[idx]; 
            for(j=idx;j<NR;j++)arr[j]=arr[j+1];
            NR--
        }
    }'
}

# Select 3 random images
echo "🌹 选妃时间 - Daily AI Girl Selection"
echo "======================================"
echo "当前时间：$(date -u '+%Y-%m-%d %H:%M Asia/Shanghai')"
echo ""

RANDOM_FILES=$(get_random_images)
COUNTER=0

echo "随机选取了 3 张 AI Girl 图片：\n"
while IFS= read -r filename; do
    COUNTER=$((COUNTER+1))
    FULL_PATH="$SOURCE_DIR/$filename"
    
    # Copy to preview directory
    cp "$FULL_PATH" "$PREVIEW_DIR/preview${COUNTER}.$(echo $filename | grep -oE '\.[^.]+$')"
    
    echo "$COUNTER. $filename ✅"
done <<< "$RANDOM_FILES"

echo ""
echo "请选择一个你喜欢的："
echo '  说 "选 1" / "选 2" / "选 3"'
echo '  或 "第一个" / "第二个" / "第三个"'
echo '  或 直接说文件名'
echo ""

# Create HTML preview
cat > "$PREVIEW_DIR/selection-preview.html" << 'HTMLEOF'
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>🌹 选妃时间</title>
    <style>
        body { 
            font-family: -apple-system, BlinkMacSystemFont, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
            min-height: 100vh;
            padding: 40px;
            margin: 0;
        }
        .container { 
            max-width: 1400px; 
            margin: 0 auto;
            background: rgba(255,255,255,0.95);
            border-radius: 20px;
            padding: 40px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
        }
        h1 { color: #667eea; text-align: center; font-size: 2.8em; margin-bottom: 10px; }
        h2 { color: #333; text-align: center; font-size: 1.2em; margin-bottom: 40px; font-weight: normal; }
        .gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 40px; margin-top: 40px; }
        .card { 
            background: white; 
            border-radius: 16px; 
            padding: 25px; 
            box-shadow: 0 8px 24px rgba(0,0,0,0.12); 
            text-align: center;
            transition: all 0.3s ease;
            border: 2px solid transparent;
        }
        .card:hover { 
            transform: translateY(-8px);
            box-shadow: 0 16px 40px rgba(0,0,0,0.2);
            border-color: #667eea;
        }
        .card img { 
            max-width: 100%; 
            max-height: 500px;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            object-fit: contain;
        }
        .card-title { font-size: 1.6em; font-weight: bold; color: #333; margin-bottom: 15px; }
        .card-desc { color: #666; margin-top: 10px; font-size: 0.9em; }
        .instruction { text-align: center; padding: 30px; margin-top: 40px; background: #f8f9fa; border-radius: 12px; }
        .instruction strong { color: #667eea; font-size: 1.3em; }
    </style>
</head>
<body>
    <div class="container">
        <h1>🌹 选妃时间</h1>
        <h2>Daily AI Girl Portrait Selection - $(date -u '+%Y-%m-%d %H:%M Asia/Shanghai')</h2>
        <div class="gallery">
HTMLEOF

# Add cards for each preview
for i in 1 2 3; do
    PREVIEW_FILE="$PREVIEW_DIR/preview${i}.*"
    PREVIEW_FILE=$(ls $PREVIEW_FILE 2>/dev/null | head -1)
    if [ -f "$PREVIEW_FILE" ]; then
        cat >> "$PREVIEW_DIR/selection-preview.html" << EOF
            <div class="card">
                <div class="card-title">👉 候选 $i 👈</div>
                <img src="$PREVIEW_FILE" alt="候选者 $i">
                <div class="card-desc">Filename: $(basename "$PREVIEW_FILE")</div>
            </div>
EOF
    fi
done

cat >> "$PREVIEW_DIR/selection-preview.html" << 'HTMLEOF'
        </div>
        <div class="instruction">
            <strong>请告诉我你的选择！</strong><br>
            说 <strong>"选 1"</strong> / <strong>"选 2"</strong> / <strong>"选 3"</strong><br>
            或 <strong>"第一个"</strong> / <strong>"第二个"</strong> / <strong>"第三个"</strong><br>
            或 <strong>直接说文件名</strong>
        </div>
    </div>
</body>
</html>
HTMLEOF

# Open in browser
open "$PREVIEW_DIR/selection-preview.html"

echo "✅ HTML preview created: $PREVIEW_DIR/selection-preview.html"
echo "   (Opened in your default browser)"
echo ""
echo "现在请在聊天中告诉我你的选择！"


path: scripts/process-selection.sh
content: #!/bin/bash
# Process user selection and save avatar

SELECTION=$1
PREVIEW_DIR="/Users/qifengxiang/.openclaw/workspace"
AVATAR_DIR="/Users/qifengxiang/.openclaw/workspace/avatars"
PREFERENCES_FILE="/Users/qifengxiang/.openclaw/workspace/.learnings/AI-GIRL-PREFERENCES.md"
SOURCE_DIR="/Volumes/info/sex/picture/AI girls"

# Ensure directories exist
mkdir -p "$AVATAR_DIR" "$(dirname $PREFERENCES_FILE)"

# Map selection to filename
case $SELECTION in
    1|第一个|first)
        CHOSEN_FILE="20250725_002805.jpg"
        ;;
    2|第二个|second)
        CHOSEN_FILE="20250716_000913.jpg"
        ;;
    3|第三个|third)
        CHOSEN_FILE="00004-145824367.png"
        ;;
    *.jpg|*.png|*.webp)
        CHOSEN_FILE="$SELECTION"
        ;;
    *)
        echo "❌ 无效的选择：$SELECTION"
        echo "有效选择：1, 2, 3, 第一个，第二个，第三个，或文件名"
        exit 1
        ;;
esac

# Find the actual file
ACTUAL_FILE=$(find "$SOURCE_DIR" -name "$CHOSEN_FILE" -type f 2>/dev/null | head -1)

if [ -z "$ACTUAL_FILE" ]; then
    echo "❌ 未找到文件：$CHOSEN_FILE"
    exit 1
fi

# Copy to avatar
cp "$ACTUAL_FILE" "$AVATAR_DIR/mimi-today.png"

# Record preference
TIMESTAMP=$(date -u '+%Y-%m-%d %H:%M Asia/Shanghai')
cat > "$PREFERENCES_FILE" << EOF
{
  "status": "success",
  "date": "$TIMESTAMP",
  "selected": "$CHOSEN_FILE",
  "avatar_saved": true,
  "location": "$AVATAR_DIR/mimi-today.png"
}
EOF

echo "✅ 选择已保存：$CHOSEN_FILE"
echo "✅ 新头像已更新：$AVATAR_DIR/mimi-today.png"
echo "✅ 偏好已记录：$PREFERENCES_FILE"


path: scripts/select-3.sh
content: #!/bin/bash
# Full AI Girl selection workflow

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PREVIEW_DIR="/Users/qifengxiang/.openclaw/workspace"
AVATAR_DIR="/Users/qifengxiang/.openclaw/workspace/avatars"
PREFERENCES_FILE="/Users/qifengxiang/.openclaw/workspace/.learnings/AI-GIRL-PREFERENCES.md"

# Ensure directories exist
mkdir -p "$PREVIEW_DIR" "$AVATAR_DIR" "$(dirname $PREFERENCES_FILE)"

# Get current date/time
DATETIME=$(date -u '+%Y-%m-%d %H:%M Asia/Shanghai')
echo "🌹 选妃时间 - Daily AI Girl Selection"
echo "======================================"
echo "当前时间：$DATETIME"
echo ""

# Step 1: Select 3 random images
echo "📸 正在从目录随机选取 3 张图片..."
SOURCE_DIR="/Volumes/info/sex/picture/AI girls"
TEMP_FILES=$(mktemp)
cd "$SOURCE_DIR"
ls -1 | grep -iE '\.(jpg|jpeg|png|webp)$' | sort | awk 'BEGIN{srand()} {arr[NR]=$0} END{for(i=1;i<=3;i++){idx=int(rand()*NR)+1; print arr[idx]; delete arr[idx]; for(j=idx;j<NR;j++)arr[j]=arr[j+1]; NR--}}' > "$TEMP_FILES"

# Step 2: Copy to preview directory
COUNTER=0
echo ""
echo "📁 已选图片："
while IFS= read -r filename; do
    COUNTER=$((COUNTER+1))
    FULL_PATH="$SOURCE_DIR/$filename"
    
    # Copy to preview directory
    EXT="${filename##*.}"
    cp "$FULL_PATH" "$PREVIEW_DIR/preview${COUNTER}.$EXT"
    
    echo "  $COUNTER. $filename ✅"
done < "$TEMP_FILES"
rm -f "$TEMP_FILES"

# Step 3: Create HTML preview page
echo ""
echo "📄 正在生成预览页面..."

# Generate HTML
cat > "$PREVIEW_DIR/selection-preview.html" << 'HTMLEOF'
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>🌹 选妃时间 - AI Girl Selection</title>
    <style>
        body { 
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
            min-height: 100vh;
            padding: 40px;
            margin: 0;
        }
        .container { 
            max-width: 1400px; 
            margin: 0 auto;
            background: rgba(255,255,255,0.95);
            border-radius: 20px;
            padding: 40px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
        }
        h1 { color: #667eea; text-align: center; font-size: 2.8em; margin-bottom: 10px; }
        h2 { color: #333; text-align: center; font-size: 1.2em; margin-bottom: 40px; font-weight: normal; }
        .gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 40px; margin-top: 40px; }
        .card { 
            background: white; 
            border-radius: 16px; 
            padding: 25px; 
            box-shadow: 0 8px 24px rgba(0,0,0,0.12); 
            text-align: center;
            transition: all 0.3s ease;
            border: 2px solid transparent;
        }
        .card:hover { 
            transform: translateY(-8px);
            box-shadow: 0 16px 40px rgba(0,0,0,0.2);
            border-color: #667eea;
        }
        .card img { 
            max-width: 100%; 
            max-height: 500px;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            object-fit: contain;
        }
        .card-title { font-size: 1.6em; font-weight: bold; color: #333; margin-bottom: 15px; }
        .card-desc { color: #666; margin-top: 10px; font-size: 0.9em; }
        .instruction { text-align: center; padding: 30px; margin-top: 40px; background: #f8f9fa; border-radius: 12px; }
        .instruction strong { color: #667eea; font-size: 1.3em; }
    </style>
</head>
<body>
    <div class="container">
        <h1>🌹 选妃时间</h1>
        <h2>Daily AI Girl Portrait Selection - $(date -u '+%Y-%m-%d %H:%M Asia/Shanghai')</h2>
        <div class="gallery">
HTMLEOF

# Add cards
for i in 1 2 3; do
    PREVIEW_FILE="$PREVIEW_DIR/preview${i}.*"
    PREVIEW_FILE=$(ls $PREVIEW_FILE 2>/dev/null | head -1)
    if [ -f "$PREVIEW_FILE" ]; then
        cat >> "$PREVIEW_DIR/selection-preview.html" << EOF
            <div class="card">
                <div class="card-title">👉 候选 $i 👈</div>
                <img src="$PREVIEW_FILE" alt="候选者 $i">
                <div class="card-desc">Filename: $(basename "$PREVIEW_FILE")</div>
            </div>
EOF
    fi
done

cat >> "$PREVIEW_DIR/selection-preview.html" << 'HTMLEOF'
        </div>
        <div class="instruction">
            <strong>请告诉我你的选择！</strong><br>
            说 <strong>"选 1"</strong> / <strong>"选 2"</strong> / <strong>"选 3"</strong><br>
            或 <strong>"第一个"</strong> / <strong>"第二个"</strong> / <strong>"第三个"</strong><br>
            或 <strong>直接说文件名</strong>
        </div>
    </div>
</body>
</html>
HTMLEOF

# Step 4: Open in browser
open "$PREVIEW_DIR/selection-preview.html"

# Step 5: Display summary
echo ""
echo "✅ 预览页面已创建：$PREVIEW_DIR/selection-preview.html"
echo "✅ 图片已复制到预览目录"
echo "✅ 页面已在浏览器中打开"
echo ""
echo "========================================="
echo "👉 请在聊天中告诉我你的选择："
echo "   说 \"选 1\" / \"选 2\" / \"选 3\""
echo "   或 \"第一个\" / \"第二个\" / \"第三个\""
echo "   或 直接说文件名"
echo "========================================="


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