重构模型管理和配置加载逻辑,支持多模态和推理模型,优化API密钥管理,改进前端模型选择和版本显示

This commit is contained in:
Zylan
2025-03-22 19:37:42 +08:00
parent be8e83d762
commit fa654207c8
13 changed files with 963 additions and 205 deletions

View File

@@ -105,9 +105,18 @@ class DeepSeekModel(BaseModel):
client = OpenAI(**client_args)
# 检查系统提示词是否已包含语言设置指令
system_prompt = self.system_prompt
language = self.language or '中文'
if not any(phrase in system_prompt for phrase in ['Please respond in', '请用', '使用', '回答']):
system_prompt = f"{system_prompt}\n\n请务必使用{language}回答,无论问题是什么语言。即使在分析图像时也请使用{language}回答。"
response = client.chat.completions.create(
model=self.get_model_identifier(),
messages=[{
'role': 'system',
'content': system_prompt
}, {
'role': 'user',
'content': f"Here's an image of a question to analyze: data:image/png;base64,{image_data}"
}],