Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Akegarasu committed Mar 19, 2023
1 parent d277a94 commit 708492c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions modules/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ def append(self, query, output) -> str:
self.rh.append((query, ok))
return ok

def refresh_last(self, query, output) -> str:
ok = parse_codeblock(output)
def update_last(self, query, output) -> None:
self.history[-1] = (query, output)
self.rh[-1] = (query, ok)
return ok

def refresh_last(self) -> None:
query, output = self.history[-1]
self.rh[-1] = (query, parse_codeblock(output))

def clear(self):
self.history = []
Expand Down
5 changes: 3 additions & 2 deletions modules/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ def predict(query, max_length, top_p, temperature):
ctx.append(query, output)
flag = False
else:
ctx.refresh_last(query, output)
# for clear input textbox
ctx.update_last(query, output)
yield ctx.history, ""
ctx.refresh_last()
yield ctx.rh, ""


def clear_history():
Expand Down

0 comments on commit 708492c

Please sign in to comment.