ciyidogan commited on
Commit
0a42fdb
·
verified ·
1 Parent(s): f424c9f

Update chat_handler.py

Browse files
Files changed (1) hide show
  1. chat_handler.py +6 -0
chat_handler.py CHANGED
@@ -143,6 +143,12 @@ async def chat(body: ChatBody, x_session_id: str = Header(...)):
143
  user_msg
144
  )
145
 
 
 
 
 
 
 
146
  # small-talk yolu
147
  if not intent_raw.startswith("#DETECTED_INTENT:"):
148
  clean = _trim_smalltalk(intent_raw)
 
143
  user_msg
144
  )
145
 
146
+ # ─ intent_raw geldi ─
147
+ if intent_raw.strip() == "":
148
+ fallback = "Üzgünüm, şu anda isteğinizi işlemekte zorlanıyorum. Lütfen mesajınızı tekrar edebilir misiniz?"
149
+ s.history.append({"role": "assistant", "content": fallback})
150
+ return ChatResponse(session_id=s.id, answer=fallback)
151
+
152
  # small-talk yolu
153
  if not intent_raw.startswith("#DETECTED_INTENT:"):
154
  clean = _trim_smalltalk(intent_raw)