feat(deepseek): 添加 DeepSeek reasoning 模式支持

This commit is contained in:
2026-05-26 16:27:49 +08:00
parent 3a57d25a76
commit 1063369d96
6 changed files with 103 additions and 39 deletions

View File

@@ -44,6 +44,7 @@ pub struct LlmClientConfig {
pub max_tokens: u32,
pub temperature: f32,
pub timeout: Duration,
pub thinking_enabled: bool,
}
impl Default for LlmClientConfig {
@@ -52,6 +53,7 @@ impl Default for LlmClientConfig {
max_tokens: 500,
temperature: 0.7,
timeout: Duration::from_secs(30),
thinking_enabled: false,
}
}
}
@@ -64,12 +66,14 @@ impl LlmClient {
max_tokens: config.llm.max_tokens,
temperature: config.llm.temperature,
timeout: Duration::from_secs(config.llm.timeout),
thinking_enabled: config.llm.thinking_enabled,
};
let provider = config.llm.provider.as_str();
let model = config.llm.model.as_str();
let base_url = manager.llm_base_url();
let api_key = manager.get_api_key();
let thinking_enabled = config.llm.thinking_enabled;
let provider: Box<dyn LlmProvider> = match provider {
"ollama" => {
@@ -88,12 +92,12 @@ impl LlmClient {
"kimi" => {
let key = api_key.as_ref()
.ok_or_else(|| anyhow::anyhow!("Kimi API key not configured"))?;
Box::new(KimiClient::with_base_url(key, model, &base_url)?)
Box::new(KimiClient::with_base_url(key, model, &base_url)?.with_thinking(thinking_enabled))
}
"deepseek" => {
let key = api_key.as_ref()
.ok_or_else(|| anyhow::anyhow!("DeepSeek API key not configured"))?;
Box::new(DeepSeekClient::with_base_url(key, model, &base_url)?)
Box::new(DeepSeekClient::with_base_url(key, model, &base_url)?.with_thinking(thinking_enabled))
}
"openrouter" => {
let key = api_key.as_ref()