新增对 Kimi、DeepSeek、OpenRouter 的支持并升级版本至 0.1.2

This commit is contained in:
2026-02-01 15:09:39 +08:00
parent cb24b8ae85
commit c3cd01dbcd
10 changed files with 61 additions and 173 deletions

View File

@@ -148,17 +148,22 @@ impl CommitCommand {
}
}
if self.dry_run {
println!("\n{}", "Dry run - commit not created.".yellow());
return Ok(());
}
// Execute commit
let result = if self.amend {
if self.dry_run {
println!("\n{}", "Dry run - commit not amended.".yellow());
return Ok(());
}
self.amend_commit(&repo, &commit_message)?;
None
} else {
Some(repo.commit(&commit_message, self.sign)?)
if self.dry_run {
println!("\n{}", "Dry run - commit not created.".yellow());
return Ok(());
}
CommitBuilder::new()
.message(&commit_message)
.sign(self.sign)
.execute(&repo)?
};
if let Some(commit_oid) = result {

View File

@@ -185,7 +185,14 @@ impl InitCommand {
// LLM provider selection
println!("\n{}", "Select your preferred LLM provider:".bold());
let providers = vec!["Ollama (local)", "OpenAI", "Anthropic Claude"];
let providers = vec![
"Ollama (local)",
"OpenAI",
"Anthropic Claude",
"Kimi (Moonshot AI)",
"DeepSeek",
"OpenRouter"
];
let provider_idx = Select::new()
.items(&providers)
.default(0)
@@ -195,6 +202,9 @@ impl InitCommand {
0 => "ollama",
1 => "openai",
2 => "anthropic",
3 => "kimi",
4 => "deepseek",
5 => "openrouter",
_ => "ollama",
};
@@ -211,6 +221,21 @@ impl InitCommand {
.with_prompt("Anthropic API key")
.interact_text()?;
manager.set_anthropic_api_key(api_key);
} else if provider == "kimi" {
let api_key: String = Input::new()
.with_prompt("Kimi API key")
.interact_text()?;
manager.set_kimi_api_key(api_key);
} else if provider == "deepseek" {
let api_key: String = Input::new()
.with_prompt("DeepSeek API key")
.interact_text()?;
manager.set_deepseek_api_key(api_key);
} else if provider == "openrouter" {
let api_key: String = Input::new()
.with_prompt("OpenRouter API key")
.interact_text()?;
manager.set_openrouter_api_key(api_key);
}
Ok(())

View File

@@ -1,12 +1,12 @@
use anyhow::{bail, Context, Result};
use anyhow::{bail, Result};
use clap::{Parser, Subcommand};
use colored::Colorize;
use dialoguer::{Confirm, Input, Select};
use crate::config::manager::ConfigManager;
use crate::config::{GitProfile, TokenConfig, TokenType, ProfileComparison};
use crate::config::{GitProfile, TokenConfig, TokenType};
use crate::config::profile::{GpgConfig, SshConfig};
use crate::git::{find_repo, GitConfigHelper, UserConfig};
use crate::git::find_repo;
use crate::utils::validators::validate_profile_name;
/// Manage Git profiles

View File

@@ -144,7 +144,6 @@ impl TagCommand {
return Ok(());
}
// Create tag
let builder = TagBuilder::new()
.name(&tag_name)
.message_opt(message)