Import ClientFlow production v4928.1.5.132.4
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import hashlib
|
||||
import re
|
||||
from app.action_decider import decide_action
|
||||
from app.action_mapper import map_action_decision
|
||||
from app.config import settings
|
||||
@@ -61,6 +63,9 @@ async def analyze(request: AnalyzeRequest, raw_event_id: str | None = None) -> A
|
||||
raw_event_id=raw_event_id,
|
||||
)
|
||||
|
||||
normalized_message_for_idem = re.sub(r"\s+", " ", str(request.last_customer_message or "").strip().casefold())
|
||||
message_fingerprint = hashlib.sha256(normalized_message_for_idem.encode("utf-8")).hexdigest() if normalized_message_for_idem else ""
|
||||
|
||||
task_id = create_task_from_action_result(
|
||||
action_result=action_result,
|
||||
action_run_id=action_run_id,
|
||||
@@ -72,8 +77,15 @@ async def analyze(request: AnalyzeRequest, raw_event_id: str | None = None) -> A
|
||||
source_event_id=message_id,
|
||||
metadata={
|
||||
"created_from_analyzer": True,
|
||||
"content_fingerprint": message_fingerprint,
|
||||
"normalized_message_preview": normalized_message_for_idem[:240],
|
||||
"needs_review": needs_review,
|
||||
"decision_source": decision_source,
|
||||
"llm_customer_intent": getattr(decision, "customer_intent", ""),
|
||||
"llm_evidence": getattr(decision, "evidence", ""),
|
||||
"llm_history_used": getattr(decision, "history_used", False),
|
||||
"payment_intent": getattr(decision, "payment_intent", None),
|
||||
"llm_confidence": getattr(decision, "confidence", 0.0),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user