Spaces:
Running
Running
update
Browse files
app.py
CHANGED
|
@@ -1456,12 +1456,19 @@ This will help me create a better design for you."""
|
|
| 1456 |
else:
|
| 1457 |
messages.append({'role': 'user', 'content': enhanced_query})
|
| 1458 |
try:
|
| 1459 |
-
completion
|
| 1460 |
-
|
| 1461 |
-
|
| 1462 |
-
|
| 1463 |
-
|
| 1464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1465 |
content = ""
|
| 1466 |
for chunk in completion:
|
| 1467 |
# Only process if chunk.choices is non-empty
|
|
|
|
| 1456 |
else:
|
| 1457 |
messages.append({'role': 'user', 'content': enhanced_query})
|
| 1458 |
try:
|
| 1459 |
+
# Configure completion parameters based on model type
|
| 1460 |
+
completion_params = {
|
| 1461 |
+
"model": _current_model["id"],
|
| 1462 |
+
"messages": messages,
|
| 1463 |
+
"stream": True,
|
| 1464 |
+
"max_tokens": 10000
|
| 1465 |
+
}
|
| 1466 |
+
|
| 1467 |
+
# Add stream_options for Dashscope models for better streaming performance
|
| 1468 |
+
if _current_model["id"] == "qwen3-235b-a22b-thinking-2507":
|
| 1469 |
+
completion_params["stream_options"] = {"include_usage": True}
|
| 1470 |
+
|
| 1471 |
+
completion = client.chat.completions.create(**completion_params)
|
| 1472 |
content = ""
|
| 1473 |
for chunk in completion:
|
| 1474 |
# Only process if chunk.choices is non-empty
|