Skip to content

Commit 891ddfb

Browse files
authored
optimize ai gateway script (#127)
1 parent 9cfd03a commit 891ddfb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

all-in-one/get-ai-gateway.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ resetEnv() {
136136
LLM_ENVS=()
137137
}
138138

139+
# Configuration wizard
139140
runConfigWizard() {
140141
echo "Provide a key for each LLM provider you want to enable, then press Enter."
141142
echo "If no key is provided and Enter is pressed, configuration for that provider will be skipped."
@@ -185,15 +186,14 @@ runConfigWizard() {
185186
i+=1
186187
echo "${i}. ${mark}${providerName}"
187188
done
188-
read -r -p "Please choose an LLM service provider to configure (1~$i, 0 to break): " selectedIndex
189+
read -r -p "Please choose an LLM service provider to configure (1~$i, press Enter alone to break): " selectedIndex
189190

190191
case $selectedIndex in
191-
'' | *[!0-9]*) ;;
192+
'') break ;; # Breaks the loop if the input is an empty string
193+
*[!0-9]*) ;; # Handles invalid input where characters are non-numeric
192194
*)
193195
selectedIndex=$((selectedIndex))
194-
if [ $selectedIndex -eq 0 ]; then
195-
break
196-
elif [ $selectedIndex -gt $i ]; then
196+
if [ $selectedIndex -gt $i ]; then
197197
echo "Incorrect option number."
198198
else
199199
local provider=${providers[$selectedIndex - 1]}

0 commit comments

Comments
 (0)