Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -44,19 +44,17 @@ def respond(
|
|
44 |
}
|
45 |
)
|
46 |
response = ""
|
|
|
47 |
|
48 |
for index, event in enumerate(completion):
|
49 |
if hasattr(event.choices[0].delta, 'reasoning_content'):
|
50 |
-
if index == 0
|
51 |
-
|
52 |
-
token = event.choices[0].delta.reasoning_content
|
53 |
else:
|
54 |
-
response += '
|
55 |
-
token = event.choices[0].delta.content
|
56 |
-
|
57 |
-
# print(11111111111)
|
58 |
-
# print(event)
|
59 |
-
response += token
|
60 |
yield response
|
61 |
except Exception as e:
|
62 |
raise gr.Error(f"εηιθ――: {str(e)}")
|
|
|
44 |
}
|
45 |
)
|
46 |
response = ""
|
47 |
+
is_reasoning_end = True
|
48 |
|
49 |
for index, event in enumerate(completion):
|
50 |
if hasattr(event.choices[0].delta, 'reasoning_content'):
|
51 |
+
separator = '--- **εΌε§ζθ** ---' if index == 0 else ''
|
52 |
+
response += separator + '\n'
|
53 |
+
token = f'<span style="color: #1e88e5; background-color: #e8f5e9; padding: 2px 4px; border-radius: 3px;">{event.choices[0].delta.reasoning_content}</span>'
|
54 |
else:
|
55 |
+
response += '--- **η»ζζθ** ---\n'
|
56 |
+
token = f'<span style="color: #43a047; background-color: #f1f8e9; padding: 2px 4px; border-radius: 3px;">{event.choices[0].delta.content}</span>'
|
57 |
+
response += token + '\n'
|
|
|
|
|
|
|
58 |
yield response
|
59 |
except Exception as e:
|
60 |
raise gr.Error(f"εηιθ――: {str(e)}")
|