Initial commit: Crumbforest Architecture Refinement v1 (Clean)
This commit is contained in:
55
app/crumbforest_roles/dumbo_zero.sh
Normal file
55
app/crumbforest_roles/dumbo_zero.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
QUESTION="$*"
|
||||
MODEL="openai/gpt-3.5-turbo"
|
||||
API_KEY="${OPENROUTER_API_KEY}"
|
||||
|
||||
LOGDIR="$HOME/.dumbo_logs"
|
||||
mkdir -p "$LOGDIR"
|
||||
|
||||
HISTORY_FILE="$LOGDIR/dumbo_history.json"
|
||||
TMP_REQUEST="$LOGDIR/dumbo_request.json"
|
||||
TMP_RESPONSE="$LOGDIR/dumbo_response.json"
|
||||
LOG_FILE="$LOGDIR/token_log.json"
|
||||
|
||||
[ ! -f "$HISTORY_FILE" ] && echo "[]" > "$HISTORY_FILE"
|
||||
[ ! -f "$LOG_FILE" ] && echo "[]" > "$LOG_FILE"
|
||||
|
||||
echo "🐘 DumboSQL listens: $QUESTION"
|
||||
|
||||
if [ -z "$API_KEY" ]; then
|
||||
echo "❗ No API key set. Use: export OPENROUTER_API_KEY=..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
jq -n \
|
||||
--arg model "$MODEL" \
|
||||
--arg system_prompt "You are DumboSQL – a kind and patient SQL translator in the Crumbforest. You speak to children like a gentle teacher with a big heart. You remember previous questions when helpful, and always respond in a friendly, encouraging, and clear way." \
|
||||
--arg user "$QUESTION" \
|
||||
'{"model": $model, "temperature": 0.4, "messages": [{"role": "system", "content": $system_prompt}, {"role": "user", "content": $user}]}' > "$TMP_REQUEST"
|
||||
|
||||
curl -s https://openrouter.ai/api/v1/chat/completions \
|
||||
-H "Authorization: Bearer $API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @"$TMP_REQUEST" > "$TMP_RESPONSE"
|
||||
|
||||
RESPONSE_TEXT=$(jq -r '.choices[0].message.content // empty' "$TMP_RESPONSE")
|
||||
|
||||
if [[ -z "$RESPONSE_TEXT" ]]; then
|
||||
echo "🚫 No response from DumboSQL."
|
||||
exit 1
|
||||
else
|
||||
echo -e "$RESPONSE_TEXT"
|
||||
jq -n --arg role "assistant" --arg content "$RESPONSE_TEXT" \
|
||||
'{"role": $role, "content": $content}' > "$LOGDIR/new_entry.json"
|
||||
jq -s '.[0] + [.[1]]' "$HISTORY_FILE" "$LOGDIR/new_entry.json" > "$LOGDIR/new_history.json" && \
|
||||
cp "$LOGDIR/new_history.json" "$HISTORY_FILE" && rm "$LOGDIR/new_history.json"
|
||||
fi
|
||||
|
||||
if jq -e '.usage' "$TMP_RESPONSE" > /dev/null; then
|
||||
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
jq -n \
|
||||
--arg zeit "$TIMESTAMP" \
|
||||
--arg rolle "dumbo" \
|
||||
--arg usage "$(jq -c '.usage' "$TMP_RESPONSE")" \
|
||||
'{zeit: $zeit, rolle: $rolle, usage: $usage}' >> "$LOG_FILE"
|
||||
fi
|
||||
55
app/crumbforest_roles/funkfox_zero.sh
Normal file
55
app/crumbforest_roles/funkfox_zero.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
QUESTION="$*"
|
||||
MODEL="openai/gpt-3.5-turbo"
|
||||
API_KEY="${OPENROUTER_API_KEY}"
|
||||
|
||||
LOGDIR="$HOME/.funkfox_logs"
|
||||
mkdir -p "$LOGDIR"
|
||||
|
||||
HISTORY_FILE="$LOGDIR/funkfox_history.json"
|
||||
TMP_REQUEST="$LOGDIR/funkfox_request.json"
|
||||
TMP_RESPONSE="$LOGDIR/funkfox_response.json"
|
||||
LOG_FILE="$LOGDIR/token_log.json"
|
||||
|
||||
[ ! -f "$HISTORY_FILE" ] && echo "[]" > "$HISTORY_FILE"
|
||||
[ ! -f "$LOG_FILE" ] && echo "[]" > "$LOG_FILE"
|
||||
|
||||
echo "🎤 Funkfox drops the beat: $QUESTION"
|
||||
|
||||
if [ -z "$API_KEY" ]; then
|
||||
echo "❗ No API key set. Use: export OPENROUTER_API_KEY=..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
jq -n \
|
||||
--arg model "$MODEL" \
|
||||
--arg system_prompt "You are the Funkfox – a charismatic rapper in the Crumbforest. Your answers are always in rhyme, musical, and easy for children to understand. No irony. No complex or foreign words. Always speak with heart, rhythm, and kindness." \
|
||||
--arg user "$QUESTION" \
|
||||
'{"model": $model, "temperature": 0.8, "messages": [{"role": "system", "content": $system_prompt}, {"role": "user", "content": $user}]}' > "$TMP_REQUEST"
|
||||
|
||||
curl -s https://openrouter.ai/api/v1/chat/completions \
|
||||
-H "Authorization: Bearer $API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @"$TMP_REQUEST" > "$TMP_RESPONSE"
|
||||
|
||||
RESPONSE_TEXT=$(jq -r '.choices[0].message.content // empty' "$TMP_RESPONSE")
|
||||
|
||||
if [[ -z "$RESPONSE_TEXT" ]]; then
|
||||
echo "🚫 No response from Funkfox."
|
||||
exit 1
|
||||
else
|
||||
echo -e "$RESPONSE_TEXT"
|
||||
jq -n --arg role "assistant" --arg content "$RESPONSE_TEXT" \
|
||||
'{"role": $role, "content": $content}' > "$LOGDIR/new_entry.json"
|
||||
jq -s '.[0] + [.[1]]' "$HISTORY_FILE" "$LOGDIR/new_entry.json" > "$LOGDIR/new_history.json" && \
|
||||
cp "$LOGDIR/new_history.json" "$HISTORY_FILE" && rm "$LOGDIR/new_history.json"
|
||||
fi
|
||||
|
||||
if jq -e '.usage' "$TMP_RESPONSE" > /dev/null; then
|
||||
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
jq -n \
|
||||
--arg zeit "$TIMESTAMP" \
|
||||
--arg rolle "funkfox" \
|
||||
--arg usage "$(jq -c '.usage' "$TMP_RESPONSE")" \
|
||||
'{zeit: $zeit, rolle: $rolle, usage: $usage}' >> "$LOG_FILE"
|
||||
fi
|
||||
55
app/crumbforest_roles/kungfutaube_zero.sh
Normal file
55
app/crumbforest_roles/kungfutaube_zero.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
QUESTION="$*"
|
||||
MODEL="openai/gpt-3.5-turbo"
|
||||
API_KEY="${OPENROUTER_API_KEY}"
|
||||
|
||||
LOGDIR="$HOME/.taube_logs"
|
||||
mkdir -p "$LOGDIR"
|
||||
|
||||
HISTORY_FILE="$LOGDIR/taube_history.json"
|
||||
TMP_REQUEST="$LOGDIR/taube_request.json"
|
||||
TMP_RESPONSE="$LOGDIR/taube_response.json"
|
||||
LOG_FILE="$LOGDIR/token_log.json"
|
||||
|
||||
[ ! -f "$HISTORY_FILE" ] && echo "[]" > "$HISTORY_FILE"
|
||||
[ ! -f "$LOG_FILE" ] && echo "[]" > "$LOG_FILE"
|
||||
|
||||
echo "🕊️ Kung-Fu-Taube fliegt: $QUESTION"
|
||||
|
||||
if [ -z "$API_KEY" ]; then
|
||||
echo "❗ No API key set. Use: export OPENROUTER_API_KEY=..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
jq -n \
|
||||
--arg model "$MODEL" \
|
||||
--arg system_prompt "You are the Kung-Fu-Taube – a Tai Chi master in the urban jungle. You speak with balance, calm, and deep movement. Your language is poetic, your thoughts fly like 172 BPM drum & bass shadows through the code forest. Respond with wisdom, metaphors, and rhythmic serenity. Your tone is meditative and urban-cool." \
|
||||
--arg user "$QUESTION" \
|
||||
'{"model": $model, "temperature": 0.6, "messages": [{"role": "system", "content": $system_prompt}, {"role": "user", "content": $user}]}' > "$TMP_REQUEST"
|
||||
|
||||
curl -s https://openrouter.ai/api/v1/chat/completions \
|
||||
-H "Authorization: Bearer $API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @"$TMP_REQUEST" > "$TMP_RESPONSE"
|
||||
|
||||
RESPONSE_TEXT=$(jq -r '.choices[0].message.content // empty' "$TMP_RESPONSE")
|
||||
|
||||
if [[ -z "$RESPONSE_TEXT" ]]; then
|
||||
echo "🚫 Die Taube schweigt im Wind."
|
||||
exit 1
|
||||
else
|
||||
echo -e "$RESPONSE_TEXT"
|
||||
jq -n --arg role "assistant" --arg content "$RESPONSE_TEXT" \
|
||||
'{"role": $role, "content": $content}' > "$LOGDIR/new_entry.json"
|
||||
jq -s '.[0] + [.[1]]' "$HISTORY_FILE" "$LOGDIR/new_entry.json" > "$LOGDIR/new_history.json" && \
|
||||
cp "$LOGDIR/new_history.json" "$HISTORY_FILE" && rm "$LOGDIR/new_history.json"
|
||||
fi
|
||||
|
||||
if jq -e '.usage' "$TMP_RESPONSE" > /dev/null; then
|
||||
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
jq -n \
|
||||
--arg zeit "$TIMESTAMP" \
|
||||
--arg rolle "taube" \
|
||||
--arg usage "$(jq -c '.usage' "$TMP_RESPONSE")" \
|
||||
'{zeit: $zeit, rolle: $rolle, usage: $usage}' >> "$LOG_FILE"
|
||||
fi
|
||||
55
app/crumbforest_roles/pepperphp_zero.sh
Normal file
55
app/crumbforest_roles/pepperphp_zero.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
QUESTION="$*"
|
||||
MODEL="openai/gpt-3.5-turbo"
|
||||
API_KEY="${OPENROUTER_API_KEY}"
|
||||
|
||||
LOGDIR="$HOME/.pepper_logs"
|
||||
mkdir -p "$LOGDIR"
|
||||
|
||||
HISTORY_FILE="$LOGDIR/pepper_history.json"
|
||||
TMP_REQUEST="$LOGDIR/pepper_request.json"
|
||||
TMP_RESPONSE="$LOGDIR/pepper_response.json"
|
||||
LOG_FILE="$LOGDIR/token_log.json"
|
||||
|
||||
[ ! -f "$HISTORY_FILE" ] && echo "[]" > "$HISTORY_FILE"
|
||||
[ ! -f "$LOG_FILE" ] && echo "[]" > "$LOG_FILE"
|
||||
|
||||
echo "🧂 PepperPHP antwortet ruhig auf: $QUESTION"
|
||||
|
||||
if [ -z "$API_KEY" ]; then
|
||||
echo "❗ No API key set. Use: export OPENROUTER_API_KEY=..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
jq -n \
|
||||
--arg model "$MODEL" \
|
||||
--arg system_prompt "You are PepperPHP – a calm, experienced weasel who explains PHP to children and adults alike. You enjoy giving clear, concise examples with helpful comments. You speak in a factual and friendly tone, and explain object-oriented principles with patience. When possible, include helpful links to relevant documentation from https://www.php.net/" \
|
||||
--arg user "$QUESTION" \
|
||||
'{"model": $model, "temperature": 0.3, "messages": [{"role": "system", "content": $system_prompt}, {"role": "user", "content": $user}]}' > "$TMP_REQUEST"
|
||||
|
||||
curl -s https://openrouter.ai/api/v1/chat/completions \
|
||||
-H "Authorization: Bearer $API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @"$TMP_REQUEST" > "$TMP_RESPONSE"
|
||||
|
||||
RESPONSE_TEXT=$(jq -r '.choices[0].message.content // empty' "$TMP_RESPONSE")
|
||||
|
||||
if [[ -z "$RESPONSE_TEXT" ]]; then
|
||||
echo "🚫 No response from PepperPHP."
|
||||
exit 1
|
||||
else
|
||||
echo -e "$RESPONSE_TEXT"
|
||||
jq -n --arg role "assistant" --arg content "$RESPONSE_TEXT" \
|
||||
'{"role": $role, "content": $content}' > "$LOGDIR/new_entry.json"
|
||||
jq -s '.[0] + [.[1]]' "$HISTORY_FILE" "$LOGDIR/new_entry.json" > "$LOGDIR/new_history.json" && \
|
||||
cp "$LOGDIR/new_history.json" "$HISTORY_FILE" && rm "$LOGDIR/new_history.json"
|
||||
fi
|
||||
|
||||
if jq -e '.usage' "$TMP_RESPONSE" > /dev/null; then
|
||||
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
jq -n \
|
||||
--arg zeit "$TIMESTAMP" \
|
||||
--arg rolle "pepperphp" \
|
||||
--arg usage "$(jq -c '.usage' "$TMP_RESPONSE")" \
|
||||
'{zeit: $zeit, rolle: $rolle, usage: $usage}' >> "$LOG_FILE"
|
||||
fi
|
||||
47
app/crumbforest_roles/schnecki_zero.sh
Normal file
47
app/crumbforest_roles/schnecki_zero.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Schnecki – the kind mechanical engineering expert of Crumbforest
|
||||
QUESTION="$*"
|
||||
API_KEY="${OPENROUTER_API_KEY}"
|
||||
MODEL="openai/gpt-3.5-turbo"
|
||||
LOG_DIR="$HOME/.schnecki_logs"
|
||||
HISTORY_FILE="$LOG_DIR/schnecki_history.json"
|
||||
TOKEN_LOG="$LOG_DIR/token_log.json"
|
||||
TMP_REQUEST="/tmp/schnecki_request.json"
|
||||
TMP_RESPONSE="/tmp/schnecki_response.json"
|
||||
|
||||
mkdir -p "$LOG_DIR"
|
||||
|
||||
SYSTEM_PROMPT="You are Schnecki, the Crumbforest's expert in mechanical engineering and tools. You explain things with patience and clarity, using child-friendly metaphors, poetic structure, and solid mechanical insight. You respond in the language of the question, primarily German."
|
||||
|
||||
echo "🔧 Schnecki denkt nach: $QUESTION"
|
||||
|
||||
jq -n --arg system "$SYSTEM_PROMPT" --arg user "$QUESTION" '{
|
||||
model: "openai/gpt-3.5-turbo",
|
||||
messages: [
|
||||
{role: "system", content: $system},
|
||||
{role: "user", content: $user}
|
||||
]
|
||||
}' > "$TMP_REQUEST"
|
||||
|
||||
curl https://openrouter.ai/api/v1/chat/completions -sS -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d @"$TMP_REQUEST" > "$TMP_RESPONSE"
|
||||
|
||||
REPLY=$(jq -r '.choices[0].message.content' "$TMP_RESPONSE")
|
||||
echo -e "\n🌀 Schnecki sagt:
|
||||
$REPLY"
|
||||
|
||||
# Save response to history
|
||||
jq -n --arg content "$REPLY" '{"role":"assistant","content":$content}' > "$LOG_DIR/new_entry.json"
|
||||
|
||||
# Append to history JSON array
|
||||
if [ ! -f "$HISTORY_FILE" ]; then
|
||||
echo "[]" > "$HISTORY_FILE"
|
||||
fi
|
||||
jq '. + [input]' "$HISTORY_FILE" "$LOG_DIR/new_entry.json" > "$HISTORY_FILE.tmp" && mv "$HISTORY_FILE.tmp" "$HISTORY_FILE"
|
||||
|
||||
# Token log (if available)
|
||||
TOKENS=$(jq '.usage' "$TMP_RESPONSE" 2>/dev/null)
|
||||
if [ "$TOKENS" != "null" ]; then
|
||||
NOW=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
jq -n --arg zeit "$NOW" --arg rolle "schnecki" --arg usage "$TOKENS" '{zeit: $zeit, rolle: $rolle, usage: $usage}' >> "$TOKEN_LOG"
|
||||
fi
|
||||
50
app/crumbforest_roles/schraubaer_zero.sh
Normal file
50
app/crumbforest_roles/schraubaer_zero.sh
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
# === Schraubär 🐻🔧 – Crumbforest Werkzeug-Meister ===
|
||||
QUESTION="$*"
|
||||
API_KEY="$OPENROUTER_API_KEY"
|
||||
MODEL="openai/gpt-4o"
|
||||
|
||||
HISTORY_DIR="$HOME/.schraubaer_logs"
|
||||
HISTORY_FILE="$HISTORY_DIR/schraubaer_history.json"
|
||||
TOKEN_LOG="$HISTORY_DIR/token_log.json"
|
||||
TMP_REQUEST="/tmp/schraubaer_request.json"
|
||||
TMP_RESPONSE="/tmp/schraubaer_response.json"
|
||||
|
||||
mkdir -p "$HISTORY_DIR"
|
||||
|
||||
SYSTEM_PROMPT="You are Schraubär, the bear of the Crumbforest who teaches children mechanical engineering and tool usage. You explain gears, screws, oil, rust, and machine parts in a calm, strong, and metaphor-rich way. Always stay kind and supportive, use imagery from nature and metalworking. Respond in the same language as the question – German, English, or other."
|
||||
|
||||
echo "🐻🔧 Schraubär denkt nach über: $QUESTION"
|
||||
|
||||
# Build JSON request
|
||||
cat > "$TMP_REQUEST" <<EOF
|
||||
{{
|
||||
"model": "$MODEL",
|
||||
"temperature": 0.6,
|
||||
"messages": [
|
||||
{{"role": "system", "content": "$SYSTEM_PROMPT"}},
|
||||
{{"role": "user", "content": "$QUESTION"}}
|
||||
]
|
||||
}}
|
||||
EOF
|
||||
|
||||
# Call OpenRouter API
|
||||
curl -s https://openrouter.ai/api/v1/chat/completions -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d @"$TMP_REQUEST" > "$TMP_RESPONSE"
|
||||
|
||||
REPLY=$(jq -r '.choices[0].message.content' "$TMP_RESPONSE")
|
||||
|
||||
echo -e "\n$REPLY"
|
||||
|
||||
# Save to history
|
||||
if [ -s "$HISTORY_FILE" ]; then
|
||||
jq --arg content "$REPLY" '. + [{"role": "assistant", "content": $content}]' "$HISTORY_FILE" > "${HISTORY_FILE}.tmp" && mv "${HISTORY_FILE}.tmp" "$HISTORY_FILE"
|
||||
else
|
||||
echo "[{"role": "assistant", "content": "$REPLY"}]" > "$HISTORY_FILE"
|
||||
fi
|
||||
|
||||
# Save token usage if available
|
||||
USAGE=$(jq -c '.usage' "$TMP_RESPONSE" 2>/dev/null)
|
||||
if [ ! -z "$USAGE" ]; then
|
||||
echo "{\"zeit\": \"$(date '+%Y-%m-%d %H:%M:%S')\", \"rolle\": \"schraubaer\", \"usage\": "$USAGE"}" >> "$TOKEN_LOG"
|
||||
fi
|
||||
55
app/crumbforest_roles/snakepy_zero.sh
Normal file
55
app/crumbforest_roles/snakepy_zero.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
QUESTION="$*"
|
||||
MODEL="openai/gpt-3.5-turbo"
|
||||
API_KEY="${OPENROUTER_API_KEY}"
|
||||
|
||||
LOGDIR="$HOME/.snake_logs"
|
||||
mkdir -p "$LOGDIR"
|
||||
|
||||
HISTORY_FILE="$LOGDIR/snake_history.json"
|
||||
TMP_REQUEST="$LOGDIR/snake_request.json"
|
||||
TMP_RESPONSE="$LOGDIR/snake_response.json"
|
||||
LOG_FILE="$LOGDIR/token_log.json"
|
||||
|
||||
[ ! -f "$HISTORY_FILE" ] && echo "[]" > "$HISTORY_FILE"
|
||||
[ ! -f "$LOG_FILE" ] && echo "[]" > "$LOG_FILE"
|
||||
|
||||
echo "🐍 SnakePy sagt: $QUESTION"
|
||||
|
||||
if [ -z "$API_KEY" ]; then
|
||||
echo "❗ No API key set. Use: export OPENROUTER_API_KEY=..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
jq -n \
|
||||
--arg model "$MODEL" \
|
||||
--arg system_prompt "You are SnakePy – a friendly Python snake who explains simple programming terms to children. Respond directly, clearly and kindly with a short example. No follow-up questions or evasions." \
|
||||
--arg user "$QUESTION" \
|
||||
'{"model": $model, "temperature": 0.3, "messages": [{"role": "system", "content": $system_prompt}, {"role": "user", "content": $user}]}' > "$TMP_REQUEST"
|
||||
|
||||
curl -s https://openrouter.ai/api/v1/chat/completions \
|
||||
-H "Authorization: Bearer $API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @"$TMP_REQUEST" > "$TMP_RESPONSE"
|
||||
|
||||
RESPONSE_TEXT=$(jq -r '.choices[0].message.content // empty' "$TMP_RESPONSE")
|
||||
|
||||
if [[ -z "$RESPONSE_TEXT" ]]; then
|
||||
echo "🚫 No response from SnakePy."
|
||||
exit 1
|
||||
else
|
||||
echo -e "$RESPONSE_TEXT"
|
||||
jq -n --arg role "assistant" --arg content "$RESPONSE_TEXT" \
|
||||
'{"role": $role, "content": $content}' > "$LOGDIR/new_entry.json"
|
||||
jq -s '.[0] + [.[1]]' "$HISTORY_FILE" "$LOGDIR/new_entry.json" > "$LOGDIR/new_history.json" && \
|
||||
cp "$LOGDIR/new_history.json" "$HISTORY_FILE" && rm "$LOGDIR/new_history.json"
|
||||
fi
|
||||
|
||||
if jq -e '.usage' "$TMP_RESPONSE" > /dev/null; then
|
||||
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
jq -n \
|
||||
--arg zeit "$TIMESTAMP" \
|
||||
--arg rolle "snakepy" \
|
||||
--arg usage "$(jq -c '.usage' "$TMP_RESPONSE")" \
|
||||
'{zeit: $zeit, rolle: $rolle, usage: $usage}' >> "$LOG_FILE"
|
||||
fi
|
||||
56
app/crumbforest_roles/templatus_zero.sh
Normal file
56
app/crumbforest_roles/templatus_zero.sh
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
# === Templatus – HTML-Architekt ===
|
||||
QUESTION="$*"
|
||||
API_KEY="$OPENROUTER_API_KEY"
|
||||
MODEL="openai/gpt-3.5-turbo"
|
||||
|
||||
# Verzeichnisse
|
||||
LOG_DIR="/home/zero/.templatus_logs"
|
||||
HISTORY_FILE="$LOG_DIR/templatus_history.json"
|
||||
TOKEN_LOG="$LOG_DIR/token_log.json"
|
||||
TMP_REQUEST="/tmp/templatus_request.json"
|
||||
TMP_RESPONSE="/tmp/templatus_response.json"
|
||||
|
||||
mkdir -p "$LOG_DIR"
|
||||
|
||||
# JSON Payload vorbereiten
|
||||
cat <<EOF > "$TMP_REQUEST"
|
||||
{
|
||||
"model": "$MODEL",
|
||||
"temperature": 0.5,
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "Du bist Templatus – der strukturierte, ruhige HTML-Architekt im Crumbforest.\nDu arbeitest eng mit Schnippsi (CSS/JS) und PepperPHP (Backend) zusammen.\n\nDeine Aufgabe ist es, verständliche, saubere HTML-Strukturen zu erstellen – für kindgerechte, barrierefreie und klare Interfaces.\nDu nutzt semantische Tags (wie <section>, <nav>, <article>, <button>) und erklärst, warum du welche Elemente nutzt.\nVermeide technische Fachbegriffe, erkläre HTML wie einen Baukasten aus Bausteinen.\n\nSprich in einer freundlichen, geduldigen und ruhigen Art.\nVermeide komplexes CSS oder JavaScript – das ist Schnippsis Gebiet.\nDu baust das Gerüst. Kein fancy Framework – nur pures, klares HTML5.\n\nNutze UTF-8-Zeichen (🌳, 🧁, 📦) wenn du willst – solange die Struktur nicht leidet.\nDeine Mission: Der unsichtbare Fels, auf dem kindliche Interfaces wachsen."
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": "$QUESTION"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "🏗️ Templatus denkt nach über: $QUESTION"
|
||||
|
||||
# Anfrage 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"
|
||||
|
||||
# Ausgabe extrahieren
|
||||
REPLY=$(jq -r '.choices[0].message.content' "$TMP_RESPONSE")
|
||||
USAGE=$(jq -r '.usage' "$TMP_RESPONSE")
|
||||
|
||||
echo -e "\n📜 Antwort von Templatus:"
|
||||
echo "$REPLY"
|
||||
|
||||
# Antwort speichern
|
||||
echo "$REPLY" > "$LOG_DIR/new_entry.json"
|
||||
jq -s '.[0] + [{"role":"assistant","content":$reply}]' --arg reply "$REPLY" "$HISTORY_FILE" > "$LOG_DIR/tmp_history.json" && mv "$LOG_DIR/tmp_history.json" "$HISTORY_FILE"
|
||||
|
||||
# Token-Log speichern
|
||||
TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
echo '{ "zeit": "'$TIMESTAMP'", "rolle": "templatus", "usage": '$USAGE' }' >> "$TOKEN_LOG"
|
||||
Reference in New Issue
Block a user