Update app.py
Browse files
app.py
CHANGED
|
@@ -638,7 +638,7 @@ def handsome_chat_completions():
|
|
| 638 |
for item in images:
|
| 639 |
if isinstance(item, dict) and "url" in item:
|
| 640 |
image_url = item["url"]
|
| 641 |
-
|
| 642 |
try:
|
| 643 |
image_data = requests.get(image_url, stream=True).raw
|
| 644 |
image = Image.open(image_data)
|
|
@@ -693,8 +693,8 @@ def handsome_chat_completions():
|
|
| 693 |
logging.error(f"请求转发异常: {e}")
|
| 694 |
return jsonify({"error": str(e)}), 500
|
| 695 |
else:
|
| 696 |
-
|
| 697 |
-
|
| 698 |
start_time = time.time()
|
| 699 |
response = requests.post(
|
| 700 |
TEST_MODEL_ENDPOINT,
|
|
@@ -708,7 +708,7 @@ def handsome_chat_completions():
|
|
| 708 |
|
| 709 |
if data.get("stream", False):
|
| 710 |
# ... (Existing stream response handling)
|
| 711 |
-
|
| 712 |
first_chunk_time = None
|
| 713 |
full_response_content = ""
|
| 714 |
for chunk in response.iter_content(chunk_size=1024):
|
|
|
|
| 638 |
for item in images:
|
| 639 |
if isinstance(item, dict) and "url" in item:
|
| 640 |
image_url = item["url"]
|
| 641 |
+
logging.info(f"Fetched image URL: {image_url}") # Log the URL
|
| 642 |
try:
|
| 643 |
image_data = requests.get(image_url, stream=True).raw
|
| 644 |
image = Image.open(image_data)
|
|
|
|
| 693 |
logging.error(f"请求转发异常: {e}")
|
| 694 |
return jsonify({"error": str(e)}), 500
|
| 695 |
else:
|
| 696 |
+
# Existing text-based model handling logic
|
| 697 |
+
try:
|
| 698 |
start_time = time.time()
|
| 699 |
response = requests.post(
|
| 700 |
TEST_MODEL_ENDPOINT,
|
|
|
|
| 708 |
|
| 709 |
if data.get("stream", False):
|
| 710 |
# ... (Existing stream response handling)
|
| 711 |
+
def generate():
|
| 712 |
first_chunk_time = None
|
| 713 |
full_response_content = ""
|
| 714 |
for chunk in response.iter_content(chunk_size=1024):
|