LLM支持优化
This commit is contained in:
@@ -55,6 +55,10 @@ pub struct ChangelogCommand {
|
||||
#[arg(long)]
|
||||
dry_run: bool,
|
||||
|
||||
/// Enable thinking mode for this changelog (override config)
|
||||
#[arg(long)]
|
||||
think: bool,
|
||||
|
||||
/// Skip interactive prompts
|
||||
#[arg(short = 'y', long)]
|
||||
yes: bool,
|
||||
@@ -74,8 +78,7 @@ impl ChangelogCommand {
|
||||
|
||||
// Initialize changelog if requested
|
||||
if self.init {
|
||||
let path = self.output.as_ref()
|
||||
.map(|p| p.clone())
|
||||
let path = self.output.clone()
|
||||
.unwrap_or_else(|| PathBuf::from(&config.changelog.path));
|
||||
|
||||
init_changelog(&path)?;
|
||||
@@ -84,8 +87,7 @@ impl ChangelogCommand {
|
||||
}
|
||||
|
||||
// Determine output path
|
||||
let output_path = self.output.as_ref()
|
||||
.map(|p| p.clone())
|
||||
let output_path = self.output.clone()
|
||||
.unwrap_or_else(|| PathBuf::from(&config.changelog.path));
|
||||
|
||||
// Determine format
|
||||
@@ -148,7 +150,7 @@ impl ChangelogCommand {
|
||||
println!("{}", "─".repeat(60));
|
||||
|
||||
let confirm = Confirm::new()
|
||||
.with_prompt(&messages.write_to_file(&format!("{:?}", output_path)))
|
||||
.with_prompt(messages.write_to_file(&format!("{:?}", output_path)))
|
||||
.default(true)
|
||||
.interact()?;
|
||||
|
||||
@@ -208,7 +210,7 @@ impl ChangelogCommand {
|
||||
|
||||
println!("{}", messages.ai_generating_changelog());
|
||||
|
||||
let generator = ContentGenerator::new(&manager).await?;
|
||||
let generator = ContentGenerator::new_with_think(&manager, self.think).await?;
|
||||
generator.generate_changelog_entry(version, commits, language).await
|
||||
}
|
||||
|
||||
@@ -237,7 +239,8 @@ impl ChangelogCommand {
|
||||
}
|
||||
|
||||
fn translate_changelog_categories(&self, changelog: &str, language: Language) -> String {
|
||||
let translated = changelog
|
||||
|
||||
changelog
|
||||
.lines()
|
||||
.map(|line| {
|
||||
if line.starts_with("## ") || line.starts_with("### ") {
|
||||
@@ -253,7 +256,6 @@ impl ChangelogCommand {
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
translated
|
||||
.join("\n")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user