Skip to content

Commit

Permalink
Fixed a crash with knowledge base arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsunxl committed Oct 18, 2023
1 parent 31d4f91 commit 71726d6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/service/aios_shell/aios_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,12 @@ async def handle_knowledge_commands(self, args):
else:
return show_text
if sub_cmd == "journal":
topn = 10 if len(args) == 1 else int(args[1])
journals = [str(journal) for journal in KnowledgePipline.get_instance().get_latest_journals(topn)]
print_formatted_text("\r\n".join(journals))
try:
topn = 10 if len(args) == 1 else int(args[1])
journals = [str(journal) for journal in KnowledgePipline.get_instance().get_latest_journals(topn)]
print_formatted_text("\r\n".join(journals))
except ValueError:
return FormattedText([("class:title", f"/knowledge journal failed: {args[1]} is not a valid integer.\n")])
if sub_cmd == "query":
if len(args) < 2:
return show_text
Expand Down

0 comments on commit 71726d6

Please sign in to comment.