fixing chatbot
This commit is contained in:
parent
90ec729b40
commit
dcb77af04b
Binary file not shown.
@ -214,7 +214,7 @@ def await_response(ai_request_id: Any, options: Optional[Dict[str, Any]] = None)
|
||||
data = status_resp.get("data") or {}
|
||||
if isinstance(data, dict):
|
||||
status_value = data.get("status")
|
||||
if status_value == "success":
|
||||
if status_value in ["success", "completed"]:
|
||||
return {
|
||||
"success": True,
|
||||
"status": 200,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -855,6 +855,9 @@ def chatbot(request):
|
||||
else:
|
||||
system_prompt += " The user is currently browsing in English."
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.info(f'Chatbot request: {user_message}')
|
||||
response = LocalAIApi.create_response({
|
||||
"input": [
|
||||
{"role": "system", "content": system_prompt},
|
||||
@ -862,6 +865,7 @@ def chatbot(request):
|
||||
]
|
||||
})
|
||||
|
||||
logger.info(f'Chatbot response: {response}')
|
||||
if response.get("success"):
|
||||
text = LocalAIApi.extract_text(response)
|
||||
return JsonResponse({"success": True, "response": text})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user