Futuresony commited on
Commit
9c576b0
·
verified ·
1 Parent(s): 596e686

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -30,14 +30,12 @@ async def chat(request: Request):
30
  if not user_message:
31
  raise HTTPException(status_code=400, detail="Message is required")
32
 
33
- # Call your hosted Space, passing the user_id and message
34
- # Chat history is managed by the Gradio ChatInterface itself,
35
- # so we pass the user_id as an additional input.
36
- # The message is passed as the primary query.
37
  result = client.predict(
38
- query=user_message,
39
- api_key=api_key, # Pass the validated api_key
40
- user_id=user_id, # Pass the user_id
41
  api_name="/chat" # Ensure this matches the endpoint in the Gradio app
42
  )
43
 
 
30
  if not user_message:
31
  raise HTTPException(status_code=400, detail="Message is required")
32
 
33
+ # Call your hosted Space, passing the message and additional inputs (api_key, user_id)
34
+ # The ChatInterface handles chat_history internally when type="messages"
 
 
35
  result = client.predict(
36
+ user_message, # Primary query
37
+ api_key, # First additional input (API Key)
38
+ user_id, # Second additional input (User ID - assuming this will be added to Gradio)
39
  api_name="/chat" # Ensure this matches the endpoint in the Gradio app
40
  )
41