# shellcheck shell=dash
# this is a moduel to honor x-bash/chat module

___x_cmd_llmf_chat(){
    local X_help_cmd='x help -m llmf chat'; help:arg-null:parse
    local op="$1";
    case "$op" in
        request|exec)
            shift; ___x_cmd_llmf_chat_"$op" "$@" ;;
        --def-model_)
            shift; ___x_cmd_llmf_model_default___get_ "$@" ;;
        *)  N=llmf M="Not support such option '$op'" log:ret:64
    esac
}

___x_cmd_llmf_chat_request(){
    local X_help_cmd='x help -m llmf chat request'; help:arg:parse
    ___x_cmd chat --exec --provider llmf "$@"
}

___x_cmd_llmf_chat_exec(){
    local cur_endpoint="";
    ___x_cmd_llmf_cur cur_endpoint:=endpoint 2>/dev/null

    ___X_CMD_OPENAI_CHAT_ACTUAL_PROVIDER='llmf'   \
    ___X_CMD_OPENAI_CHAT_ACTUAL_PROVIDER_NAME='llamafile'  \
    ___X_CMD_OPENAI_CHAT_ACTUAL_ENDPOINT="${cur_endpoint:-$___X_CMD_LLMF_DEFAULT_ENDPOINT}"    \
    ___x_cmd openai chat exec "$@"
}
