Spaces:
Sleeping
Sleeping
Update main.py
Browse files57 unmodified lines585960616263646566676869707172737475767778798081828384858657 unmodified linesglobal working_statusif event.type != "message" or event.message.type != "text":out = "Gemini: [No response or the response does not contain text]"if event.message.text == "再見":working_status = Trueline_bot_api.reply_message(event.reply_token,TextSendMessage(text="Bye!"))returnmessages = []if working_status:message = event.message.textmessages.append({"role": "user","parts": [message],})response = model.generate_content(messages)out = response.parts[0].text# Check if response is validif not response.parts or not response.parts[0].text:out = "Gemini: [No response or the response does not contain text]"line_bot_api.reply_message(event.reply_token,TextSendMessage(text=out))57 unmodified lines585960616263646566676869707172737475767778798081828384858687888957 unmodified linesglobal working_statusif event.type != "message" or event.message.type != "text":TextSendMessage(text="Gemini: [No response or the response does not contain text]")elif event.message.text == "再見":working_status = Trueline_bot_api.reply_message(event.reply_token,TextSendMessage(text="Bye!"))returnelif working_status:try:messages = []message = event.message.textmessages.append({"role": "user","parts": [message],})response = model.generate_content(messages)out = response.parts[0].text# Check if response is validif not response.parts or not response.parts[0].text:out = "Gemini: [No response or the response does not contain text]"except:out = "Gemini: [No response or the response does not contain text]"line_bot_api.reply_message(event.reply_token,TextSendMessage(text=out))
main.py+20-17