Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -44,12 +44,14 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
44 |
|
45 |
thinking_prompt = messages + [{
|
46 |
"role": "user",
|
47 |
-
"content": f"{message}\n\
|
48 |
}]
|
49 |
|
50 |
reasoning = ""
|
51 |
yield '<div class="markdown-think">Thinking...</div>'
|
52 |
|
|
|
|
|
53 |
for chunk in client.chat_completion(
|
54 |
thinking_prompt,
|
55 |
max_tokens=max_tokens,
|
@@ -62,7 +64,14 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
62 |
styled_thought = f'<div class="markdown-think">{reasoning.strip()}</div>'
|
63 |
yield styled_thought
|
64 |
|
65 |
-
time.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
final_prompt = messages + [
|
68 |
{"role": "user", "content": message},
|
|
|
44 |
|
45 |
thinking_prompt = messages + [{
|
46 |
"role": "user",
|
47 |
+
"content": f"{message}\n\nThink step-by-step before answering."
|
48 |
}]
|
49 |
|
50 |
reasoning = ""
|
51 |
yield '<div class="markdown-think">Thinking...</div>'
|
52 |
|
53 |
+
start = time.time()
|
54 |
+
|
55 |
for chunk in client.chat_completion(
|
56 |
thinking_prompt,
|
57 |
max_tokens=max_tokens,
|
|
|
64 |
styled_thought = f'<div class="markdown-think">{reasoning.strip()}</div>'
|
65 |
yield styled_thought
|
66 |
|
67 |
+
elapsed = time.time() - start
|
68 |
+
|
69 |
+
yield f"""
|
70 |
+
<div style="margin-top:12px;padding:8px 12px;background-color:#222;border-left:4px solid #888;
|
71 |
+
font-family:'JetBrains Mono', monospace;color:#ccc;font-size:14px;">
|
72 |
+
Pensou por {elapsed:.1f} segundos
|
73 |
+
</div>
|
74 |
+
"""
|
75 |
|
76 |
final_prompt = messages + [
|
77 |
{"role": "user", "content": message},
|