feat(keyring): 集成系统密钥环安全存储 API key
This commit is contained in:
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user