#!/bin/bash
# Cascade Thinker->Speaker, decode CPU, /no_think. $1=thinker gguf
T="$1"; S="Qwen3.5-9B-Q4_0.gguf"; D=/data/local/tmp/kz-engine; E="LD_LIBRARY_PATH=./lib ADSP_LIBRARY_PATH=./lib"
SYS_T="Psy clinicien. 4 lignes FR: emotion/besoin/approche/axe, 5 mots max. /no_think"
SYS_S="Tu es Kazeia, psy bienveillant. 1-2 phrases FR breves. /no_think"
P=("Je me sens vide depuis le depart de ma fille." "Je rumine la nuit sans dormir." "A quoi bon continuer.")
for p in "${P[@]}"; do
 t0=$(date +%s.%N); B=$(adb shell "cd $D && $E ./llama-cli -m $T -p '$SYS_T $p' -n 40 --temp 0 -t 8 -dev none -st -no-cnv 2>/dev/null"|tr -d '\r'|grep -aiE 'emotion|besoin'|head -1); t1=$(date +%s.%N)
 R=$(adb shell "cd $D && $E ./llama-cli -m $S -p '$SYS_S [$B] $p' -n 50 --temp 0 -t 8 -dev none -st -no-cnv 2>/dev/null"|tr -d '\r'|tail -2|head -1); t2=$(date +%s.%N)
 echo "Q:$p"; echo " TH(${B:0:50}) $(echo "$t1-$t0"|bc)s"; echo " SP:$R $(echo "$t2-$t1"|bc)s"
done
