mariusjabami commited on
Commit
f004227
·
verified ·
1 Parent(s): 277244a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
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\nThinking a short step-by-step before answering."
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.sleep(0.5)
 
 
 
 
 
 
 
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},