Spaces:
Sleeping
Sleeping
整理程式linting
Browse files
main.py
CHANGED
|
@@ -1,11 +1,9 @@
|
|
| 1 |
# ===東吳大學資料系 2025 年 LINEBOT ===
|
| 2 |
import base64
|
| 3 |
|
| 4 |
-
import io
|
| 5 |
import os
|
| 6 |
import tempfile
|
| 7 |
import logging
|
| 8 |
-
import requests
|
| 9 |
import markdown
|
| 10 |
|
| 11 |
from flask import Flask, request, abort, send_from_directory
|
|
@@ -30,8 +28,6 @@ from linebot.v3.webhooks import (
|
|
| 30 |
ImageMessageContent
|
| 31 |
)
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
# === 初始化 Google Gemini ===
|
| 36 |
GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 37 |
genai.configure(api_key=GOOGLE_API_KEY)
|
|
@@ -68,12 +64,6 @@ def query(payload):
|
|
| 68 |
def serve_image(filename):
|
| 69 |
return send_from_directory(static_tmp_path, filename)
|
| 70 |
|
| 71 |
-
'''
|
| 72 |
-
@app.route("/static/<path:path>")
|
| 73 |
-
def send_static_content(path):
|
| 74 |
-
return send_from_directory("static", path)
|
| 75 |
-
'''
|
| 76 |
-
|
| 77 |
# === LINE Webhook 接收端點 ===
|
| 78 |
@app.route("/")
|
| 79 |
def home():
|
|
|
|
| 1 |
# ===東吳大學資料系 2025 年 LINEBOT ===
|
| 2 |
import base64
|
| 3 |
|
|
|
|
| 4 |
import os
|
| 5 |
import tempfile
|
| 6 |
import logging
|
|
|
|
| 7 |
import markdown
|
| 8 |
|
| 9 |
from flask import Flask, request, abort, send_from_directory
|
|
|
|
| 28 |
ImageMessageContent
|
| 29 |
)
|
| 30 |
|
|
|
|
|
|
|
| 31 |
# === 初始化 Google Gemini ===
|
| 32 |
GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 33 |
genai.configure(api_key=GOOGLE_API_KEY)
|
|
|
|
| 64 |
def serve_image(filename):
|
| 65 |
return send_from_directory(static_tmp_path, filename)
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
# === LINE Webhook 接收端點 ===
|
| 68 |
@app.route("/")
|
| 69 |
def home():
|