From de7373210cc09c94b30de50eb264493ec9b5595a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D1=82=D0=B0=D0=BB=D0=B8=D0=B9=20=D0=9D=D0=B8?= =?UTF-8?q?=D0=BA=D0=B8=D1=82=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Wed, 3 Jun 2026 10:05:45 +0700 Subject: [PATCH] fix(ai-kimi): add source fallback, simplify reauth, check claude presence - source helpers with 2>/dev/null || true and quoted /home/nikitenko path - remove redundant reauth flag and extra prompt - check that claude is installed before exec - apply same source fix to ai-deepseek for consistency --- ai-setup.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ai-setup.sh b/ai-setup.sh index 9a383eb..863c55f 100755 --- a/ai-setup.sh +++ b/ai-setup.sh @@ -479,7 +479,7 @@ chmod +x "$BIN_DIR/ai-gpt" # === ai-deepseek === cat > "$BIN_DIR/ai-deepseek" << 'DEEPSEEKEOF' #!/usr/bin/env bash -source ~/.local/bin/ai-api-helpers.sh +source "$HOME/.local/bin/ai-api-helpers.sh" 2>/dev/null || true key_file="$HOME/.config/ai-setup/deepseek_key" api_key="" @@ -550,11 +550,10 @@ chmod +x "$BIN_DIR/ai-deepseek" cat > "$BIN_DIR/ai-kimi" << 'KIMIEOF' #!/usr/bin/env bash # ai-kimi - запуск Claude Code через официальный Kimi Code API -source ~/.local/bin/ai-api-helpers.sh +source "$HOME/.local/bin/ai-api-helpers.sh" 2>/dev/null || true key_file="$HOME/.config/ai-setup/kimi_key" api_key="" -reauth=0 [ -f "$key_file" ] && api_key=$(cat "$key_file") @@ -566,7 +565,6 @@ if [ -n "$api_key" ]; then if [ $ret -eq 401 ]; then rm -f "$key_file" api_key="" - reauth=1 elif [ $ret -eq 429 ]; then echo -n "Продолжить всё равно? (запросы могут не проходить) [y/N] " read -r _ans; case "${_ans:-N}" in [Yy]*) ;; *) exit 1 ;; esac @@ -575,11 +573,6 @@ if [ -n "$api_key" ]; then fi fi -if [ -z "$api_key" ] && [ "$reauth" -eq 1 ]; then - echo -n "Хотите ввести новый Kimi ключ? [Y/n] " - read -r _ans; case "${_ans:-Y}" in [Yy]*) ;; *) exit 1 ;; esac -fi - if [ -z "$api_key" ]; then echo "Получить ключ: https://www.kimi.com/code" read -r -p "Введите ваш Kimi API ключ: " api_key @@ -604,6 +597,12 @@ if [ -z "$api_key" ]; then fi fi +if ! command -v claude &>/dev/null; then + echo "Ошибка: Claude Code не найден. Установите через npm:" + echo " npm install -g @anthropic-ai/claude-code" + exit 1 +fi + SYS_PROMPT=$(_build_ai_sys_prompt) ANTHROPIC_BASE_URL=https://api.kimi.com/coding \ ANTHROPIC_AUTH_TOKEN="$api_key" \