fix: 优化markdown解析器
This commit is contained in:
parent
e70bf2b6c0
commit
34895c2d55
|
|
@ -1059,6 +1059,9 @@ impl GeminiService {
|
|||
let start_time = std::time::Instant::now();
|
||||
println!("🔍 开始多轮RAG Grounding查询: {}", request.user_input);
|
||||
|
||||
// 先提取 system_prompt,避免 request 被消费后无法访问
|
||||
let request_system_prompt = request.system_prompt.clone();
|
||||
|
||||
// 获取配置,确保 system_prompt 不会被覆盖
|
||||
let mut rag_config = request.config.unwrap_or_default();
|
||||
|
||||
|
|
@ -1145,7 +1148,7 @@ impl GeminiService {
|
|||
|
||||
// 4. 执行RAG查询
|
||||
println!("🚀 准备执行RAG查询,contents数量: {}", contents.len());
|
||||
let response = self.execute_rag_grounding_with_contents(contents, rag_config).await?;
|
||||
let response = self.execute_rag_grounding_with_contents(contents, rag_config, request_system_prompt).await?;
|
||||
println!("📥 RAG查询响应已收到");
|
||||
|
||||
// 5. 保存消息到会话历史(如果有会话仓库)
|
||||
|
|
@ -1250,6 +1253,7 @@ impl GeminiService {
|
|||
&mut self,
|
||||
contents: Vec<ContentPart>,
|
||||
rag_config: RagGroundingConfig,
|
||||
request_system_prompt: Option<String>,
|
||||
) -> Result<RagGroundingResponse> {
|
||||
println!("🔑 开始获取访问令牌...");
|
||||
// 获取访问令牌
|
||||
|
|
@ -1285,7 +1289,7 @@ impl GeminiService {
|
|||
};
|
||||
|
||||
// 获取系统提示
|
||||
let system_prompt = if let Some(system_prompt) = &request.system_prompt {
|
||||
let system_prompt = if let Some(system_prompt) = &request_system_prompt {
|
||||
Some(system_prompt.clone())
|
||||
} else {
|
||||
rag_config.system_prompt.clone()
|
||||
|
|
|
|||
|
|
@ -338,20 +338,20 @@ export const ChatInterface: React.FC<ChatInterfaceProps> = ({
|
|||
}
|
||||
});
|
||||
|
||||
let searchText = '我想要';
|
||||
let searchText = '';
|
||||
if (tagGroups.style.length > 0) {
|
||||
searchText += `${tagGroups.style.join('、')}风格的`;
|
||||
searchText += `${tagGroups.style.join('、')}`;
|
||||
}
|
||||
if (tagGroups.color.length > 0) {
|
||||
searchText += `${tagGroups.color.join('、')}`;
|
||||
}
|
||||
if (tagGroups.occasion.length > 0) {
|
||||
searchText += `适合${tagGroups.occasion.join('、')}的`;
|
||||
searchText += `${tagGroups.occasion.join('、')}`;
|
||||
}
|
||||
if (tagGroups.other.length > 0) {
|
||||
searchText += `${tagGroups.other.join('、')}`;
|
||||
}
|
||||
searchText += '穿搭推荐';
|
||||
searchText += '';
|
||||
|
||||
return searchText;
|
||||
}, [selectedTags]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue