From 73bc7b3da62005ffdd60bb6c300807a63f547dbb Mon Sep 17 00:00:00 2001 From: Some Anon Date: Tue, 21 Oct 2025 23:33:43 +0200 Subject: [PATCH 1/2] Simple help for main.nim --- bindings/main.nim | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bindings/main.nim b/bindings/main.nim index fbfb748f..f91754c2 100644 --- a/bindings/main.nim +++ b/bindings/main.nim @@ -4,6 +4,28 @@ import packages/docutils/highlite, terminal var all_models: JsonNode = nil +proc show_help() = + echo """ +Usage: ./program [OPTIONS] + +A command-line interface for interacting with language models using libchatllm. + +Options: + -m, --model Specify the model to use (e.g., :qwen:1.5b) + --embedding_model Specify the embedding model to use + --reranker_model Specify the reranker model to use + -p, --prompt Set the initial prompt for the model + -i, --interactive Enable interactive mode + --reversed_role Reverse the role of user and AI in interactive mode + --multi Allow multi-line input in interactive mode + -h, --help Show this help message + +Examples: + ./program -m :qwen:1.5b -p "Hello, world!" + ./program --interactive --model :qwen:1.5b + ./program --help +""" + proc get_model_url_on_modelscope(url: seq[string]): string = let proj = url[0] let fn = url[1] @@ -190,6 +212,10 @@ var reversed_role = false var use_multiple_lines = false for i in 1 .. paramCount(): + if paramStr(i) in ["-h", "--help"]: + show_help() + quit(0) + if paramStr(i) in ["-i", "--interactive"]: interactive = true From 6a2078587f1a6e1004408ab8503bce11a0ac8301 Mon Sep 17 00:00:00 2001 From: Some Anon Date: Wed, 22 Oct 2025 09:42:00 +0200 Subject: [PATCH 2/2] Alligned the notes --- bindings/main.nim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bindings/main.nim b/bindings/main.nim index f91754c2..2da57ad4 100644 --- a/bindings/main.nim +++ b/bindings/main.nim @@ -15,10 +15,10 @@ Options: --embedding_model Specify the embedding model to use --reranker_model Specify the reranker model to use -p, --prompt Set the initial prompt for the model - -i, --interactive Enable interactive mode - --reversed_role Reverse the role of user and AI in interactive mode - --multi Allow multi-line input in interactive mode - -h, --help Show this help message + -i, --interactive Enable interactive mode + --reversed_role Reverse the role of user and AI in interactive mode + --multi Allow multi-line input in interactive mode + -h, --help Show this help message Examples: ./program -m :qwen:1.5b -p "Hello, world!" @@ -265,4 +265,4 @@ if interactive: else: discard chatllm_user_input(chat, prompt.cstring) -chatllm_show_statistics(chat) \ No newline at end of file +chatllm_show_statistics(chat)