Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yihong0618 committed Feb 23, 2023
1 parent 89a35fe commit ed27d76
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions xiaogpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ async def get_latest_ask_from_xiaoai(self):
def get_last_timestamp_and_record(self, data):
if d := data.get("data"):
records = json.loads(d).get("records")
if not records:
return 0, None
last_record = records[0]
timestamp = last_record.get("time")
return timestamp, last_record
else:
return 0, None

async def do_tts(self, value):
if not self.use_command:
Expand Down Expand Up @@ -201,7 +201,6 @@ async def run_forever(self):
await asyncio.sleep(0.3)
if self.this_mute_xiaoai:
await self.stop_if_xiaoai_is_playing()

new_timestamp, last_record = self.get_last_timestamp_and_record(r)
if new_timestamp > self.last_timestamp:
self.last_timestamp = new_timestamp
Expand Down Expand Up @@ -299,4 +298,3 @@ async def run_forever(self):
options.mute_xiaoai,
)
asyncio.run(miboy.run_forever())

0 comments on commit ed27d76

Please sign in to comment.