Spaces:
Running
Running
sunheycho
commited on
Commit
Β·
227b8f4
1
Parent(s):
0a08210
Debug: Add startup import debugging to identify exact failure point
Browse files- Add comprehensive startup debugging for product_comparison import
- Test coordinator creation at startup to catch early failures
- Remove duplicate import blocks that were causing syntax errors
- This will show exactly which LangChain component fails during server startup
api.py
CHANGED
@@ -57,13 +57,45 @@ from chromadb.utils import embedding_functions
|
|
57 |
|
58 |
app = Flask(__name__, static_folder='static')
|
59 |
|
60 |
-
# Import product comparison coordinator
|
|
|
|
|
|
|
|
|
61 |
try:
|
|
|
62 |
from product_comparison import get_product_comparison_coordinator, decode_base64_image
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
print("Warning: Product comparison module not available")
|
65 |
get_product_comparison_coordinator = None
|
66 |
decode_base64_image = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
# νκ²½ λ³μμμ λΉλ° ν€λ₯Ό κ°μ Έμ€κ±°λ, μμΌλ©΄ μμ ν λλ€ ν€ μμ±
|
68 |
secret_key = os.environ.get('FLASK_SECRET_KEY')
|
69 |
if not secret_key:
|
@@ -929,6 +961,8 @@ def add_detected_objects():
|
|
929 |
|
930 |
|
931 |
# Product Comparison API Endpoints
|
|
|
|
|
932 |
@app.route('/api/product/compare/start', methods=['POST'])
|
933 |
@login_required
|
934 |
def start_product_comparison():
|
|
|
57 |
|
58 |
app = Flask(__name__, static_folder='static')
|
59 |
|
60 |
+
# Import product comparison coordinator with detailed debugging
|
61 |
+
print("=" * 80)
|
62 |
+
print("[STARTUP DEBUG] π Testing product_comparison import at startup...")
|
63 |
+
print("=" * 80)
|
64 |
+
|
65 |
try:
|
66 |
+
print("[DEBUG] Attempting to import product_comparison module...")
|
67 |
from product_comparison import get_product_comparison_coordinator, decode_base64_image
|
68 |
+
print("[DEBUG] β Product comparison module imported successfully!")
|
69 |
+
print(f"[DEBUG] β get_product_comparison_coordinator: {get_product_comparison_coordinator}")
|
70 |
+
print(f"[DEBUG] β decode_base64_image: {decode_base64_image}")
|
71 |
+
|
72 |
+
# Test coordinator creation
|
73 |
+
print("[DEBUG] Testing coordinator creation...")
|
74 |
+
test_coordinator = get_product_comparison_coordinator()
|
75 |
+
print(f"[DEBUG] β Test coordinator created: {type(test_coordinator).__name__}")
|
76 |
+
|
77 |
+
except ImportError as e:
|
78 |
+
print(f"[DEBUG] β Product comparison import failed: {e}")
|
79 |
+
print(f"[DEBUG] β Import error type: {type(e).__name__}")
|
80 |
+
print(f"[DEBUG] β Import error args: {e.args}")
|
81 |
+
import traceback
|
82 |
+
print("[DEBUG] β Full import traceback:")
|
83 |
+
traceback.print_exc()
|
84 |
print("Warning: Product comparison module not available")
|
85 |
get_product_comparison_coordinator = None
|
86 |
decode_base64_image = None
|
87 |
+
except Exception as e:
|
88 |
+
print(f"[DEBUG] β Unexpected error during import: {e}")
|
89 |
+
print(f"[DEBUG] β Error type: {type(e).__name__}")
|
90 |
+
import traceback
|
91 |
+
print("[DEBUG] β Full traceback:")
|
92 |
+
traceback.print_exc()
|
93 |
+
get_product_comparison_coordinator = None
|
94 |
+
decode_base64_image = None
|
95 |
+
|
96 |
+
print("=" * 80)
|
97 |
+
print(f"[STARTUP DEBUG] π Import test completed. Coordinator available: {get_product_comparison_coordinator is not None}")
|
98 |
+
print("=" * 80)
|
99 |
# νκ²½ λ³μμμ λΉλ° ν€λ₯Ό κ°μ Έμ€κ±°λ, μμΌλ©΄ μμ ν λλ€ ν€ μμ±
|
100 |
secret_key = os.environ.get('FLASK_SECRET_KEY')
|
101 |
if not secret_key:
|
|
|
961 |
|
962 |
|
963 |
# Product Comparison API Endpoints
|
964 |
+
|
965 |
+
|
966 |
@app.route('/api/product/compare/start', methods=['POST'])
|
967 |
@login_required
|
968 |
def start_product_comparison():
|