KingNish commited on
Commit
29de61c
·
verified ·
1 Parent(s): c8c49e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -223,7 +223,7 @@ async def chat(
223
  # Define a Pydantic model for the request payload
224
  class ChatRequest(BaseModel):
225
  q: str
226
- history: str = "[]"
227
  model: str = "gpt-4o-mini"
228
  proxy: Optional[str] = None
229
 
@@ -233,7 +233,8 @@ async def chat(request: ChatRequest):
233
  try:
234
  with WEBS(proxy=request.proxy) as webs:
235
  chat_messages = []
236
- chat_messages.extend(ast.literal_eval(request.history))
 
237
  results = webs.chat(keywords=request.q, chat_messages = chat_messages, model=request.model)
238
  return JSONResponse(content=jsonable_encoder(results))
239
  except Exception as e:
 
223
  # Define a Pydantic model for the request payload
224
  class ChatRequest(BaseModel):
225
  q: str
226
+ history
227
  model: str = "gpt-4o-mini"
228
  proxy: Optional[str] = None
229
 
 
233
  try:
234
  with WEBS(proxy=request.proxy) as webs:
235
  chat_messages = []
236
+ if request.history:
237
+ chat_messages.extend(ast.literal_eval(str(request.history)))
238
  results = webs.chat(keywords=request.q, chat_messages = chat_messages, model=request.model)
239
  return JSONResponse(content=jsonable_encoder(results))
240
  except Exception as e: