reload_flag=""
if [[ -n "${DEBUG}" ]]; then
reload_flag="--reload"
fi
if [[ -n "${WORKER_COUNT}" ]]; then
workers=${WORKER_COUNT}
else
workers=2
fi
gunicorn --workers ${workers} \
--bind 0.0.0.0:8000 \
${reload_flag} main.wsgi
Писали такие конструкции чтобы проверить наличие флага и сформировать команду правильно?
На самом деле можно сделать тоже самое проще. Для этого используются операторы условной подстановки, доступные в оболочках семейства POSIX.
:- для установки значений по умолчанию
${WORKER_COUNT:-2}
Если переменная не объявлена, то будет дефолтное значение 2.
:+ подставляет указанный текст, если переменная не пуста
${DEBUG:+--reload}
Если что-то есть в переменной то распечатается текст после символа +, в противном случае - ничего. Удобно для опциональных флагов, как в нашем примере.
Итого наш скрипт может выглядеть так:
gunicorn --workers ${WORKER_COUNT:-2} \
--bind 0.0.0.0:8000 \
${DEBUG:+--reload} main.wsgi
Есть еще два оператора.
:= не только подставить дефолтное значение, но и присвоить его переменной, если она пуста
# никаких переменных еще нет
VAL1=${VAL2:=hello}
# теперь доступны обе
echo $VAL1 $VAL2
# hello hello
:? остановить выполнение с ошибкой, если переменной нет.
echo ${MISS:?is required}
bash: MISS: is required
Код выхода будет 1.
#tricks#linux
green flag: IRAS bot will never get annoyed at you for asking the same questions every tax season 😅 Got a tax question? Use the IRAS bot to get help any time you need. 😉
https://www.iras.gov.sg/digital-services/others/iras-bot
#chatbot#irassg
Air Canada Ordered to Honor Chatbot's Impromptu Refund Policy
Hello everybody! In a landmark decision, Air Canada has been directed by Canada's Civil Resolution Tribunal to uphold a refund policy cited by its customer service chatbot. The ruling sets a potential precedent for similar cases involving automated customer service platforms.
The saga began when Jake Moffatt sought bereavement fares following his grandmother's passing in November 2022. Engaging with Air Canada's chatbot, he was informed of a retroactive refund option for reduced bereavement rates. Despite Air Canada's insistence that the chatbot's actions were independent, the tribunal ruled in Moffatt's favor, deeming the airline accountable for the chatbot's representations.
This decision not only obligates Air Canada to refund Moffatt's fare but also underscores the significance of accuracy and accountability in automated customer interactions. As chatbots become increasingly prevalent in customer service, the ruling highlights the need for companies to ensure consistency and reliability in their AI-driven communications.
#AirCanada#Chatbot
🧠 Google Gemini endi eski suhbatlaringizni eslab qoladi! 💾
Endi Gemini istalgan suhbatni eslab qoladi va kerak bo‘lsa, eski suhbatlaringizga o‘zi murojaat qiladi!😱
🔹RAG tizimi ishlaydi – oldingi chatlaringizdan ma’lumotni topish va ulardan foydalanish imkoniyati!
🔹Mavzuga mos bo‘lsa, AI o‘zi eslab qoladi va sizga kerakli faktlarni taqdim etadi.
🔹Siz istalgan suhbatga murojaat qilishingiz mumkin, hatto u uzoq vaqt oldin bo‘lsa ham!
📌Bitta muhim narsa:
🛑Cheksiz xotirani faollashtirish uchunGemini Advanced obunasi kerak.
🛑Hozircha faqat Flash modeli bilan ishlaydi.
🔮OpenAI ham shunday funksiyani ishlab chiqayotganini aytgandi… Ko‘ramiz, kim birinchi bo‘ladi!🚀
#Gemini#AI#Google#Chatbot
Shhh! Close the curtain quickly!
We don't want the neighbors to see anything! 🤫👀💥
Chat and see more selfies:
📲(iOS)
📲(Android)
#stepsis#aigirlfriend#chatbot
All of your image creations, all in one place.
Introducing the new library for your ChatGPT image creations—rolling out now to all Free, Plus, and Pro users.
➖➖➖➖🔻
💎@Chatgpt_OfficialNews – Stay Updated! ⚡️
🧠 BOT: @Chatgpt_OfficialBOT
#️⃣#OpenAI#AI#GPT#ChatGPT#Chatbot
➖➖➖➖🔺