迎宾接待机器人是企业第一印象的守护者——主动问候、识别访客、引导到会议室:
巡逻/等待 → 检测访客 → 识别(VIP/已知/新访客) →
个性化问候 → 登记/引导 → 会议室签到 → 返回巡逻import json, random, time
class ReceptionRobot:
"""迎宾接待机器人"""
def __init__(self, name="ReceptionBot-01"):
self.name = name
self.state = "patrolling"
self.known_guests = {
"张总": {"company": "ABC科技", "level": "VIP", "host": "李总监", "preferences": "靠窗会议室"},
"王经理": {"company": "XYZ集团", "level": "重要", "host": "赵副总", "preferences": "茶水间附近"},
"刘老师": {"company": "清华大学", "level": "普通", "host": "陈部长", "preferences": None},
}
self.visit_log = []
self.greeting_templates = {
"VIP": "尊敬的{name},欢迎来到我们公司!{host}正在{location}等您,请跟我来。",
"重要": "{name}您好!{host}让我来接您,请随我前往{location}。",
"普通": "您好{name},欢迎光临!我来为您办理访客登记。",
"unknown": "您好,欢迎光临!请问您找哪位?我可以帮您联系。",
}
def greet_guest(self, face_name=None):
"""迎接访客"""
if face_name and face_name in self.known_guests:
guest = self.known_guests[face_name]
level = guest["level"]
template = self.greeting_templates.get(level, self.greeting_templates["普通"])
location = guest.get("preferences") or "前台接待区"
message = template.format(name=face_name, host=guest["host"], location=location)
self.visit_log.append({"name": face_name, "company": guest["company"],
"level": level, "time": time.time()})
return {"greeting": message, "level": level, "host": guest["host"],
"action": "引导到会议室" if level in ["VIP","重要"] else "办理登记"}
else:
return {"greeting": self.greeting_templates["unknown"],
"level": "unknown", "host": None, "action": "询问来访目的"}
def register_guest(self, name, company, host_name, phone):
"""访客登记"""
self.known_guests[name] = {"company": company, "level": "普通",
"host": host_name, "phone": phone}
self.visit_log.append({"name": name, "company": company,
"level": "普通", "time": time.time()})
return {"registered": True, "message": f"{name},登记完成!我来联系{host_name}。"}
def guide_to_meeting_room(self, guest_name):
"""引导到会议室"""
guest = self.known_guests.get(guest_name, {})
pref = guest.get("preferences")
rooms = {
"靠窗会议室": {"floor": 3, "room": "会议室A", "capacity": 10},
"茶水间附近": {"floor": 3, "room": "会议室B", "capacity": 6},
"默认": {"floor": 5, "room": "接待室", "capacity": 8},
}
room = rooms.get(pref, rooms["默认"])
return {"room": room, "guide_message": f"请跟我来,{room['room']}在{room['floor']}楼。"}
robot = ReceptionRobot()
print("迎宾接待机器人模拟")
print("=" * 55)
# 模拟接待流程
visitors = [
("张总", True), # 已知VIP
("王经理", True), # 已知重要
("刘老师", True), # 已知普通
(None, False), # 未知访客
]
for name, known in visitors:
print(f"\n📋 访客: {name or '未知'}")
result = robot.greet_guest(name)
print(f" 问候: {result['greeting']}")
print(f" 等级: {result['level']}, 行动: {result['action']}")
if result["host"]:
guide = robot.guide_to_meeting_room(name)
print(f" 引导: {guide['guide_message']}")
# 新访客登记
print(f"\n📋 新访客登记:")
reg = robot.register_guest("孙博士", "北京大学", "周主任", "138****5678")
print(f" {reg['message']}")
print(f"\n📊 今日访客: {len(robot.visit_log)}人")
print("✅ 迎宾接待验证通过")
class ProactiveGreeting:
"""主动问候策略"""
def __init__(self):
self.greeting_triggers = {
"approach": {"distance": 3.0, "message": "您好,有什么可以帮您?"},
"eye_contact": {"duration": 2.0, "message": "您好,需要帮助吗?"},
"waiting": {"duration": 15.0, "message": "您好,请问在等人吗?我可以帮忙联系。"},
"lost": {"behavior": "原地张望", "message": "您好,看起来您在找地方?我可以帮您导航。"},
"carry_heavy": {"behavior": "搬重物", "message": "需要帮忙吗?我可以帮您指路到电梯。"},
}
self.cooldown = 30 # 同一人30秒内不重复问候
self.last_greeting = {}
def evaluate(self, person_id, distance, eye_contact_duration, behavior="normal", wait_time=0):
"""评估是否应该主动问候"""
import time
now = time.time()
# 冷却检查
if person_id in self.last_greeting:
if now - self.last_greeting[person_id] < self.cooldown:
return {"should_greet": False, "reason": "冷却中"}
# 触发条件检查
if behavior == "原地张望":
self.last_greeting[person_id] = now
return {"should_greet": True, "trigger": "lost",
"message": self.greeting_triggers["lost"]["message"]}
if wait_time > self.greeting_triggers["waiting"]["duration"]:
self.last_greeting[person_id] = now
return {"should_greet": True, "trigger": "waiting",
"message": self.greeting_triggers["waiting"]["message"]}
if distance < self.greeting_triggers["approach"]["distance"]:
self.last_greeting[person_id] = now
return {"should_greet": True, "trigger": "approach",
"message": self.greeting_triggers["approach"]["message"]}
if eye_contact_duration > self.greeting_triggers["eye_contact"]["duration"]:
self.last_greeting[person_id] = now
return {"should_greet": True, "trigger": "eye_contact",
"message": self.greeting_triggers["eye_contact"]["message"]}
return {"should_greet": False, "reason": "无触发条件"}
pg = ProactiveGreeting()
print("主动问候策略")
print("=" * 55)
scenarios = [
("P001", 2.0, 0, "normal", 0),
("P002", 5.0, 3.0, "normal", 0),
("P003", 8.0, 0, "原地张望", 0),
("P004", 10.0, 0, "normal", 20),
("P001", 2.0, 0, "normal", 0), # 冷却测试
]
for pid, dist, eye, behavior, wait in scenarios:
result = pg.evaluate(pid, dist, eye, behavior, wait)
if result["should_greet"]:
print(f" ✅ {pid}: 触发={result['trigger']} → {result['message']}")
else:
print(f" ❌ {pid}: {result['reason']}")
print("\n✅ 主动问候验证通过")
class ConferenceRoomManager:
"""会议室管理"""
def __init__(self):
self.rooms = {
"A": {"name": "会议室A", "floor": 3, "capacity": 10, "equipment": ["投影","白板","视频会议"], "status": "free"},
"B": {"name": "会议室B", "floor": 3, "capacity": 6, "equipment": ["投影","白板"], "status": "occupied"},
"C": {"name": "会议室C", "floor": 5, "capacity": 20, "equipment": ["投影","白板","视频会议","录音"], "status": "free"},
"VIP": {"name": "VIP接待室", "floor": 5, "capacity": 8, "equipment": ["投影","视频会议","茶水"], "status": "reserved"},
}
self.reservations = []
def find_available(self, capacity=1, equipment=None, floor=None):
"""查找可用会议室"""
results = []
for rid, room in self.rooms.items():
if room["status"] != "free":
continue
if room["capacity"] < capacity:
continue
if floor and room["floor"] != floor:
continue
if equipment:
if not all(eq in room["equipment"] for eq in equipment):
continue
results.append(room)
return results
def reserve(self, room_id, guest_name, duration=60):
"""预约会议室"""
room = self.rooms.get(room_id)
if not room or room["status"] != "free":
return {"success": False, "reason": "会议室不可用"}
room["status"] = "reserved"
self.reservations.append({"room": room_id, "guest": guest_name, "duration": duration})
return {"success": True, "room": room["name"], "floor": room["floor"]}
def check_in(self, room_id):
"""签到"""
room = self.rooms.get(room_id)
if room:
room["status"] = "occupied"
return {"success": True}
return {"success": False}
crm = ConferenceRoomManager()
print("会议室管理")
print("=" * 55)
print("\n📋 查找可容纳8人+视频会议的会议室:")
available = crm.find_available(capacity=8, equipment=["视频会议"])
for room in available:
print(f" {room['name']} ({room['floor']}F, 容纳{room['capacity']}人)")
# 预约
result = crm.reserve("A", "张总", 90)
print(f"\n预约: {'✅ ' + result['room'] + ' ' + str(result['floor']) + 'F' if result['success'] else '❌ ' + result['reason']}")
# 签到
crm.check_in("A")
print(f"会议室A签到: ✅")
print(f"\n📋 当前会议室状态:")
for rid, room in crm.rooms.items():
status_icon = {"free":"🟢","occupied":"🔴","reserved":"🟡"}.get(room["status"],"⚪")
print(f" {status_icon} {room['name']}: {room['status']}")
print("\n✅ 会议室管理验证通过")
| 要点 | 描述 | 实现 |
|---|---|---|
| 主动服务 | 不等询问就提供帮助 | 行为检测+触发 |
| 个性化 | 记住常客偏好 | 人脸识别+画像 |
| 效率 | 快速完成接待 | 预分配会议室 |
| 分寸感 | 不过度打扰 | 冷却期+适度距离 |
实现多访客并行接待:同时处理2位访客,一位正在登记,一位正在等待。
设计访客满意度调查:访客离开时自动推送简短满意度评价。
实现日程联动:与企业日历系统对接,根据会议安排预判访客到达。