This commit is contained in:
2026-03-06 12:44:57 +08:00
parent fa61b11b02
commit 006b035de4
132 changed files with 1361 additions and 17400 deletions

42
scripts/check_garbled.py Normal file
View File

@@ -0,0 +1,42 @@
import pymysql
import re
conn = pymysql.connect(
host='1.12.50.92',
port=3306,
user='ai_cs_user',
password='Zuowei1216',
database='ai_cs',
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor
)
cur = conn.cursor()
# 查昨晚18:00到今早的AI回复
cur.execute("""
SELECT customer_name, message, timestamp FROM chat_logs
WHERE timestamp >= '2026-03-05 18:00:00' AND timestamp <= '2026-03-06 09:00:00'
AND direction = 'out'
ORDER BY timestamp
""")
rows = cur.fetchall()
print(f"{len(rows)} 条AI回复检查乱码...")
for r in rows:
msg = r['message'] or ''
# 检查是否有乱码特征
has_code = any([
re.search(r'\[\]<\|', msg),
re.search(r'<\|[A-Za-z]+\|>', msg),
'Function' in msg,
'```' in msg,
re.search(r'\{["\']', msg), # JSON格式
re.search(r'\\n', msg), # 转义字符
])
if has_code:
print(f"\n[{r['timestamp']}] {r['customer_name']}:")
print(f" {msg[:150]}")
conn.close()
print("\n检查完成")