From 71726d680bde0e9974ea49556f0d2fb0cb7ffc67 Mon Sep 17 00:00:00 2001 From: alexsunxl Date: Wed, 18 Oct 2023 17:20:06 +0800 Subject: [PATCH] Fixed a crash with knowledge base arguments --- src/service/aios_shell/aios_shell.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/service/aios_shell/aios_shell.py b/src/service/aios_shell/aios_shell.py index d42096e..f015776 100644 --- a/src/service/aios_shell/aios_shell.py +++ b/src/service/aios_shell/aios_shell.py @@ -367,9 +367,12 @@ class AIOS_Shell: 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