better bar

This commit is contained in:
Paul Gauthier 2023-08-10 22:21:39 -03:00
parent bfa7fedd18
commit 24f574a7dc
2 changed files with 7 additions and 3 deletions

View file

@ -37,10 +37,14 @@ class Voice:
self.pct = (rms - self.min_rms) / rng
def get_prompt(self):
num = 10
if np.isnan(self.pct):
bar = ""
cnt = 0
else:
bar = "" * int(self.pct * 10)
cnt = int(self.pct * 10)
bar = "" * cnt + "" * (num - cnt)
bar = bar[:num]
dur = time.time() - self.start_time
return f"Recording, press ENTER when done... {dur:.1f}sec {bar}"

View file

@ -19,7 +19,7 @@ the aider chat session.
#### /voice
> Recording... Press ENTER when done speaking...
> Recording, press ENTER when done...
<div style="display: inline-block; position: relative; width: 200px; background-color: #f0f0f0; border-radius: 10px; padding: 10px; color: #333; font-family: 'Comic Sans MS', 'Comic Sans', 'Marker Felt', sans-serif;">
<span style="position: absolute; top: 0; left: 50%; transform: translate(-50%, -100%); width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 10px solid #f0f0f0;"></span>