Fish Shell Integration¶
To make interacting with the STT (Speech-to-Text) CLI easier, you can add a shortcut function to your Fish configuration. This allows you to simply type s "your question" in the terminal.
Setup Instructions¶
Fish shell stores functions as individual files. The recommended approach is to create a dedicated function file.
Create the function file (the directory will be created automatically if it does not exist):
mkdir -p ~/.config/fish/functions nano ~/.config/fish/functions/s.fish
Paste the following block into the file:
please newest updates in zsh - verson
# --- STT Project Path Resolution ---
function s --description "STT CLI shortcut"
if test (count $argv) -eq 0
echo "question <your question>"
return 1
end
update_github_ip
set TEMP_FILE (mktemp)
set SHORT_TIMEOUT_SECONDS 2
set LONG_TIMEOUT_SECONDS 70
# Path shortcuts
set PY_EXEC "$SL5NET_AURA_PROJECT_ROOT/.venv/bin/python3"
set CLI_SCRIPT "$SL5NET_AURA_PROJECT_ROOT/scripts/py/cli_client.py"
# --- 1. try
timeout $SHORT_TIMEOUT_SECONDS \
"$PY_EXEC" -u "$CLI_SCRIPT" $argv \
--lang "de-DE" --unmasked < /dev/null > "$TEMP_FILE" 2>&1
set EXIT_CODE $status
set OUTPUT (cat "$TEMP_FILE")
rm "$TEMP_FILE"
if echo "$OUTPUT" | grep -q "Verbindungsfehler"; or not pgrep -f "streamlit-chat.py" > /dev/null
echo "Service-Check: Backend oder Frontend fehlt. Starte neu..."
start_service
echo '++++++++++++++++++++++++++++++++++++++++++++++++++'
set KIWIX_SCRIPT "$SL5NET_AURA_PROJECT_ROOT/config/maps/plugins/standard_actions/wikipedia_local/de-DE/kiwix-docker-start-if-not-running.sh"
if test -f "$KIWIX_SCRIPT"
bash "$KIWIX_SCRIPT"
end
echo '++++++++++++++++++++++++++++++++++++++++++++++++++'
echo "BITTE ERNEUT EINGEBEN: s $argv"
return 1
# 2. Timeout (124) OR success (0)
else if test $EXIT_CODE -eq 124; or test $EXIT_CODE -eq 0
if test $EXIT_CODE -eq 0
echo "$OUTPUT"
return 0
end
echo "answer > $SHORT_TIMEOUT_SECONDS sec. set Timeout= $LONG_TIMEOUT_SECONDS s..."
set TEMP_FILE_2 (mktemp)
timeout $LONG_TIMEOUT_SECONDS \
"$PY_EXEC" -u "$CLI_SCRIPT" $argv \
--lang "de-DE" --unmasked < /dev/null > "$TEMP_FILE_2" 2>&1
set EXIT_CODE_2 $status
set OUTPUT_2 (cat "$TEMP_FILE_2")
rm "$TEMP_FILE_2"
echo "$OUTPUT_2"
if test $EXIT_CODE_2 -ne 0
echo "WARNUNG: Timeout > $LONG_TIMEOUT_SECONDS Sec. "
end
return 0
else
echo "ERROR"
echo "$OUTPUT"
return $EXIT_CODE
end
end
The function is available immediately in all new Fish sessions. To load it in the current session without opening a new terminal:
source ~/.config/fish/functions/s.fish
Fish-Specific Notes¶
Fish uses
set VAR valueinstead ofVAR=valuefor variable assignment.Conditions use
testandendblocks instead of[ ]andfi.$argvreplaces$*/$@for argument passing.$statusreplaces$?for exit codes.or/andreplace||/&&in conditional expressions.Fish does not use
local— all variables inside functions are local by default.
Features¶
Dynamic Paths: Automatically finds the project root via the
/tmpmarker file.Auto-Restart: If the backend is down, it attempts to run
start_serviceand local Wikipedia services.Smart Timeouts: Tries a quick 2-second response first, then falls back to a 70-second deep processing mode.