feat(keyring): 集成系统密钥环安全存储 API key

This commit is contained in:
2026-03-12 17:42:41 +08:00
parent c66d782eab
commit da85fc94b1
17 changed files with 990 additions and 1024 deletions

View File

@@ -1,4 +1,5 @@
use crate::config::{CommitFormat, LlmConfig, Language};
use crate::config::{CommitFormat, Language};
use crate::config::manager::ConfigManager;
use crate::git::{CommitInfo, GitRepo};
use crate::llm::{GeneratedCommit, LlmClient};
use anyhow::{Context, Result};
@@ -10,12 +11,11 @@ pub struct ContentGenerator {
impl ContentGenerator {
/// Create new content generator
pub async fn new(config: &LlmConfig) -> Result<Self> {
let llm_client = LlmClient::from_config(config).await?;
pub async fn new(manager: &ConfigManager) -> Result<Self> {
let llm_client = LlmClient::from_config(manager).await?;
// Check if provider is available
if !llm_client.is_available().await {
anyhow::bail!("LLM provider '{}' is not available", config.provider);
anyhow::bail!("LLM provider '{}' is not available", manager.llm_provider());
}
Ok(Self { llm_client })