mirror of
				https://github.com/infiniflow/ragflow.git
				synced 2025-10-25 23:09:20 +00:00 
			
		
		
		
	agents openai API add new way to get session_id (#7937)
### What problem does this PR solve? SpringAI can only add session_id in metadata。so add new way to get session_id from "id" or "metadata.id"  ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
		
							parent
							
								
									a0f76b7a4d
								
							
						
					
					
						commit
						f584f5c3d0
					
				| @ -388,10 +388,10 @@ def agents_completion_openai_compatibility (tenant_id, agent_id): | ||||
|     question = next((m["content"] for m in reversed(messages) if m["role"] == "user"), "") | ||||
|      | ||||
|     if req.get("stream", True): | ||||
|         return Response(completionOpenAI(tenant_id, agent_id, question, session_id=req.get("id", ""), stream=True), mimetype="text/event-stream") | ||||
|         return Response(completionOpenAI(tenant_id, agent_id, question, session_id=req.get("id", req.get("metadata", {}).get("id","")), stream=True), mimetype="text/event-stream") | ||||
|     else: | ||||
|         # For non-streaming, just return the response directly | ||||
|         response = next(completionOpenAI(tenant_id, agent_id, question, session_id=req.get("id", ""), stream=False)) | ||||
|         response = next(completionOpenAI(tenant_id, agent_id, question, session_id=req.get("id", req.get("metadata", {}).get("id","")), stream=False)) | ||||
|         return jsonify(response) | ||||
|      | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 天海蒼灆
						天海蒼灆