-
Notifications
You must be signed in to change notification settings - Fork 81
feat: Update prompt language settings for summarization #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Left some comments.
My main question is what happens when we select an unsupported language? Can we provide a clear list of supported languages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch. Just some remaining comments and I think we are almost there
Hi, I have two problem that I need your help. ① First, about the #[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Display, EnumString, IntoStaticStr)]
#[strum(serialize_all = "kebab-case")]
pub enum Language {
#[strum(to_string = "English")]
En,
#[strum(to_string = "Simplified Chinese")]
ZhCn,
#[strum(to_string = "Traditional Chinese")]
ZhTw,
#[strum(to_string = "Japanese")]
Ja,
}
// input `value` is `en`
let lang = Language::from_str(value).unwrap(); // thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: VariantNotFound'
// input `value` is `English`
let lang = Language::from_str(value).unwrap(); // success I think it means that ② Second, about the summarize. I noticed that the generation of the summarize commit and the title commit is based on the file diff summary. So if the file diff summary is in Chinese, the summarize commit and the title commit will be wrong. My Solution is that the file diff summary do not use the output language setting. I want to know your suggestions. It will help me. |
For 1. This link might help https://stackoverflow.com/questions/69292362/enum-to-str-str-to-enum Look at the parse function For two, you bring up a good point. We might need to add another prompt at the end to translate the whole commit message for non English languages. What do you think? |
Maybe we can insert a translation step here. I'm not familiar with the prompt, but I'll give it a try. |
Try making your changes in this function. Note you'll need to rebase as I did some refactoring. Lines 55 to 58 in 57747d1
I would add the language prompt to the title and summary prompts and then add a new prompt to translate the file-level bullet points |
Sorry, I have no idea about using |
src/summarize.rs
Outdated
let mut message = lines.join("\n"); | ||
|
||
message = self.commit_tanslate(&message).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut message = lines.join("\n"); | |
message = self.commit_tanslate(&message).await?; | |
let message = lines.join("\n"); | |
let message = self.commit_tanslate(&message).await?; |
You don't need the mut
:)
This looks great! As for the Note that the Run |
Thanks for the review. I fixed the lint error and some typos. |
Perhaps we have a new problem. If the user has an old configuration file, do they need to delete the old one and set it up again? |
The configuration files should be forward-compatible as long as we add fields and don't change default values. Do you have instructions to repro this issue? |
I have only added the translation prompt and |
#42
Hi, thanks for building this tool!
I'm a Chinese, so I need a configuration to set the language to use when generating the summary, like Chinese.
This is my work. And I am a novice in programming with rust, so if there are any mistakes, welcome to make suggestions.