Spaces:
Running
Running
Update app.py
Browse files
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
|
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 |
-
|
|
|
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:
|