srilakshu012456 commited on
Commit
19b804e
·
verified ·
1 Parent(s): dc8982d

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -6
main.py CHANGED
@@ -316,7 +316,7 @@ async def chat_with_ai(input_data: ChatInput):
316
  try:
317
  msg_norm = (input_data.user_message or "").lower().strip()
318
 
319
- # Yes/No handlers
320
  if msg_norm in ("yes", "y", "sure", "ok", "okay"):
321
  return {
322
  "bot_response": "Great! Tell me what you'd like to do next — check another ticket, create an incident, or describe your issue.",
@@ -335,7 +335,7 @@ async def chat_with_ai(input_data: ChatInput):
335
  "debug": {"intent": "end_conversation"},
336
  }
337
 
338
- # Resolution ack (auto incident + mark Resolved)
339
  is_llm_resolved = _classify_resolution_llm(input_data.user_message)
340
  if _has_negation_resolved(msg_norm):
341
  is_llm_resolved = False
@@ -463,7 +463,7 @@ async def chat_with_ai(input_data: ChatInput):
463
  except Exception as e:
464
  raise HTTPException(status_code=500, detail=safe_str(e))
465
 
466
- # Generic opener / very short
467
  if len(msg_norm.split()) <= 2 or any(p in msg_norm for p in ("issue", "problem", "help", "support")):
468
  return {
469
  "bot_response": _build_clarifying_message(),
@@ -548,11 +548,9 @@ async def chat_with_ai(input_data: ChatInput):
548
  "debug": {"intent": "errors_no_context"},
549
  }
550
 
551
- # Build LLM prompt (mirror language)
552
  language_hint = _detect_language_hint(input_data.user_message)
553
  lang_line = f"Respond in {language_hint}." if language_hint else "Respond in a clear, polite tone."
554
-
555
- # Steps → no LLM; Errors → LLM paraphrase
556
  use_gemini = (detected_intent == "errors")
557
  enhanced_prompt = f"""You are a helpful support assistant. Rewrite the provided context ONLY into clear, user-friendly guidance.
558
  - Do not add any information that is not present in the context.
 
316
  try:
317
  msg_norm = (input_data.user_message or "").lower().strip()
318
 
319
+ # Yes/No
320
  if msg_norm in ("yes", "y", "sure", "ok", "okay"):
321
  return {
322
  "bot_response": "Great! Tell me what you'd like to do next — check another ticket, create an incident, or describe your issue.",
 
335
  "debug": {"intent": "end_conversation"},
336
  }
337
 
338
+ # Resolution ack auto incident + resolve
339
  is_llm_resolved = _classify_resolution_llm(input_data.user_message)
340
  if _has_negation_resolved(msg_norm):
341
  is_llm_resolved = False
 
463
  except Exception as e:
464
  raise HTTPException(status_code=500, detail=safe_str(e))
465
 
466
+ # Generic opener
467
  if len(msg_norm.split()) <= 2 or any(p in msg_norm for p in ("issue", "problem", "help", "support")):
468
  return {
469
  "bot_response": _build_clarifying_message(),
 
548
  "debug": {"intent": "errors_no_context"},
549
  }
550
 
551
+ # Build LLM prompt
552
  language_hint = _detect_language_hint(input_data.user_message)
553
  lang_line = f"Respond in {language_hint}." if language_hint else "Respond in a clear, polite tone."
 
 
554
  use_gemini = (detected_intent == "errors")
555
  enhanced_prompt = f"""You are a helpful support assistant. Rewrite the provided context ONLY into clear, user-friendly guidance.
556
  - Do not add any information that is not present in the context.