加入日志管理
This commit is contained in:
@@ -136,28 +136,28 @@ def _classify_dialog_rules(
|
||||
)
|
||||
|
||||
if _SQL_OR_QUERY_HINT_RE.search(t):
|
||||
logger.debug("[dialog] intent=text2sql (query/business hint)")
|
||||
logger.info("[dialog] intent=text2sql (query/business hint) preview=%r", user_text[:120])
|
||||
return DialogClassifyResult(DialogIntent.TEXT2SQL, None)
|
||||
|
||||
core = _strip_trailing_punct(t)
|
||||
if core.casefold() in _CHITCHAT_KEYS:
|
||||
logger.debug("[dialog] intent=conversation (chitchat phrase)")
|
||||
logger.info("[dialog] intent=conversation (chitchat phrase) core=%r", core)
|
||||
return DialogClassifyResult(
|
||||
DialogIntent.CONVERSATION, reply_suggestion=DEFAULT_CONVERSATION_REPLY
|
||||
)
|
||||
|
||||
if _META_QUESTION_RE.search(t):
|
||||
logger.debug("[dialog] intent=conversation (meta question)")
|
||||
logger.info("[dialog] intent=conversation (meta question) preview=%r", user_text[:120])
|
||||
return DialogClassifyResult(
|
||||
DialogIntent.CONVERSATION,
|
||||
reply_suggestion=DEFAULT_CONVERSATION_REPLY,
|
||||
)
|
||||
|
||||
if last_turn_was_data_query:
|
||||
logger.debug("[dialog] intent=text2sql (follow-up after data query)")
|
||||
logger.info("[dialog] intent=text2sql (follow-up after data query) preview=%r", user_text[:120])
|
||||
return DialogClassifyResult(DialogIntent.TEXT2SQL, None)
|
||||
|
||||
logger.debug("[dialog] intent=text2sql (default)")
|
||||
logger.info("[dialog] intent=text2sql (default rules) preview=%r", user_text[:120])
|
||||
return DialogClassifyResult(DialogIntent.TEXT2SQL, None)
|
||||
|
||||
|
||||
@@ -208,11 +208,15 @@ def _classify_dialog_llm(
|
||||
"若上一版 SQL 或结果不符合预期,请具体说明:希望增加/修改哪些条件、"
|
||||
"时间范围或统计维度,以便重新生成。"
|
||||
)
|
||||
logger.info("[dialog] intent=conversation (LLM)")
|
||||
logger.info(
|
||||
"[dialog] intent=conversation (LLM) reply_chars=%s reply_preview=%r",
|
||||
len(reply),
|
||||
reply[:300] + ("…" if len(reply) > 300 else ""),
|
||||
)
|
||||
return DialogClassifyResult(DialogIntent.CONVERSATION, reply_suggestion=reply)
|
||||
|
||||
if intent_s == "text2sql":
|
||||
logger.info("[dialog] intent=text2sql (LLM)")
|
||||
logger.info("[dialog] intent=text2sql (LLM) user_preview=%r", user_text[:200])
|
||||
return DialogClassifyResult(DialogIntent.TEXT2SQL, None)
|
||||
|
||||
raise ValueError(f"unexpected intent field: {intent_s!r}")
|
||||
@@ -254,18 +258,18 @@ def classify_dialog(
|
||||
)
|
||||
|
||||
if _SQL_OR_QUERY_HINT_RE.search(t):
|
||||
logger.debug("[dialog] intent=text2sql (query/business hint, hybrid fast)")
|
||||
logger.info("[dialog] intent=text2sql (hybrid fast: query hint) preview=%r", user_text[:120])
|
||||
return DialogClassifyResult(DialogIntent.TEXT2SQL, None)
|
||||
|
||||
core = _strip_trailing_punct(t)
|
||||
if core.casefold() in _CHITCHAT_KEYS:
|
||||
logger.debug("[dialog] intent=conversation (chitchat phrase, hybrid fast)")
|
||||
logger.info("[dialog] intent=conversation (hybrid fast: chitchat) core=%r", core)
|
||||
return DialogClassifyResult(
|
||||
DialogIntent.CONVERSATION, reply_suggestion=DEFAULT_CONVERSATION_REPLY
|
||||
)
|
||||
|
||||
if _META_QUESTION_RE.search(t):
|
||||
logger.debug("[dialog] intent=conversation (meta question, hybrid fast)")
|
||||
logger.info("[dialog] intent=conversation (hybrid fast: meta) preview=%r", user_text[:120])
|
||||
return DialogClassifyResult(
|
||||
DialogIntent.CONVERSATION,
|
||||
reply_suggestion=DEFAULT_CONVERSATION_REPLY,
|
||||
|
||||
Reference in New Issue
Block a user