Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,17 +44,21 @@ def respond(
|
|
| 44 |
}
|
| 45 |
)
|
| 46 |
response = ""
|
|
|
|
| 47 |
is_reasoning_end = True
|
|
|
|
| 48 |
|
| 49 |
-
for
|
| 50 |
if hasattr(event.choices[0].delta, 'reasoning_content'):
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
| 54 |
else:
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
| 58 |
yield response
|
| 59 |
except Exception as e:
|
| 60 |
raise gr.Error(f"εηιθ――: {str(e)}")
|
|
|
|
| 44 |
}
|
| 45 |
)
|
| 46 |
response = ""
|
| 47 |
+
is_reasoning_start = True
|
| 48 |
is_reasoning_end = True
|
| 49 |
+
|
| 50 |
|
| 51 |
+
for event in completion:
|
| 52 |
if hasattr(event.choices[0].delta, 'reasoning_content'):
|
| 53 |
+
if is_reasoning_start:
|
| 54 |
+
response += '> **εΌε§ζθ**\n\n'
|
| 55 |
+
is_reasoning_start = False
|
| 56 |
+
token = event.choices[0].delta.reasoning_content
|
| 57 |
else:
|
| 58 |
+
if is_reasoning_end:
|
| 59 |
+
response += '> **η»ζζθ**\n\n'
|
| 60 |
+
is_reasoning_end = False
|
| 61 |
+
token = event.choices[0].delta.content
|
| 62 |
yield response
|
| 63 |
except Exception as e:
|
| 64 |
raise gr.Error(f"εηιθ――: {str(e)}")
|