feat:查询会议室,需要添加到上下文中,增加判断逻辑
This commit is contained in:
@@ -38,7 +38,7 @@ def is_json(myjson):
|
||||
json_object = json.loads(myjson)
|
||||
return True
|
||||
except ValueError:
|
||||
print("json检查未通过")
|
||||
logger.warning("json检查未通过")
|
||||
return False
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ def query_room_type(params: dict) -> str:
|
||||
pageNum
|
||||
pageSize
|
||||
"""
|
||||
print("当前params : {0}".format(params))
|
||||
logger.info("当前params : {0}".format(params))
|
||||
tenant_id = params.get('tenantId', None)
|
||||
if not tenant_id:
|
||||
raise Exception("tenantId 不能为空")
|
||||
@@ -103,18 +103,20 @@ def query_room_info(data: dict, params: dict) -> str:
|
||||
if data.get('Region') and data.get('Region') != 'None':
|
||||
region = data.get('Region')
|
||||
for b in result:
|
||||
if (region in b.get('name', 'default') or region in b.get('typeName', 'default')) and b.get('capacity',0) >= data.get('capacity', 0):
|
||||
if (region in b.get('name', 'default') or region in b.get('typeName', 'default')) and b.get('capacity',
|
||||
0) >= data.get(
|
||||
'capacity', 0):
|
||||
new_list.append(b)
|
||||
if len(new_list) >= DEFAULT_QUERY_SIZE:
|
||||
print("regin--------------- {0}".format(new_list))
|
||||
logger.debug("regin--------------- {0}".format(new_list))
|
||||
return json.dumps(new_list, ensure_ascii=False)
|
||||
else:
|
||||
for b in result:
|
||||
if b.get('capacity',0) >= data.get('capacity', 0):
|
||||
if b.get('capacity', 0) >= data.get('capacity', 0):
|
||||
new_list.append(b)
|
||||
if len(new_list) >= DEFAULT_QUERY_SIZE:
|
||||
return json.dumps(new_list, ensure_ascii=False)
|
||||
print("no regin-------------- {0}".format(new_list))
|
||||
logger.debug("no regin-------------- {0}".format(new_list))
|
||||
return json.dumps(new_list, ensure_ascii=False)
|
||||
|
||||
|
||||
@@ -173,7 +175,7 @@ def query_booking_info(params: dict) -> str:
|
||||
params['endTimeStamp'] = get_time_info(10)
|
||||
meeting_room = getinfo.query_meetingbooking_info(params)
|
||||
result = params_filter.filter_state(meeting_room)
|
||||
print(result)
|
||||
#print(result)
|
||||
return json.dumps(result)
|
||||
|
||||
|
||||
@@ -261,7 +263,7 @@ def edit_meeting(params: dict, data: dict):
|
||||
|
||||
result = getinfo.edit_meeting_info(params, data)
|
||||
content = json.loads(json.dumps(result))
|
||||
print("content is :", content)
|
||||
logger.info("content is :", content)
|
||||
return str(content)
|
||||
|
||||
|
||||
@@ -286,7 +288,7 @@ def cancel_meeting(params: dict) -> str:
|
||||
params['access_token'] = access_token
|
||||
book_meeting = getinfo.cancel_meeting(params)
|
||||
content = json.loads(json.dumps(book_meeting))
|
||||
print("content is :", content)
|
||||
logger.info(f"cancel_meeting content is :{content}" )
|
||||
return str(content)
|
||||
|
||||
|
||||
@@ -469,7 +471,7 @@ def add_message_async(manager: DialogManager, session_id: str, role: str, conten
|
||||
'''
|
||||
|
||||
|
||||
def process_edit_room_meeting(data, params) -> str:
|
||||
def process_edit_room_meeting(data, params) -> tuple:
|
||||
new_data = {
|
||||
"subject": "会议主题",
|
||||
"id": data["meetingId"],
|
||||
@@ -497,7 +499,7 @@ def process_edit_room_meeting(data, params) -> str:
|
||||
{result}
|
||||
请帮用户解析修改预订会议的结果,并根据结果给予用户相应自然语言反馈
|
||||
'''
|
||||
return book_promot
|
||||
return False, book_promot
|
||||
|
||||
|
||||
'''
|
||||
@@ -505,17 +507,17 @@ def process_edit_room_meeting(data, params) -> str:
|
||||
'''
|
||||
|
||||
|
||||
def process_book_room(data, params) -> str:
|
||||
def process_book_room(data, params) -> tuple:
|
||||
result = book_meeting(data=data, params=params)
|
||||
book_promot = f'''
|
||||
系统调用API预订该会议室的结果如下:
|
||||
{result}
|
||||
请帮用户解析预订会议室的结果,如果成功则需要返回会议ID,并根据结果给予用户相应自然语言反馈
|
||||
'''
|
||||
return book_promot
|
||||
return False, book_promot
|
||||
|
||||
|
||||
def process_query_room(data, params) -> str:
|
||||
def process_query_room(data, params) -> tuple:
|
||||
logger.info("current data is :{}".format(data))
|
||||
result = query_room_info(data=data, params=params)
|
||||
logger.info("--process_query_room data is :{}".format(result))
|
||||
@@ -524,7 +526,7 @@ def process_query_room(data, params) -> str:
|
||||
{result}
|
||||
解析用户预订需求(时间、人数、设备要求等),name或typeName字段里面可能包含了区域信息,isApprove 代表是否需要审批,注意根据地理信息过滤,给用户推荐合适会议室,请按照自然语言描述返回。
|
||||
'''
|
||||
return book_promot
|
||||
return True, book_promot
|
||||
|
||||
|
||||
'''
|
||||
@@ -532,14 +534,14 @@ def process_query_room(data, params) -> str:
|
||||
'''
|
||||
|
||||
|
||||
def process_query_book_room(**kwargs) -> str:
|
||||
def process_query_book_room(**kwargs) -> tuple:
|
||||
result = query_booking_info(params=kwargs['params'])
|
||||
book_promot = f'''
|
||||
系统调用API查询当前租户下已经预订的会议室的结果如下:
|
||||
{result}
|
||||
请帮用户解析已有的预订会议室的结果,请解析所有的会议预订数据,不要省略且结果中需要返回会议ID,并根据结果给予用户相应自然语言反馈
|
||||
'''
|
||||
return book_promot
|
||||
return False, book_promot
|
||||
|
||||
|
||||
'''
|
||||
@@ -547,7 +549,7 @@ def process_query_book_room(**kwargs) -> str:
|
||||
'''
|
||||
|
||||
|
||||
def process_cancel_room_meeting(data, params) -> str:
|
||||
def process_cancel_room_meeting(data, params) -> tuple:
|
||||
meetingId = data.get("meetingId", None)
|
||||
if meetingId:
|
||||
params["meetingId"] = meetingId
|
||||
@@ -567,7 +569,7 @@ def process_cancel_room_meeting(data, params) -> str:
|
||||
{dic_data}
|
||||
请帮用户解析取消预订会议室的结果,并根据结果给予用户相应自然语言反馈
|
||||
'''
|
||||
return book_promot
|
||||
return False, book_promot
|
||||
|
||||
|
||||
'''
|
||||
@@ -616,9 +618,10 @@ def process_chat(user_id: str, user_input: str, params: dict):
|
||||
if func:
|
||||
# 触发函数调用------
|
||||
logger.info(f"触发系统函数调用==>:{fun_name}")
|
||||
book_promot = func(data=data, params=params)
|
||||
add_to_content, book_promot = func(data=data, params=params)
|
||||
if add_to_content:
|
||||
dialog_manager.add_message(user_id, 'user', book_promot)
|
||||
logger.info("test point book_promot => {0} ".format(book_promot))
|
||||
# dialog_manager.add_message(user_id, 'user', book_promot)
|
||||
|
||||
else:
|
||||
book_promot = f'''
|
||||
|
||||
Reference in New Issue
Block a user