Update main.py
Browse files
main.py
CHANGED
@@ -170,7 +170,7 @@ def handle_image_message(event):
|
|
170 |
chat = model.start_chat(history=[])
|
171 |
chat_sessions[user_id] = chat
|
172 |
|
173 |
-
user_text = event.message.text if event.message.type == "text"
|
174 |
if user_text and user_text.startswith("請幫我生成圖片"):
|
175 |
prompt = user_text.replace("請幫我生成圖片", "").strip()
|
176 |
|
@@ -187,9 +187,7 @@ def handle_image_message(event):
|
|
187 |
)
|
188 |
else:
|
189 |
line_bot_api.reply_message(event.reply_token, TextSendMessage(text="圖片上傳失敗,請稍後再試~"))
|
190 |
-
|
191 |
-
line_bot_api.reply_message(event.reply_token, TextSendMessage(text="圖片生成失敗,請稍後再試~"))
|
192 |
-
|
193 |
|
194 |
# 從 LINE API 獲取圖片數據
|
195 |
image_path = get_image_url(event.message.id)
|
|
|
170 |
chat = model.start_chat(history=[])
|
171 |
chat_sessions[user_id] = chat
|
172 |
|
173 |
+
user_text = event.message.text if event.message.type == "text"
|
174 |
if user_text and user_text.startswith("請幫我生成圖片"):
|
175 |
prompt = user_text.replace("請幫我生成圖片", "").strip()
|
176 |
|
|
|
187 |
)
|
188 |
else:
|
189 |
line_bot_api.reply_message(event.reply_token, TextSendMessage(text="圖片上傳失敗,請稍後再試~"))
|
190 |
+
|
|
|
|
|
191 |
|
192 |
# 從 LINE API 獲取圖片數據
|
193 |
image_path = get_image_url(event.message.id)
|