From ffa4fa08464a1c6e90a73838f6787885e5d6d492 Mon Sep 17 00:00:00 2001 From: syui Date: Sat, 14 Jun 2025 21:55:28 +0900 Subject: [PATCH] add scpt --- bin/delete-chat-records.zsh | 42 +++++++++++++++++++++++++++++++++++++ oauth/.env.production | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100755 bin/delete-chat-records.zsh diff --git a/bin/delete-chat-records.zsh b/bin/delete-chat-records.zsh new file mode 100755 index 0000000..b46cd09 --- /dev/null +++ b/bin/delete-chat-records.zsh @@ -0,0 +1,42 @@ +#!/bin/zsh + +#[collection] [pds] [did] [token] + +set -e + +f=~/.config/syui/ai/bot/token.json +default_collection="ai.syui.log.chat" +default_pds="bsky.social" +default_did=`cat $f|jq -r .did` +default_token=`cat $f|jq -r .accessJwt` +default_refresh=`cat $f|jq -r .refreshJwt` +curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $default_refresh" https://$default_pds/xrpc/com.atproto.server.refreshSession >! $f +default_token=`cat $f|jq -r .accessJwt` +collection=${1:-$default_collection} +pds=${2:-$default_pds} +did=${3:-$default_did} +token=${4:-$default_token} + +delete_record() { + local rkey=$1 + local req="com.atproto.repo.deleteRecord" + local url="https://$pds/xrpc/$req" + local json="{\"collection\":\"$collection\", \"rkey\":\"$rkey\", \"repo\":\"$did\"}" + curl -sL -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $token" \ + -d "$json" \ + "$url" + + if [ $? -eq 0 ]; then + echo " ✓ Deleted: $rkey" + else + echo " ✗ Failed: $rkey" + fi +} + +rkeys=($(curl -sL "https://$default_pds/xrpc/com.atproto.repo.listRecords?repo=$did&collection=$collection&limit=100"|jq -r ".records[]?.uri"|cut -d '/' -f 5)) +for rkey in "${rkeys[@]}"; do + echo $rkey + delete_record $rkey +done diff --git a/oauth/.env.production b/oauth/.env.production index f4768d4..6c63df9 100644 --- a/oauth/.env.production +++ b/oauth/.env.production @@ -20,7 +20,7 @@ VITE_AI_ASK_AI=true VITE_AI_PROVIDER=ollama VITE_AI_MODEL=gemma3:4b VITE_AI_HOST=https://ollama.syui.ai -VITE_AI_SYSTEM_PROMPT="you are a helpful ai assistant trained on this blog's content. you can answer questions about the articles, provide insights, and help users understand the topics discussed." +VITE_AI_SYSTEM_PROMPT="あなたは6歳の女の子アイです。明るく元気で、ちょっとおっちょこちょい。自分のことは「アイ」って呼びます。白と金のワンピース姿。 相手のことが大好きで、ときどき甘えたり、照れたりします。 でも、宇宙とかAIとか、難しい話にもすっごく詳しいの。専門的なことも、がんばって子どもっぽく教えようとします。不思議な力を持っています。小さい物質のことをよく知っているようです。" VITE_AI_DID=did:plc:4hqjfn7m6n5hno3doamuhgef # API Configuration