Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -100,7 +100,7 @@ def analyze_with_gemini(image_path, user_text):
|
|
| 100 |
response = chat.send_message([user_text, organ])
|
| 101 |
|
| 102 |
# 提取回應內容
|
| 103 |
-
return response.
|
| 104 |
|
| 105 |
except Exception as e:
|
| 106 |
return f"發生錯誤: {e}"
|
|
@@ -146,7 +146,6 @@ def handle_image_message(event):
|
|
| 146 |
|
| 147 |
else:
|
| 148 |
global working_status
|
| 149 |
-
|
| 150 |
# 檢查事件類型和訊息類型
|
| 151 |
if event.type != "message" or event.message.type != "text":
|
| 152 |
# 回覆錯誤訊息
|
|
@@ -169,7 +168,6 @@ def handle_image_message(event):
|
|
| 169 |
store_user_message(user_id, "text", prompt)
|
| 170 |
|
| 171 |
# 使用 Gemini 模型生成文字
|
| 172 |
-
chat = model.start_chat(history=history)
|
| 173 |
completion = chat.send_message(prompt)
|
| 174 |
# 檢查生成結果是否為空
|
| 175 |
if (completion.text != None):
|
|
|
|
| 100 |
response = chat.send_message([user_text, organ])
|
| 101 |
|
| 102 |
# 提取回應內容
|
| 103 |
+
return response.text
|
| 104 |
|
| 105 |
except Exception as e:
|
| 106 |
return f"發生錯誤: {e}"
|
|
|
|
| 146 |
|
| 147 |
else:
|
| 148 |
global working_status
|
|
|
|
| 149 |
# 檢查事件類型和訊息類型
|
| 150 |
if event.type != "message" or event.message.type != "text":
|
| 151 |
# 回覆錯誤訊息
|
|
|
|
| 168 |
store_user_message(user_id, "text", prompt)
|
| 169 |
|
| 170 |
# 使用 Gemini 模型生成文字
|
|
|
|
| 171 |
completion = chat.send_message(prompt)
|
| 172 |
# 檢查生成結果是否為空
|
| 173 |
if (completion.text != None):
|