-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for prompt file in commit command
This commit adds support for specifying a prompt file in the commit command. If a prompt file is provided, the content of the file will be used as the prompt for the chat completion. This allows users to provide a custom prompt for generating chat completions. The `prompt_file` field has been added to the `Cmd` struct in the `commit` module. If the `prompt_file` option is provided, the content of the file will be read and used as the prompt. If the `prompt_file` option is not provided, the default prompt from the `res/prompt.md` file will be used. This change enhances the flexibility of the commit command by allowing users to easily customize the prompt used for generating chat completions.
- Loading branch information
Showing
10 changed files
with
133 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/dist | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,42 @@ | ||
#[macro_export] | ||
macro_rules! anyhow { | ||
($msg:literal $(,)?) => { | ||
$crate::common::log::LogError::log(anyhow::anyhow!($msg)) | ||
}; | ||
|
||
($err:expr $(,)?) => { | ||
$crate::common::log::LogError::log(anyhow::anyhow!($err)) | ||
}; | ||
|
||
($fmt:expr, $($arg:tt)*) => { | ||
$crate::common::log::LogError::log(anyhow::anyhow!($fmt, $($arg)*)) | ||
}; | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! bail { | ||
($msg:literal $(,)?) => { | ||
return Err(anyhow::anyhow!($msg)).log() | ||
return Err($crate::anyhow!($msg)) | ||
}; | ||
|
||
($err:expr $(,)?) => { | ||
return Err(anyhow::anyhow!($err)).log() | ||
return Err($crate::anyhow!($err)) | ||
}; | ||
|
||
($fmt:expr, $($arg:tt)*) => { | ||
return Err(anyhow::anyhow!($fmt, $($arg)*)).log() | ||
return Err($crate::anyhow!($fmt, $($arg)*)) | ||
}; | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! ensure { | ||
($cond:expr $(,)?) => { | ||
if !$cond { | ||
return Err(anyhow::anyhow!(concat!( | ||
return Err($crate::anyhow!(concat!( | ||
"Condition failed: `", | ||
stringify!($cond), | ||
"`" | ||
))) | ||
.log(); | ||
))); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pub mod err; | ||
mod err; | ||
pub mod log; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters