diff options
| author | sigoden <sigoden@gmail.com> | 2024-06-22 20:24:44 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-22 20:24:44 +0800 |
| commit | 3826d808d81c3ddc996a987bf6a749e8df6d8c48 (patch) | |
| tree | dea89dd576071ada77ad97225df8a59cb316243a | |
| parent | 0ec370b48c951a69459f9232b56df882765ccb52 (diff) | |
| download | aichat-3826d808d81c3ddc996a987bf6a749e8df6d8c48.tar.gz | |
refactor: minior improvement (#633)
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | config.example.yaml | 73 | ||||
| -rw-r--r-- | src/repl/mod.rs | 6 |
3 files changed, 39 insertions, 42 deletions
@@ -4,7 +4,7 @@ [](https://crates.io/crates/aichat) [](https://discord.gg/mr3ZZUB9hG) -AIChat is an all-in-one AI CLI tool featuring chat REPL, RAG, function calling, agents, and more. +AIChat is an all-in-one AI CLI tool featuring Chat-REPL, RAG, Function Calling, AI Agents, and more.  diff --git a/config.example.yaml b/config.example.yaml index 9333f5b..a152fcc 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -1,31 +1,46 @@ +# ---- llm ---- model: openai:gpt-3.5-turbo # Specify the language model to use temperature: null # Set default temperature parameter top_p: null # Set default top-p parameter -save: true # Indicates whether to persist the message -save_session: null # Controls the persistence of the session, if null, asking the user + +# ---- apperence ---- highlight: true # Controls syntax highlighting light_theme: false # Activates a light color theme when true. ENV: AICHAT_LIGHT_THEME +# Custom REPL prompt, see https://github.com/sigoden/aichat/wiki/Custom-REPL-Prompt for more detils +left_prompt: + '{color.green}{?session {?agent {agent}#}{session}{?role /}}{!session {?agent {agent}}}{role}{?rag @{rag}}{color.cyan}{?session )}{!session >}{color.reset} ' +right_prompt: + '{color.purple}{?session {?consume_tokens {consume_tokens}({consume_percent}%)}{!consume_tokens {consume_tokens}}}{color.reset}' + +# ---- behavior ---- +save: true # Indicates whether to persist the message wrap: no # Controls text wrapping (no, auto, <max-width>) wrap_code: false # Enables or disables wrapping of code blocks keybindings: emacs # Choose keybinding style (emacs, vi) +buffer_editor: null # Command used to edit the current input with Ctrl+O +# ---- prelude ---- prelude: null # Set a default role or session to start with (e.g. role:<name>, session:<name>) -repl_prelude: null # This overrides 'prelude' when using REPL +repl_prelude: null # Overrides the `prelude` setting specifically for conversations started in REPL +agent_prelude: null # Set a session to use when starting a agent. (e.g. temp, default) -# Command that will be used to edit the current line buffer with ctrl+o -# if unset fallback to $EDITOR and $VISUAL -buffer_editor: null +# ---- session ---- +# Controls the persistence of the session, if null, asking the user +save_session: null +# Compress session when token count reaches or exceeds this threshold (must be at least 1000) +compress_threshold: 4000 +# Text prompt used for creating a concise summary of session message +summarize_prompt: 'Summarize the discussion briefly in 200 words or less to use as a prompt for future context.' +# Text prompt used for including the summary of the entire session +summary_prompt: 'This is a summary of the chat history as a recap: ' +# ---- function-calling ---- # Controls the function calling feature. For setup instructions, visit https://github.com/sigoden/llm-functions function_calling: false - # Regex for seletecting dangerous functions. # User confirmation is required when executing these functions. # e.g. 'execute_command|execute_js_code' 'execute_.*' dangerously_functions_filter: null - -agent_prelude: null # Set a session to use when starting a agent. (e.g. temp, default) - agents: - name: todo-sh model: null @@ -33,23 +48,15 @@ agents: top_p: null dangerously_functions_filter: null -# Specifies the embedding model to use -rag_embedding_model: null -# Specifies the rerank model to use -rag_rerank_model: null -# Specifies the chunk size -rag_chunk_size: null -# Specifies the chunk overlap -rag_chunk_overlap: null -# Specifies the number of documents to retrieve -rag_top_k: 4 -# Specifies the minimum relevance score for vector-based searching -rag_min_score_vector_search: 0 -# Specifies the minimum relevance score for keyword-based searching -rag_min_score_keyword_search: 0 -# Specifies the minimum relevance score for reranking -rag_min_score_rerank: 0 - +# ---- rag ---- +rag_embedding_model: null # Specifies the embedding model to use +rag_rerank_model: null # Specifies the rerank model to use +rag_chunk_size: null # Specifies the chunk size +rag_chunk_overlap: null # Specifies the chunk overlap +rag_top_k: 4 # Specifies the number of documents to retrieve +rag_min_score_vector_search: 0 # Specifies the minimum relevance score for vector-based searching +rag_min_score_keyword_search: 0 # Specifies the minimum relevance score for keyword-based searching +rag_min_score_rerank: 0 # Specifies the minimum relevance score for reranking # Defines the query structure using variables like __CONTEXT__ and __INPUT__ to tailor searches to specific needs rag_template: | Use the following context as your learned knowledge, inside <context></context> XML tags. @@ -66,17 +73,7 @@ rag_template: | Given the context information, answer the query. Query: __INPUT__ -# Compress session when token count reaches or exceeds this threshold (must be at least 1000) -compress_threshold: 4000 -# Text prompt used for creating a concise summary of session message -summarize_prompt: 'Summarize the discussion briefly in 200 words or less to use as a prompt for future context.' -# Text prompt used for including the summary of the entire session -summary_prompt: 'This is a summary of the chat history as a recap: ' - -# Custom REPL prompt, see https://github.com/sigoden/aichat/wiki/Custom-REPL-Prompt -left_prompt: '{color.green}{?session {?agent {agent}#}{session}{?role /}}{!session {?agent {agent}}}{role}{?rag @{rag}}{color.cyan}{?session )}{!session >}{color.reset} ' -right_prompt: '{color.purple}{?session {?consume_tokens {consume_tokens}({consume_percent}%)}{!consume_tokens {consume_tokens}}}{color.reset}' - +# ---- clients ---- clients: # All clients have the following configuration: # - type: xxxx diff --git a/src/repl/mod.rs b/src/repl/mod.rs index d187956..1df3fdb 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -59,7 +59,7 @@ lazy_static! { ), ReplCommand::new( ".session", - "Begin a chat session", + "Begin a session", AssertState::False(StateFlags::SESSION_EMPTY | StateFlags::SESSION), ), ReplCommand::new( @@ -69,12 +69,12 @@ lazy_static! { ), ReplCommand::new( ".save session", - "Save the chat to file", + "Save the current session to file", AssertState::True(StateFlags::SESSION_EMPTY | StateFlags::SESSION) ), ReplCommand::new( ".edit session", - "Edit the current session", + "Edit the current session with an editor", AssertState::True(StateFlags::SESSION_EMPTY | StateFlags::SESSION) ), ReplCommand::new( |
