feat: 配置默认使用千问模型

- 修改默认LLM配置为千问模型(qwen-turbo)
- 创建LLM配置文件,支持千问、OpenAI、Anthropic等多种模型
- 添加千问模型的特殊支持和模拟响应
- 创建配置说明文档,指导用户如何配置千问API密钥
- 优化智能Agent的模拟响应,体现千问模型的特色
- 支持通过配置文件灵活切换不同的LLM提供商
This commit is contained in:
zhaojie
2025-09-11 00:03:02 +08:00
parent 23f460d997
commit a0de2a6c0e
5 changed files with 125 additions and 20 deletions

View File

@@ -38,7 +38,7 @@ class BaseLLMClient(ABC):
pass
class OpenAIClient(BaseLLMClient):
"""OpenAI客户端"""
"""OpenAI客户端 - 支持OpenAI和兼容OpenAI API的模型如千问"""
def __init__(self, config: LLMConfig):
self.config = config
@@ -93,11 +93,15 @@ class OpenAIClient(BaseLLMClient):
def _simulate_response(self, prompt: str) -> str:
"""模拟响应"""
if "千问" in self.config.model or "qwen" in self.config.model.lower():
return f"【千问模型模拟响应】根据您的问题,我建议采取以下措施:{prompt[:50]}... 这是一个智能化的解决方案。"
return f"模拟LLM响应: {prompt[:100]}..."
def _simulate_chat(self, messages: List[Dict[str, str]]) -> str:
"""模拟对话响应"""
last_message = messages[-1]["content"] if messages else ""
if "千问" in self.config.model or "qwen" in self.config.model.lower():
return f"【千问模型模拟对话】我理解您的问题:{last_message[:50]}... 让我为您提供专业的建议。"
return f"模拟对话响应: {last_message[:100]}..."
class AnthropicClient(BaseLLMClient):