fix: 优化markdown解析器
This commit is contained in:
parent
66c737e2ed
commit
cd7e9b351d
|
|
@ -1108,17 +1108,18 @@ impl GeminiService {
|
||||||
conversation_context.history_included = true;
|
conversation_context.history_included = true;
|
||||||
|
|
||||||
// 添加系统提示(如果有)
|
// 添加系统提示(如果有)
|
||||||
if let Some(system_prompt) = &request.system_prompt {
|
let system_prompt = if let Some(system_prompt) = &request.system_prompt {
|
||||||
contents.push(ContentPart {
|
system_prompt.clone()
|
||||||
role: "system".to_string(),
|
|
||||||
parts: vec![Part::Text { text: system_prompt.clone() }],
|
|
||||||
});
|
|
||||||
} else if let Some(default_prompt) = &rag_config.system_prompt {
|
} else if let Some(default_prompt) = &rag_config.system_prompt {
|
||||||
contents.push(ContentPart {
|
default_prompt.clone()
|
||||||
role: "system".to_string(),
|
} else {
|
||||||
parts: vec![Part::Text { text: default_prompt.clone() }],
|
return Err(anyhow::anyhow!("系统提示词不能为空,请在请求中提供 system_prompt 或在配置中设置默认 system_prompt"));
|
||||||
});
|
};
|
||||||
}
|
|
||||||
|
contents.push(ContentPart {
|
||||||
|
role: "system".to_string(),
|
||||||
|
parts: vec![Part::Text { text: system_prompt }],
|
||||||
|
});
|
||||||
|
|
||||||
// 添加历史消息
|
// 添加历史消息
|
||||||
for msg in &history_messages {
|
for msg in &history_messages {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue