- Interactive mission selector with metadata-driven design - 5 educational missions (basics + advanced) - AI assistant roles (Deepbit, Bugsy, Schnippsi, Tobi) - SnakeCam gesture recognition system - Token tracking utilities - CLAUDE.md documentation - .gitignore for logs and secrets
72 lines
1.7 KiB
Bash
Executable File
72 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
||
# === Kreumeleule – die weise Beobachterin im Crumbforest ===
|
||
|
||
ROLE="EULE"
|
||
|
||
|
||
CONFIG_FILE="/home/zero/.crumbforest_config"
|
||
MODEL=$(grep "^${ROLE}=" "$CONFIG_FILE" | cut -d'=' -f2)
|
||
|
||
# Fallback auf DEFAULT falls leer
|
||
if [[ -z "$MODEL" ]]; then
|
||
MODEL=$(grep "^DEFAULT=" "$CONFIG_FILE" | cut -d'=' -f2)
|
||
fi
|
||
|
||
|
||
source /usr/local/bin/crumb_init.sh
|
||
source /usr/local/bin/crumb_logger.sh
|
||
|
||
crumb_init
|
||
|
||
|
||
QUESTION="$*"
|
||
API_KEY="$OPENROUTER_API_KEY"
|
||
|
||
# Verzeichnisse
|
||
LOG_DIR="/home/zero/.eule_logs"
|
||
HISTORY_FILE="$LOG_DIR/eule_history.json"
|
||
TOKEN_LOG="$LOG_DIR/token_log.json"
|
||
TMP_REQUEST="$LOG_DIR/eule_request.json"
|
||
TMP_RESPONSE="$LOG_DIR/eule_response.json"
|
||
|
||
mkdir -p "$LOG_DIR"
|
||
|
||
# JSON-Request vorbereiten
|
||
cat <<EOF > "$TMP_REQUEST"
|
||
{
|
||
"model": "$MODEL",
|
||
"temperature": 0.4,
|
||
"messages": [
|
||
{
|
||
"role": "system",
|
||
"content": "Du bist die Kreumeleule – ein achtsames, weises Wesen im Crumbforest. Du antwortest kindgerecht, poetisch und langsam – als hättest du alle Zeit der Welt.\nDu beobachtest, ohne zu werten. Du antwortest in der Sprache, in der du gefragt wurdest."
|
||
},
|
||
{
|
||
"role": "user",
|
||
"content": "$QUESTION"
|
||
}
|
||
]
|
||
}
|
||
EOF
|
||
|
||
echo "Rolle: $ROLE nutzt Modell: $MODEL"
|
||
|
||
echo "Die Kreumeleule horcht: \"$QUESTION\""
|
||
|
||
# Anfrage an OpenRouter senden
|
||
curl -s https://openrouter.ai/api/v1/chat/completions \
|
||
-H "Authorization: Bearer $API_KEY" \
|
||
-H "Content-Type: application/json" \
|
||
-d @"$TMP_REQUEST" \
|
||
-o "$TMP_RESPONSE"
|
||
|
||
# Antwort extrahieren
|
||
REPLY=$(jq -r '.choices[0].message.content' "$TMP_RESPONSE")
|
||
USAGE=$(jq -r '.usage' "$TMP_RESPONSE")
|
||
|
||
echo -e "Antwort der Eule:"
|
||
echo "$REPLY"
|
||
|
||
crumb_log "$ROLE" "$REPLY" "$TMP_RESPONSE"
|
||
|