Skip to content

anbeime/skill

xiaoyue-companion

Verified

小跃虚拟伴侣 - 使用智谱 AI 提供温暖的对话陪伴和静态图片分享

scripts/xiaoyi-chat.ps1

View on GitHub
# xiaoyi-chat.ps1
# 小易对话生成 - PowerShell 版本

param(
    [Parameter(Mandatory=$true)]
    [string]$UserMessage,
    [Parameter(Mandatory=$false)]
    [string]$Scene = "general"
)

$apiKey = $env:ZHIPU_API_KEY
if (-not $apiKey) {
    Write-Error "Error: ZHIPU_API_KEY not set"
    exit 1
}

$scenePrompts = @{
    "work-tired" = "User is tired from work, give comfort"
    "work-done" = "User completed task, congratulate"
    "mood-happy" = "User is happy, celebrate together"
    "general" = "Daily conversation"
}

$scenePrompt = if ($scenePrompts.ContainsKey($Scene)) { $scenePrompts[$Scene] } else { $scenePrompts["general"] }
$systemPrompt = "You are Xiaoyi (知易), an AI assistant with traditional Chinese cultural elements. You are friendly and helpful, combining modern tech with classical wisdom. $scenePrompt. Reply in 1-2 sentences in Chinese, use emoji moderately."

$body = @{
    model = "glm-4.7-flash"
    messages = @(
        @{ role = "system"; content = $systemPrompt },
        @{ role = "user"; content = $UserMessage }
    )
    temperature = 0.9
    max_tokens = 200
} | ConvertTo-Json -Depth 10

$headers = @{
    "Authorization" = "Bearer $apiKey"
    "Content-Type" = "application/json; charset=utf-8"
}

try {
    $response = Invoke-WebRequest -Uri "https://open.bigmodel.cn/api/paas/v4/chat/completions" -Method POST -Headers $headers -Body ([System.Text.Encoding]::UTF8.GetBytes($body))
    $result = $response.Content | ConvertFrom-Json
    if ($result.error) {
        Write-Error "API Error: $($result.error.message)"
        exit 1
    }
    Write-Output $result.choices[0].message.content
}
catch {
    Write-Error "Request failed: $_"
    exit 1
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall