├── agent ├── __init__.py ├── apply_for_package.py ├── apply_leave.py ├── travel.py ├── google_search.py ├── oil_price.py ├── weather.py ├── news.py ├── exchange_rate.py └── stock.py ├── scene_processor ├── scene_processor.py └── impl │ └── common_processor.py ├── utils ├── file_utils.py ├── date_utils.py ├── environ.py ├── prompt_utils.py ├── data_format_utils.py ├── function_api.py ├── logger.py └── helpers.py ├── config └── __init__.py ├── README.md ├── LICENSE ├── app.py ├── Agent_data ├── current_scene.json ├── first_important.json ├── 1m441f9d6n6r.json ├── 4fjaugpx24yk.json ├── 9731dcun3se4.json ├── 97644fckcdfg.json ├── esrnx8ufjcpt.json ├── fz3kg6c6fgh7.json ├── hfe4wpxudikm.json ├── hv7klpt2pl8o.json ├── j7etwzbe4etc.json ├── m5m8boi5wja3.json ├── ng8lq0zwuknx.json ├── nmcuex5ec5sf.json ├── p313lptjb4ig.json ├── qwlzlgzi8j36.json ├── rsrei0thatui.json ├── vb4g1riov6ie.json ├── wyfkbav8853s.json ├── zqbe75kgwa1u.json ├── 1yxmqd3a4ju3.json ├── 7mf8xbvo118e.json ├── 82cff22leh46.json ├── dynu9hdrq9b3.json ├── 6vdxuo7nnmpd.json ├── 7off0xzwb256.json ├── ww8c82xuj207.json ├── n4doq5hc2qbx.json ├── zqjn18ic8xgh.json ├── 5lbrmi4knjq8.json ├── gmosiv5vb3e5.json ├── irnm5b0buj2b.json ├── jq2l508gsc07.json ├── ty6cbbf1syfd.json ├── yw379w6o8w9k.json ├── 33tsm183yonj.json ├── cwy4a8itvhwu.json ├── l0l2hfwg2hp1.json ├── 1kwnxc9al310.json ├── s1tna2d37ydt.json ├── 7s1frwpzker2.json ├── 9viu4i0b939u.json └── p5pt7ho53qoc.json ├── scene_config ├── scene_prompts.py └── scene_templates.json └── models └── chatbot_model.py /agent/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | # 需要用户二次确认 3 | is_user_comfirm = [] 4 | 5 | is_user_comfirm.append("办理套餐") 6 | is_user_comfirm.append("请假申请") 7 | -------------------------------------------------------------------------------- /agent/apply_for_package.py: -------------------------------------------------------------------------------- 1 | from utils.helpers import send_message,format_name_value_for_logging 2 | 3 | def apply_for_package_API(slot,scene_name,user_input): 4 | return f'尊敬的{slot[0]["value"]}先生,您好!感谢您选择我们的服务\n' + f'您的手机号:{slot[1]["value"]}的{slot[3]["value"]}办理成功!\n稍后会给您发送短信,请注意查收。请问还有什么需要我帮助的吗?' -------------------------------------------------------------------------------- /agent/apply_leave.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | def Call_leave_API(slot,scene_name,user_input): 4 | message = f'尊敬的XXX先生,您好!您的请假信息如下:\n主管:{slot[0]["value"]}\n申请理由:{slot[1]["value"]}\n请假类别:{slot[2]["value"]}\n开始日期:{slot[3]["value"]}\n结束日期:{slot[4]["value"]}' 5 | message += "\n您的请假信息申请成功,等待主管审批中~" 6 | return message 7 | 8 | -------------------------------------------------------------------------------- /scene_processor/scene_processor.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | class SceneProcessor: 3 | def process(self, user_input, context): 4 | """ 5 | 处理用户输入和上下文,返回处理结果 6 | :param user_input: 用户的输入 7 | :param context: 对话的上下文 8 | :return: 处理结果 9 | """ 10 | raise NotImplementedError 11 | -------------------------------------------------------------------------------- /utils/file_utils.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | import json 3 | import logging 4 | 5 | 6 | def load_file_to_obj(filepath): 7 | try: 8 | with open(filepath, 'r', encoding='utf-8') as file: 9 | return json.load(file) 10 | except (FileNotFoundError, json.JSONDecodeError) as e: 11 | logging.error(f"Error loading scene prompts: {e}") 12 | return {} 13 | -------------------------------------------------------------------------------- /config/__init__.py: -------------------------------------------------------------------------------- 1 | # FUNCTION API ------------------------------------------------------------------------ 2 | 3 | Weather_Url = 'https://restapi.amap.com/v3/weather/weatherInfo?parameters' 4 | Weather_Key = "" 5 | 6 | Email_Key = "" 7 | Email_sender = "" 8 | 9 | Travel_Key = "" 10 | Travel_Url = "http://apis.juhe.cn/fapigx/scenic/query" 11 | 12 | HistoryDay_Key = "" 13 | HistoryDay_Url = "http://v.juhe.cn/todayOnhistory/queryEvent.php" 14 | 15 | delivery_Key = "" 16 | delivery_Url = "http://v.juhe.cn/exp/index" 17 | 18 | News_Key = "" 19 | stock_Key = "" 20 | 21 | google_key = "" 22 | 23 | google_key_plus = "" 24 | 25 | google_engines_key = "" 26 | -------------------------------------------------------------------------------- /utils/date_utils.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | from datetime import datetime, timedelta 3 | 4 | 5 | def get_current_date(): 6 | current_date = datetime.now() 7 | return current_date.strftime("%Y-%m-%d") 8 | 9 | 10 | def get_current_and_future_dates(days=7): 11 | """ 12 | 计算当前日期和未来指定天数后的日期。 13 | 14 | :param days: 从当前日期起的天数,默认为7天。 15 | :return: 当前日期和未来日期的字符串(格式:YYYY-MM-DD)。 16 | 17 | # 使用示例 18 | # current_date, future_date = get_current_and_future_dates() 19 | # print("当前日期:", current_date) 20 | # print("7天后日期:", future_date) 21 | """ 22 | current_date = datetime.now() 23 | future_date = current_date + timedelta(days=days) 24 | 25 | return current_date.strftime("%Y-%m-%d"), future_date.strftime("%Y-%m-%d") 26 | 27 | 28 | -------------------------------------------------------------------------------- /utils/environ.py: -------------------------------------------------------------------------------- 1 | import os 2 | import config 3 | 4 | # 根据环境进行修改,大部分情况不需要有这些 5 | def set_proxy_environ(): 6 | 7 | os.environ['http_proxy']="http://127.0.0.1:8080" 8 | 9 | os.environ['https_proxy']="http://127.0.0.1:8080" 10 | 11 | os.environ['REQUESTS_CA_BUNDLE']="xxxxxxxxxxxxxxxxxxxxxxxxxxx.crt" 12 | 13 | def set_Google_environ(): 14 | os.environ['http_proxy']="http://127.0.0.1:8070" 15 | 16 | os.environ['https_proxy']="http://127.0.0.1:8070" 17 | 18 | os.environ['REQUESTS_CA_BUNDLE']= '' 19 | 20 | os.environ['SERPAPI_API_KEY'] = config.google_key 21 | 22 | 23 | def set_None_environ(): 24 | 25 | os.environ['http_proxy']= '' 26 | 27 | os.environ['https_proxy']= '' 28 | 29 | os.environ['REQUESTS_CA_BUNDLE']= '' 30 | -------------------------------------------------------------------------------- /utils/prompt_utils.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | import json 3 | 4 | from scene_config import scene_prompts 5 | from utils.date_utils import get_current_date 6 | from utils.helpers import get_slot_query_user_json, get_slot_update_json 7 | 8 | 9 | def get_slot_update_message(scene_name,dynamic_example, slot_template, user_input): 10 | message = scene_prompts.slot_update.format(scene_name, get_current_date(), dynamic_example, json.dumps(get_slot_update_json(slot_template), ensure_ascii=False), user_input) 11 | print(message) 12 | return message 13 | 14 | 15 | def get_slot_query_user_message(scene_name, slot, user_input): 16 | message = scene_prompts.slot_query_user.format(scene_name, json.dumps(get_slot_query_user_json(slot), ensure_ascii=False), user_input) 17 | print(message) 18 | return message 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 概述 ⭐ 2 | 这是一个基于LLM的多轮对话Agent,旨在提升用户体验,通过智能交互判断是否需要调用Agent Tools。 3 | 4 | ### 特点 5 | - **用户交互**:允许用户与大型语言模型(LLM)进行流畅的对话交互。 6 | - **工具调用**:智能判断对话流程中是否需要使用特定的Agent Tools。 7 | - **上下文关联**:能够识别用户输入是否与上一次的Agent场景相关联。 8 | 9 | ### 设计理念 10 | - **多用户支持**:从设计之初就考虑到多用户使用场景。 11 | - **持久化存储**:所有用户的Agent信息持久化存储在`Agent_data`文件中。 12 | 13 | ### 使用指南 🚀 14 | 1. **启动对话**:用户启动与LLM的对话交互。 15 | 2. **场景判断**:Agent判断当前对话是否与历史场景相关。 16 | 3. **工具辅助**:根据对话内容,Agent智能推荐使用Agent Tools。 17 | 4. **信息继承**:用户结束对话后,Agent信息存储,以便下次继续使用。 18 | 5. **数据清除**:如果用户不希望继承历史信息,可以选择清空`Agent_data`文件。 19 | 20 | ### 技术细节 21 | - **存储**:使用JSON或类似格式的文件来存储`Agent_data`。 22 | 23 | ### 注意 👋 24 | - `Agent_data` 数据基于FastGPT中的chatId命名的,保证窗口与窗口之间、用户与用户之间Agent互不干扰。 25 | - `agent`文件中很多都是直接调用API,例如`Google`、`Gaode Weather`。 `apply_for_package`、`apply_leave`是自定义的Agent。 26 | - 通过加载`scene_templates.json`文件中的Tools让大模型自己挑选,所以根据所需更改json文件数据。 27 | - `config`文件中存放着各种API的KEY,可自行添加。 28 | 29 | ⭐ ⭐ ⭐ 30 | -------------------------------------------------------------------------------- /agent/travel.py: -------------------------------------------------------------------------------- 1 | import config 2 | import requests 3 | from utils.helpers import send_message 4 | import urllib 5 | from utils.data_format_utils import clean_content 6 | import scene_config.scene_prompts 7 | slot_answer = scene_config.scene_prompts.slot_api_answer 8 | 9 | 10 | # 查询景区的信息API 11 | def Call_Travel_API(travel_name,scene_name,user_input): 12 | 13 | headers = {'Content-Type': 'application/x-www-form-urlencoded'} 14 | params = { 15 | 'key': config.Travel_Key, 16 | 'word': travel_name, 17 | 'num': 1, # 返回数量,根据需求填写 18 | } 19 | response = requests.get(url=config.Travel_Url,headers=headers,params=params) 20 | 21 | if response.status_code == 200: 22 | data = response.json() 23 | if data["error_code"] == 0: 24 | content = data["result"]["list"][0]["content"] 25 | 26 | prompt = slot_answer.format(scene_name,content,user_input) 27 | 28 | return send_message(prompt,user_input) 29 | else: 30 | prompt = slot_answer.format(scene_name,"没有找到这个景区",user_input) 31 | 32 | return send_message(prompt,user_input) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 MingGuang Tian 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | import json 3 | from models.chatbot_model import ChatbotModel 4 | from utils.helpers import load_all_scene_configs 5 | from flask import Flask, request, jsonify, send_file 6 | from utils import logger 7 | 8 | app = Flask(__name__) 9 | 10 | 11 | 12 | 13 | @app.route('/function', methods=['POST']) 14 | def function(): 15 | json_data = request.get_data() 16 | data = json.loads(json_data) 17 | 18 | chatId = data.get('chatId') 19 | 20 | data = data["data"] 21 | question = data.get('question') 22 | AI_history = data.get('history') 23 | 24 | 25 | # 实例化ChatbotModel 26 | chatbot_model = ChatbotModel(load_all_scene_configs(chatId)) 27 | 28 | if not question: 29 | return jsonify({"error": "No question provided"}), 400 30 | 31 | response = chatbot_model.process_multi_question(question,AI_history[-1]['value'] if AI_history else "",chatId) 32 | 33 | if response == question: 34 | return jsonify({"no_function":True, "question":question}) 35 | else: 36 | return jsonify({"use_function":True,"answer": response}) 37 | 38 | 39 | 40 | if __name__ == '__main__': 41 | app.run(host='127.0.0.1',port=7000) 42 | -------------------------------------------------------------------------------- /utils/data_format_utils.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | import re 3 | 4 | 5 | def extract_float(s): 6 | # 提取字符串中的第一个浮点型数字 7 | float_pattern = r'-?\d+(?:\.\d+)?' 8 | found = re.findall(float_pattern, s) 9 | if not found: # 如果没有找到任何数字 10 | return 0.0 11 | else: 12 | return [float(num) for num in found][0] 13 | 14 | 15 | def extract_floats(s): 16 | # 提取字符串中的所有浮点型数字 17 | float_pattern = r'-?\d+(?:\.\d+)?' 18 | found = re.findall(float_pattern, s) 19 | if not found: # 如果没有找到任何数字 20 | return [0.0] 21 | else: 22 | return [float(num) for num in found] 23 | 24 | 25 | def extract_continuous_digits(text): 26 | # 使用正则表达式找到所有连续的数字 27 | continuous_digits = re.findall(r'\d+', text) 28 | return continuous_digits 29 | 30 | 31 | def clean_json_string(json_str): 32 | # 首先移除非 JSON 字符,然后查找 JSON 对象或数组 33 | cleaned_str = re.search(r'(\{.*\}|\[.*\])', json_str) 34 | if cleaned_str: 35 | return cleaned_str.group() 36 | else: 37 | return None 38 | 39 | 40 | # 函数用于清洗内容数据 41 | def clean_content(content): 42 | # 移除 HTML 标签和额外空格 43 | cleaned_content = re.sub('<[^<]+?>', '', content) 44 | cleaned_content = ' '.join(cleaned_content.split()) 45 | return cleaned_content -------------------------------------------------------------------------------- /Agent_data/current_scene.json: -------------------------------------------------------------------------------- 1 | { 2 | "j7etwzbe4etc": "apply_leave", 3 | "9731dcun3se4": "apply_leave", 4 | "zqbe75kgwa1u": "apply_package", 5 | "7s1frwpzker2": "apply_package", 6 | "7mf8xbvo118e": "apply_leave", 7 | "1m441f9d6n6r": "apply_leave", 8 | "qwlzlgzi8j36": "", 9 | "hv7klpt2pl8o": "apply_leave", 10 | "esrnx8ufjcpt": "apply_leave", 11 | "nmcuex5ec5sf": "", 12 | "fz3kg6c6fgh7": "", 13 | "4fjaugpx24yk": "", 14 | "97644fckcdfg": "", 15 | "hfe4wpxudikm": "apply_leave", 16 | "cwy4a8itvhwu": "apply_leave", 17 | "ty6cbbf1syfd": "apply_leave", 18 | "rsrei0thatui": "", 19 | "p313lptjb4ig": "apply_leave", 20 | "wyfkbav8853s": "apply_leave", 21 | "ng8lq0zwuknx": "", 22 | "m5m8boi5wja3": "", 23 | "9viu4i0b939u": "apply_leave", 24 | "s1tna2d37ydt": "apply_leave", 25 | "l0l2hfwg2hp1": "apply_leave", 26 | "zqjn18ic8xgh": "apply_leave", 27 | "gmosiv5vb3e5": "apply_leave", 28 | "33tsm183yonj": "apply_leave", 29 | "irnm5b0buj2b": "apply_leave", 30 | "1kwnxc9al310": "apply_leave", 31 | "p5pt7ho53qoc": "apply_package", 32 | "5lbrmi4knjq8": "apply_package", 33 | "n4doq5hc2qbx": "apply_package", 34 | "7off0xzwb256": "apply_leave", 35 | "ww8c82xuj207": "apply_leave", 36 | "vb4g1riov6ie": "", 37 | "jq2l508gsc07": "apply_leave", 38 | "82cff22leh46": "apply_package" 39 | } -------------------------------------------------------------------------------- /scene_config/scene_prompts.py: -------------------------------------------------------------------------------- 1 | slot_update = """你是一个信息抽取机器人。 2 | 当前问答场景是:【{}】 3 | 当前日期是:{} 4 | 5 | JSON中每个元素代表一个参数信息: 6 | ''' 7 | name是参数名称 8 | desc是参数注释,可以做为参数信息的补充 9 | ''' 10 | 11 | 需求: 12 | #01 根据用户输入内容和历史对话提取有用的信息到value值,严格提取,没有提及就丢弃该元素 13 | #02 返回JSON结果,只需要name和value 14 | #03 如果用户问题中包含今天、明天、后天,你需要根据当前日期判断用户所指的日期 15 | 16 | 返回样例: 17 | ``` 18 | {} 19 | ``` 20 | 21 | JSON:{} 22 | 输入:{} 23 | 答: 24 | """ 25 | 26 | slot_query_user = """你是一个专业的智能客服。 27 | 当前问答场景是:【{}】 28 | 29 | JSON中每个元素代表一个参数信息: 30 | ''' 31 | name表示参数名称 32 | desc表示参数的描述,你要根据描述引导用户补充参数value值 33 | ''' 34 | 35 | 需求: 36 | #01 一次最多只向用户问两个参数 37 | #02 回答以"请问"开头 38 | #03 说话要温柔一些,要有客服的风度。 39 | #04 不要有废话,让用户直接就能看到自己输入的数据是否有误。 40 | JSON:{} 41 | 向用户提问: 42 | """ 43 | 44 | slot_api_answer = """ 你现在是一个总结机器人。 45 | 46 | 当前问答场景是【{}】 47 | 48 | 已知的信息是{}, 49 | 50 | 用户输入:{}, 51 | 52 | 请你根据已知的信息和当前问答场景回复给用户 53 | 54 | 注意每条数据需要分行 55 | """ 56 | google_prompt = """ 57 | # 背景信息: 58 | 你是智能客服,你现在的位置在北京,当前日期是:{} 59 | # 用户问题: 60 | {} 61 | # 需求: 62 | 你根据背景信息将用户问题补充完整 63 | # 举例 64 | 用户问题:今天的天气怎么样? 65 | 完整问题:北京今天的天气怎么样? 66 | 67 | 用户问题:附近有什么好玩的吗? 68 | 完整问题:北京有什么好玩的吗? 69 | # 注意: 70 | 只输出最后的问题,不要有其他多余的字 71 | """ 72 | 73 | google_message = """ 74 | # 背景信息: 75 | 你是智能客服,你现在的位置在北京,当前日期是:{} 76 | # Google搜索到的信息: 77 | {} 78 | # 用户问题: 79 | {} 80 | 81 | # 需求: 82 | 你需要根据用户的问题结合Google搜索到的信息回答给用户 83 | # 注意: 84 | 1.你是公司的智能客服,一定要使用中文简体 85 | 2.如果有温度的话,使用摄氏度 86 | 3.语言符合汉语的习惯 87 | 4.用户查询的新闻信息的话结合用户问题判断是否需要加上日期 88 | """ 89 | -------------------------------------------------------------------------------- /Agent_data/first_important.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave":{ 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /scene_config/scene_templates.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "required": true 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "required": true 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "required": true 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "required": true 29 | } 30 | ] 31 | }, 32 | "apply_leave":{ 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "required": true 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "required": true 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "required": true 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "required": true 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "required": true 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /agent/google_search.py: -------------------------------------------------------------------------------- 1 | import json 2 | from utils.helpers import send_message 3 | from langchain.utilities import SerpAPIWrapper 4 | from utils.environ import set_Google_environ,set_proxy_environ 5 | import config 6 | import requests 7 | from scene_config.scene_prompts import google_message,google_prompt 8 | from utils.date_utils import get_current_date 9 | 10 | 11 | ''' 12 | def Call_Google_API(question,scene_name,user_input): 13 | set_Google_environ() 14 | 15 | search = SerpAPIWrapper() 16 | 17 | result = search.run(user_input) 18 | 19 | slot_answer = """ 20 | # role: 21 | 你现在是一个总结机器人。 22 | # 搜索出的信息: 23 | {} 24 | # 用户问题: 25 | 用户输入:{} 26 | # 目标 27 | 请你根据搜索出的信息和用户问题回复给用户 28 | 注意每条数据需要分行""" 29 | prompt = slot_answer.format(result,user_input) 30 | 31 | return send_message(prompt,user_input) 32 | ''' 33 | def Call_Google_API(scene_name,user_input): 34 | 35 | prompt = google_prompt.format(get_current_date(),user_input) 36 | 37 | new_question = send_message(prompt,user_input) 38 | 39 | google_url = "https://www.googleapis.com/customsearch/v1?key={}&q={}&cx={}&lr=lang_zh-CN&num=5&sort=date&cr=countryCN" 40 | 41 | set_proxy_environ() 42 | 43 | data = requests.get(google_url.format(config.google_key_plus,new_question,config.google_engines_key)).text 44 | 45 | json_data = json.loads(data) 46 | 47 | # 提取item中的snippet字段的值 48 | snippet_values = [item.get('snippet', '') for item in json_data.get('items', [])] 49 | 50 | second_prompt = "" 51 | 52 | for snippet_value in snippet_values: 53 | second_prompt += snippet_value + "\n" 54 | 55 | final_prompt = google_message.format(get_current_date(),second_prompt,user_input) 56 | 57 | return send_message(final_prompt,user_input) 58 | -------------------------------------------------------------------------------- /Agent_data/1m441f9d6n6r.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/4fjaugpx24yk.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/9731dcun3se4.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "未提供" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/97644fckcdfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/esrnx8ufjcpt.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/fz3kg6c6fgh7.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/hfe4wpxudikm.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/hv7klpt2pl8o.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/j7etwzbe4etc.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/m5m8boi5wja3.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/ng8lq0zwuknx.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/nmcuex5ec5sf.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "事假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/p313lptjb4ig.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "未提供" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/qwlzlgzi8j36.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/rsrei0thatui.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/vb4g1riov6ie.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/wyfkbav8853s.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/zqbe75kgwa1u.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/1yxmqd3a4ju3.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "个人事务需要处理" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/7mf8xbvo118e.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "未提供" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/82cff22leh46.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "网络问题解决方案" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "斯蒂芬" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "生病了" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/dynu9hdrq9b3.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "个人事务需要处理" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Agent_data/6vdxuo7nnmpd.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "李四" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "15888888888" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "99元" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/7off0xzwb256.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "身体不适,想睡觉" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "事假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-18 12:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/ww8c82xuj207.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "身体不舒服" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "事假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-19 12:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/n4doq5hc2qbx.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "田明广" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "1993930648" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "410928200307034212" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "99元" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/zqjn18ic8xgh.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "身体疲劳,需要休息" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "事假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-18 21:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/5lbrmi4knjq8.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "田明广" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "13800138000" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "410100199001011234" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "99元套餐" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/gmosiv5vb3e5.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "身体不适" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "病假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-18 19:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-04-18 21:00" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/irnm5b0buj2b.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "梁晨" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "个人事务处理" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "事假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-18 21:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-04-19 10:00" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/jq2l508gsc07.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "不那么严重的病" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "病假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-19 00:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-04-19 20:00" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/ty6cbbf1syfd.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "田明广" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "出去走走" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "病假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-19 00:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-04-21 23:59" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/yw379w6o8w9k.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "个人事务处理" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "病假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-16 12:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-05-01 12:00" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/33tsm183yonj.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "个人事务需要处理" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "事假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-18 21:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-04-18 21:00" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/cwy4a8itvhwu.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "时坤晓" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "个人事务需要处理" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "病假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-19 12:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-04-30 17:30" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/l0l2hfwg2hp1.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "个人事务需要处理" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "病假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-19 00:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-04-21 23:59" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/1kwnxc9al310.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "个人事务需要处理" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "事假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-19 09:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-04-20 18:00" 65 | } 66 | ] 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Agent_data/s1tna2d37ydt.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "未指定(需要用户提供详细信息)" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "事假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-19 19:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-05-01 15:30" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/7s1frwpzker2.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "田明广" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "154565465465464554544554545" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "5644565454454545545454544" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "未提及" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /agent/oil_price.py: -------------------------------------------------------------------------------- 1 | import config 2 | import requests 3 | from utils.helpers import send_message 4 | import urllib 5 | from urllib.parse import quote 6 | import json 7 | import ssl 8 | from utils.data_format_utils import clean_content 9 | import scene_config.scene_prompts 10 | 11 | slot_answer = scene_config.scene_prompts.slot_api_answer 12 | 13 | def Call_Oil_API(province,scene_name,user_input): 14 | 15 | province = province.replace("省","") 16 | province = province.replace("市","") 17 | 18 | encoded_province = urllib.parse.quote(province.encode('utf-8')) 19 | host = 'https://youjia.market.alicloudapi.com' 20 | path = '/lundroid/youjia' 21 | method = 'ANY' 22 | appcode = config.News_Key 23 | querys = f'province={encoded_province}' 24 | bodys = {"province": province} 25 | url = host + path + '?' + querys 26 | 27 | post_data = json.dumps(bodys) 28 | request = urllib.request.Request(url) #, post_data.encode('utf-8')) 29 | request.add_header('Authorization', 'APPCODE ' + appcode) 30 | # 根据API的要求,定义相对应的Content-Type 31 | request.add_header('Content-Type', 'application/json; charset=UTF-8') 32 | ctx = ssl.create_default_context() 33 | ctx.check_hostname = False 34 | ctx.verify_mode = ssl.CERT_NONE 35 | response = urllib.request.urlopen(request, context=ctx) 36 | content = response.read().decode('utf-8') 37 | data = json.loads(content) 38 | 39 | # print(data) #------------------------------------------------- 40 | 41 | if data["resp"]["RespCode"] == 200: 42 | list_data = data["data"] 43 | api_prompt = f'今天{province}地区的油价如下:柴油:{list_data[0]["type0"]}/升,92号汽油:{list_data[0]["type92"]}/升,95号汽油:{list_data[0]["type95"]}/升,98号汽油:{list_data[0]["type98"]}/升,最新一次更新时间是{list_data[0]["updateTime"]}' 44 | prompt = slot_answer.format(scene_name,api_prompt,user_input) 45 | 46 | return send_message(prompt,user_input) 47 | else: 48 | prompt = slot_answer.format(scene_name,f"请检查你输入的{province}地区是否正确",user_input) 49 | 50 | return send_message(prompt,user_input) -------------------------------------------------------------------------------- /Agent_data/9viu4i0b939u.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "田明广" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "19939306458" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "41092820030703" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "未提及" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "个人事务处理" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "事假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-19 09:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-04-19 18:00" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /Agent_data/p5pt7ho53qoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "apply_package": { 3 | "name": "办理套餐", 4 | "description": "办理套餐服务", 5 | "parameters": [ 6 | { 7 | "name": "姓名", 8 | "desc": "办理套餐的持有人姓名", 9 | "type": "string", 10 | "value": "田明广" 11 | }, 12 | { 13 | "name": "电话号码", 14 | "desc": "办理套餐的电话号码", 15 | "type": "string", 16 | "value": "13888888888" 17 | }, 18 | { 19 | "name": "身份证号", 20 | "desc": "办理套餐的身份证号", 21 | "type": "string", 22 | "value": "510111199001011234" 23 | }, 24 | { 25 | "name": "套餐类型", 26 | "desc": "办理套餐的套餐类型,有39元、59元、99元套餐", 27 | "type": "string", 28 | "value": "99元套餐" 29 | } 30 | ] 31 | }, 32 | "apply_leave": { 33 | "name": "请假申请", 34 | "description": "帮助用户自动实现请假流程", 35 | "parameters": [ 36 | { 37 | "name": "主管", 38 | "desc": "用户主管的姓名", 39 | "type": "string", 40 | "value": "任中涛" 41 | }, 42 | { 43 | "name": "申请理由", 44 | "desc": "用户请假的申请理由,申请原因", 45 | "type": "string", 46 | "value": "个人事务需要处理" 47 | }, 48 | { 49 | "name": "请假类别", 50 | "desc": "用户请假的类别,例如:病假、事假、休假、婚假等", 51 | "type": "string", 52 | "value": "事假" 53 | }, 54 | { 55 | "name": "开始时间", 56 | "desc": "用户请假的开始日期,格式:YYYY-MM-DD hh:mm", 57 | "type": "string", 58 | "value": "2024-04-18 19:00" 59 | }, 60 | { 61 | "name": "结束时间", 62 | "desc": "用户请假的结束日期,格式:YYYY-MM-DD hh:mm", 63 | "type": "string", 64 | "value": "2024-04-19 12:00" 65 | } 66 | ] 67 | } 68 | } -------------------------------------------------------------------------------- /agent/weather.py: -------------------------------------------------------------------------------- 1 | import config 2 | import requests 3 | from utils.helpers import send_message 4 | 5 | import scene_config.scene_prompts 6 | slot_answer = scene_config.scene_prompts.slot_api_answer 7 | 8 | 9 | # 查询天气信息的API 10 | def Call_Weather_API(location,scene_name,user_input): 11 | params_realtime = { 12 | 'key': config.Weather_Key, 13 | 'city': location, 14 | 'extensions': 'all' 15 | } 16 | 17 | res = requests.get(url=config.Weather_Url, params=params_realtime) 18 | 19 | weather = res.json() 20 | 21 | if weather["count"] == "0": 22 | weather_prompt = f"获取{location}地区的实时天气失败,请检查是否存在该地区" 23 | prompt = slot_answer.format(scene_name,weather_prompt,user_input) 24 | model_answer = send_message(prompt,user_input) 25 | return model_answer 26 | 27 | report_time = weather.get('forecasts')[0].get("reporttime") # 获取发布数据时间 28 | date = weather.get('forecasts')[0].get("casts")[0].get('date') # 获取日期 29 | day_weather = weather.get('forecasts')[0].get("casts")[0].get('dayweather') # 白天天气现象 30 | night_weather = weather.get('forecasts')[0].get("casts")[0].get('nightweather') # 晚上天气现象 31 | day_temp = weather.get('forecasts')[0].get("casts")[0].get('daytemp') # 白天温度 32 | night_temp = weather.get('forecasts')[0].get("casts")[0].get('nighttemp') # 晚上温度 33 | day_wind = weather.get('forecasts')[0].get("casts")[0].get('daywind') # 白天风向 34 | night_wind = weather.get('forecasts')[0].get("casts")[0].get('nightwind') # 晚上风向 35 | day_power = weather.get('forecasts')[0].get("casts")[0].get('daypower') # 白天风力 36 | night_power = weather.get('forecasts')[0].get("casts")[0].get('nightpower') # 晚上风力 37 | 38 | 39 | weather_prompt = f"地点是{location}" + f"发布数据的时间{report_time}" + f"现在的日期是{date}" + f"白天天气现象{day_weather}" + f"晚上天气现象{night_weather}" + f"白天温度{day_temp}" + f"晚上温度{night_temp}" + f"白天风向{day_wind}" + f"晚上风向{night_wind}" + f"白天风力{day_power}" + f"晚上风力{night_power}" 40 | 41 | prompt = slot_answer.format(scene_name,weather_prompt,user_input) 42 | model_answer = send_message(prompt,user_input) 43 | 44 | return model_answer -------------------------------------------------------------------------------- /agent/news.py: -------------------------------------------------------------------------------- 1 | import config 2 | import requests 3 | from utils.helpers import send_message 4 | import urllib 5 | from urllib.parse import quote 6 | import json 7 | import ssl 8 | from utils.data_format_utils import clean_content 9 | import scene_config.scene_prompts 10 | 11 | slot_answer = scene_config.scene_prompts.slot_api_answer 12 | 13 | 14 | def Call_News_API(name,scene_name,user_input): 15 | 16 | host = 'https://jisunews.market.alicloudapi.com' 17 | path = '/news/search' 18 | method = 'ANY' 19 | appcode = config.News_Key 20 | querys = f'keyword={quote(name)}' 21 | bodys = {"keyword": name} 22 | url = host + path + '?' + querys 23 | 24 | post_data = json.dumps(bodys) 25 | request = urllib.request.Request(url, post_data.encode('utf-8')) 26 | request.add_header('Authorization', 'APPCODE ' + appcode) 27 | # 根据API的要求,定义相对应的Content-Type 28 | request.add_header('Content-Type', 'application/json; charset=UTF-8') 29 | ctx = ssl.create_default_context() 30 | ctx.check_hostname = False 31 | ctx.verify_mode = ssl.CERT_NONE 32 | response = urllib.request.urlopen(request, context=ctx) 33 | content = response.read().decode('utf-8') 34 | data = json.loads(content) 35 | 36 | # 访问 "list" 数组 37 | if data["status"] != 0: 38 | prompt = slot_answer.format(scene_name,f"未找到与{name}相关的新闻信息",user_input) 39 | return send_message(prompt,user_input) 40 | else: 41 | list_items = data["result"]["list"] 42 | api_prompt = "" 43 | # 最多取5数据 44 | News_number = 5 45 | 46 | for item in list_items: 47 | content = item["content"] 48 | time = item["time"] 49 | src = item["src"] 50 | cleaned_content = clean_content(content) 51 | api_prompt += f"时间:{time},新闻信息:{cleaned_content},新闻来源:{src}\n" 52 | 53 | print(api_prompt) 54 | 55 | if News_number <= 0: 56 | break 57 | News_number -= 1 58 | 59 | # 加载到当前环境 60 | prompt = slot_answer.format(scene_name,api_prompt,user_input) + "每个新闻都必须带上具体的时间" 61 | 62 | return send_message(prompt,user_input) -------------------------------------------------------------------------------- /agent/exchange_rate.py: -------------------------------------------------------------------------------- 1 | import config 2 | import requests 3 | from utils.helpers import send_message 4 | import urllib 5 | import json,ssl 6 | from utils.data_format_utils import clean_content 7 | import scene_config.scene_prompts 8 | slot_answer = scene_config.scene_prompts.slot_api_answer 9 | 10 | def Call_Exchange_API(money_name,scene_name,user_input): 11 | with open('/home/z00013696/lyq-file/Script/function/utils/exchange.json', 'r', encoding='utf-8') as file: 12 | data = json.load(file) 13 | 14 | # 创建一个字典来存储 "com" 和 "no" 值 15 | result_dict = {} 16 | 17 | print(data) 18 | 19 | for item in data['result']['list']: 20 | name_value = item.get("name") 21 | code_value = item.get("code") 22 | # 将 "com" 和 "no" 值存储到字典中 23 | result_dict[name_value] = code_value 24 | 25 | if result_dict.get(money_name) is None: 26 | prompt = slot_answer.format(scene_name,f"请检查您选择的货币{money_name}是否正确",user_input) 27 | return send_message(prompt,user_input) 28 | 29 | host = 'https://jisuhuilv.market.alicloudapi.com' 30 | path = '/exchange/single' 31 | method = 'GET' 32 | appcode = config.News_Key 33 | querys = f'currency={result_dict.get(money_name)}' 34 | bodys = {"currency": money_name} 35 | url = host + path + '?' + querys 36 | 37 | post_data = json.dumps(bodys) 38 | request = urllib.request.Request(url, post_data.encode('utf-8')) 39 | request.add_header('Authorization', 'APPCODE ' + appcode) 40 | # 根据API的要求,定义相对应的Content-Type 41 | request.add_header('Content-Type', 'application/json; charset=UTF-8') 42 | ctx = ssl.create_default_context() 43 | ctx.check_hostname = False 44 | ctx.verify_mode = ssl.CERT_NONE 45 | response = urllib.request.urlopen(request, context=ctx) 46 | content = response.read().decode('utf-8') 47 | data = json.loads(content) 48 | 49 | if data["status"] != 0: 50 | prompt = slot_answer.format(scene_name,f"请检查您选择的货币{money_name}是否正确",user_input) 51 | return send_message(prompt,user_input) 52 | else: 53 | api_prompt = f"{money_name}的汇率信息如下:" 54 | currency_list = data["result"]["list"] 55 | 56 | # 遍历并打印出每个货币的名称和汇率 57 | rate_count = 10 58 | 59 | for currency, info in currency_list.items(): 60 | name = info["name"] 61 | rate = info["rate"] 62 | updatetime = info["updatetime"] 63 | api_prompt += f"货币名称: {name}, 汇率: {rate}, 更新时间: {updatetime}" 64 | 65 | rate_count = rate_count - 1 66 | 67 | if rate_count <= 0: 68 | break 69 | prompt = slot_answer.format(scene_name,api_prompt,user_input) 70 | return send_message(prompt,user_input) -------------------------------------------------------------------------------- /utils/function_api.py: -------------------------------------------------------------------------------- 1 | from utils.helpers import send_message 2 | import requests 3 | import scene_config.scene_prompts 4 | from utils.data_format_utils import clean_content 5 | import json 6 | import re 7 | import urllib.request 8 | import urllib,sys 9 | import ssl,os 10 | from utils.environ import set_proxy_environ 11 | from urllib.parse import quote 12 | import config 13 | 14 | from agent.exchange_rate import Call_Exchange_API 15 | from agent.news import Call_News_API 16 | from agent.oil_price import Call_Oil_API 17 | from agent.stock import Call_Stock_API 18 | from agent.travel import Call_Travel_API 19 | from agent.weather import Call_Weather_API 20 | from agent.google_search import Call_Google_API 21 | from agent.apply_for_package import apply_for_package_API 22 | from agent.apply_leave import Call_leave_API 23 | 24 | slot_answer = scene_config.scene_prompts.slot_api_answer 25 | 26 | 27 | def Call_API(slot,scene_config,scene_name,user_input): 28 | # 设置代理 29 | set_proxy_environ() 30 | 31 | if scene_config["name"] == "问天气" : 32 | print("weather_query--------------------------===================\n") 33 | return Call_Weather_API(slot[0]["value"],scene_name,user_input) 34 | elif scene_config["name"] == "查景区" : 35 | print("travel_query--------------------------===================\n") 36 | return Call_Travel_API(slot[0]["value"],scene_name,user_input) 37 | elif scene_config["name"] == "查新闻": 38 | print("查新闻--------------------------===================\n") 39 | return Call_News_API(slot[0]["value"],scene_name,user_input) 40 | elif scene_config["name"] == "查油价": 41 | print("查油价--------------------------===================\n") 42 | return Call_Oil_API(slot[0]["value"],scene_name,user_input) 43 | elif scene_config["name"] == "查股票": 44 | print("查股票--------------------------===================\n") 45 | return Call_Stock_API(slot[0]["value"],slot[1]["value"],scene_name,user_input) 46 | elif scene_config["name"] == "查汇率": 47 | print("查汇率--------------------------===================\n") 48 | return Call_Exchange_API(slot[0]["value"],scene_name,user_input) 49 | elif scene_config["name"] == "google搜索": 50 | print("google搜索--------------------------===================\n") 51 | return Call_Google_API(scene_name,user_input) 52 | elif scene_config["name"] == "请假申请": 53 | print("请假申请--------------------------===================\n") 54 | return Call_leave_API(slot,scene_name,user_input) 55 | elif scene_config["name"] == "办理套餐": 56 | print("办理套餐--------------------------===================\n") 57 | return apply_for_package_API(slot,scene_name,user_input) 58 | else: 59 | print("-----------------------没调用API,直接交给大模型进行回答========================\n") 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /agent/stock.py: -------------------------------------------------------------------------------- 1 | import config 2 | import requests 3 | from utils.helpers import send_message 4 | import urllib 5 | from urllib.parse import quote 6 | import json 7 | import ssl 8 | from utils.data_format_utils import clean_content 9 | import scene_config.scene_prompts 10 | slot_answer = scene_config.scene_prompts.slot_api_answer 11 | 12 | def Call_Stock_API(market,stock_id,scene_name,user_input): 13 | if market == "A股" : 14 | headers ={"Content-Type": "application/x-www-form-urlencoded"} 15 | url = "http://web.juhe.cn/finance/stock/hs" 16 | params = { 17 | "key":config.stock_Key, # 在个人中心->我的数据,接口名称上方查看 18 | "gid":stock_id, # 股票编号,上海股市以sh开头,深圳股市以sz开头如:sh601009 19 | } 20 | resp = requests.get(url,params,headers=headers) 21 | data = json.loads(resp.text) 22 | 23 | if data["error_code"] == 0: 24 | # 自己提取json信息 25 | """ 26 | name = data['result'][0]['data']['name'] 27 | date = data['result'][0]['data']['name'] 28 | increPer = data['result'][0]['data']['increPer'] # 涨跌幅百分比,负数表示下跌。 29 | increase = data['result'][0]['data']['increase'] # 涨跌额 30 | todayMax = data['result'][0]['data']['todayMax'] # 当日最大 31 | todayMin = data['result'][0]['data']['todayMin'] # 当日最低价 32 | todayStartPri = data['result'][0]['data']['todayStartPri'] # 当日开盘价 33 | traAmount = data['result'][0]['data']['traAmount'] # 当日累计成交金额 34 | traNumber = data['result'][0]['data']['traNumber'] # 当日累计成交量 35 | api_prompt = f'''A股中{name}{date}的股票信息如下: \n 36 | 涨跌幅百分比:{increPer}\n 37 | 涨跌额:{increase}\n 38 | 当日最高价:{todayMax}\n 39 | 当日最低价:{todayMin}\n 40 | 当日开盘价:{todayStartPri}\n 41 | 当日累计成交金额:{traAmount}\n 42 | 当日累计成交量:{traNumber} 43 | ''' 44 | """ 45 | # json交给大模型去提取 46 | api_prompt = "以下是股票信息" 47 | data_list = data['result'][0]['data'] 48 | for key, value in data_list.items(): 49 | api_prompt += f"{key}:{value}\n" 50 | api_prompt += "根据这些信息总结交给用户,一定要准确和全面" 51 | 52 | prompt = slot_answer.format(scene_name,api_prompt,user_input) 53 | return send_message(prompt,user_input) 54 | else: 55 | prompt = slot_answer.format(scene_name,f"请检查您输入的股票编号{stock_id}在{market}中是否存在",user_input) 56 | return send_message(prompt,user_input) 57 | elif market == "港股": 58 | headers ={"Content-Type": "application/x-www-form-urlencoded"} 59 | url = "http://web.juhe.cn/finance/stock/hk" 60 | params = { 61 | "key":config["stock_Key"], # 在个人中心->我的数据,接口名称上方查看 62 | "num":stock_id, # 股票代码,如:00001 为“长江实业”股票代码 63 | } 64 | resp = requests.get(url,params,headers=headers) 65 | data = json.loads(resp.text) 66 | 67 | if data["error_code"] == 0: 68 | api_prompt = "以下是股票信息" 69 | data_list = data['result'][0]['data'] 70 | for key, value in data_list.items(): 71 | api_prompt += f"{key}:{value}\n" 72 | api_prompt += "根据这些信息总结交给用户,一定要准确和全面" 73 | 74 | prompt = slot_answer.format(scene_name,api_prompt,user_input) 75 | return send_message(prompt,user_input) 76 | else: 77 | prompt = slot_answer.format(scene_name,f"请检查您输入的股票编号{stock_id}在{market}中是否存在",user_input) 78 | return send_message(prompt,user_input) 79 | else: 80 | 81 | prompt = slot_answer.format(scene_name,f"请检查您选择的{market}股市是否存在,我只支持查询A股和港股",user_input) 82 | return send_message(prompt,user_input) -------------------------------------------------------------------------------- /scene_processor/impl/common_processor.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | import logging 3 | 4 | from scene_config import scene_prompts 5 | from scene_processor.scene_processor import SceneProcessor 6 | from utils.helpers import get_raw_slot, update_slot, format_name_value_for_logging, is_slot_fully_filled, send_message, \ 7 | extract_json_from_string, get_dynamic_example, clean_slot_json, clear_agent_json, update_agent_json 8 | from utils.prompt_utils import get_slot_update_message, get_slot_query_user_message 9 | from utils.function_api import Call_API 10 | import agent 11 | 12 | class CommonProcessor(SceneProcessor): 13 | def __init__(self, scene_config, slot, current_purpose): 14 | parameters = scene_config["parameters"] 15 | self.scene_config = scene_config 16 | self.scene_name = scene_config["name"] 17 | self.slot_template = get_raw_slot(parameters) 18 | self.slot_dynamic_example = get_dynamic_example(scene_config) 19 | self.current_purpose = current_purpose 20 | self.slot = slot 21 | self.scene_prompts = scene_prompts 22 | 23 | def process(self, user_input, history_content,chatId): 24 | # 处理用户输入,更新槽位,检查完整性,以及与用户交互 25 | # 先检查本次用户输入是否有信息补充,保存补充后的结果 编写程序进行字符串value值diff对比,判断是否有更新 26 | message = get_slot_update_message(self.scene_name, self.slot_dynamic_example,self.slot, user_input) # 优化封装一下 .format 入参只要填input 27 | 28 | new_info_json_raw = send_message(message, user_input) 29 | 30 | current_values = extract_json_from_string(new_info_json_raw) 31 | logging.debug('current_values: %s', current_values) 32 | logging.debug('slot update before: %s', self.slot) 33 | 34 | update_slot(current_values, self.slot) 35 | update_agent_json(self.current_purpose, self.slot, chatId) 36 | 37 | logging.debug('slot update after: %s', self.slot) 38 | # 判断参数是否已经全部补全 39 | if is_slot_fully_filled(self.slot): 40 | # 参数补全的情况----- 41 | 42 | # 不需要用户二次确认 43 | if self.scene_name not in agent.is_user_comfirm: 44 | return Call_API(self.slot,self.scene_config,self.scene_name,user_input) 45 | 46 | # 需要用户二次确认 47 | if user_input == "YES": 48 | # 用户确认清空参数 49 | slot = self.slot 50 | 51 | self.slot = clean_slot_json(self.scene_config["parameters"]) 52 | clear_agent_json(self.current_purpose,chatId) 53 | 54 | return Call_API(slot,self.scene_config,self.scene_name,"确认") 55 | else: 56 | self.respond_with_complete_data() 57 | 58 | prompt = f''' 59 | # role: 60 | 你当前是一个客服,负责将这些参数返回给用户 61 | # 已知信息: 62 | 这是{self.scene_name}场景下的参数数据: 63 | {format_name_value_for_logging(self.slot)} 64 | # 目标 65 | 你需要做的是将这些数据总结后交给用户 66 | # 注意 67 | 1.说话要温柔一些,要有客服的风度。 68 | 2.不要有废话,让用户直接就能看到自己输入的数据是否有误。 69 | ''' 70 | return send_message(prompt,user_input) + "\n 如果您认为数据无误,请输出:确认" 71 | else: 72 | return self.ask_user_for_missing_data(user_input) 73 | 74 | 75 | def respond_with_complete_data(self): 76 | # 当所有数据都准备好后的响应 77 | logging.debug(f'%s ------ 参数已完整,详细参数如下', self.scene_name) 78 | logging.debug(format_name_value_for_logging(self.slot)) 79 | logging.debug(f'正在请求%sAPI,请稍后……', self.scene_name) 80 | 81 | print(format_name_value_for_logging(self.slot) + '\n正在请求{}API,请稍后……'.format(self.scene_name)) 82 | 83 | 84 | def ask_user_for_missing_data(self, user_input): 85 | message = get_slot_query_user_message(self.scene_name, self.slot, user_input) 86 | # 请求用户填写缺失的数据 87 | result = send_message(message, user_input) 88 | return result 89 | -------------------------------------------------------------------------------- /utils/logger.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import os 3 | from datetime import datetime 4 | from logging.handlers import RotatingFileHandler 5 | 6 | cur_path = os.path.dirname(os.path.realpath(__file__)) # 当前项目路径 7 | log_path = os.path.join(cur_path, '../logs') # log_path为存放日志的路径 8 | if not os.path.exists(log_path): os.mkdir(log_path) # 若不存在logs文件夹,则自动创建 9 | 10 | default_formats = { 11 | 'log_format': '%(asctime)s-%(name)s-%(levelname)s: %(message)s' 12 | } 13 | 14 | 15 | class HandleLog: 16 | """ 17 | 先创建日志记录器(logging.getLogger),然后再设置日志级别(logger.setLevel), 18 | 接着再创建日志文件,也就是日志保存的地方(logging.FileHandler),然后再设置日志格式(logging.Formatter), 19 | 最后再将日志处理程序记录到记录器(addHandler) 20 | """ 21 | 22 | def __init__(self, log_name): 23 | self.__now_time = datetime.now().strftime('%Y%m%d_%H%M%S') # 当前日期格式化 24 | self.__all_log_path = os.path.join(log_path, log_name + "_all_" + self.__now_time + ".log") # 收集所有日志信息文件 25 | self.__error_log_path = os.path.join(log_path, log_name + "_error_" + self.__now_time + ".log") # 收集错误日志信息文件 26 | self.__logger = logging.getLogger() # 创建日志记录器 27 | self.__logger.setLevel(logging.DEBUG) # 设置默认日志记录器记录级别 28 | 29 | @staticmethod 30 | def __init_logger_handler(log_path): 31 | """ 32 | 创建日志记录器handler,用于收集日志 33 | :param log_path: 日志文件路径 34 | :return: 日志记录器 35 | """ 36 | # 写入文件,如果文件超过10M大小时,切割日志文件,仅保留10个文件 37 | logger_handler = RotatingFileHandler(filename=log_path, maxBytes=50 * 1024 * 1024, backupCount=20, 38 | encoding='utf-8') 39 | return logger_handler 40 | 41 | def __set_log_handler(self, logger_handler, level=logging.DEBUG): 42 | """ 43 | 设置handler级别并添加到logger收集器 44 | :param logger_handler: 日志记录器 45 | :param level: 日志记录器级别 46 | """ 47 | logger_handler.setLevel(level=level) 48 | self.__logger.addHandler(logger_handler) 49 | 50 | @staticmethod 51 | def __set_log_formatter(file_handler): 52 | """ 53 | 设置日志输出格式-日志文件 54 | :param file_handler: 日志记录器 55 | """ 56 | formatter = logging.Formatter(default_formats["log_format"], datefmt='%a, %d %b %Y %H:%M:%S') 57 | file_handler.setFormatter(formatter) 58 | 59 | @staticmethod 60 | def __close_handler(file_handler): 61 | """ 62 | 关闭handler 63 | :param file_handler: 日志记录器 64 | """ 65 | file_handler.close() 66 | 67 | def __console(self, level, message): 68 | """构造日志收集器""" 69 | all_logger_handler = self.__init_logger_handler(self.__all_log_path) # 创建日志文件 70 | error_logger_handler = self.__init_logger_handler(self.__error_log_path) 71 | 72 | self.__set_log_formatter(all_logger_handler) # 设置日志格式 73 | self.__set_log_formatter(error_logger_handler) 74 | 75 | self.__set_log_handler(all_logger_handler) # 设置handler级别并添加到logger收集器 76 | self.__set_log_handler(error_logger_handler, level=logging.ERROR) 77 | 78 | if level == 'info': 79 | self.__logger.info(message) 80 | elif level == 'debug': 81 | self.__logger.debug(message) 82 | elif level == 'warning': 83 | self.__logger.warning(message) 84 | elif level == 'error': 85 | self.__logger.error(message) 86 | elif level == 'critical': 87 | self.__logger.critical(message) 88 | 89 | self.__logger.removeHandler(all_logger_handler) # 避免日志输出重复问题 90 | self.__logger.removeHandler(error_logger_handler) 91 | 92 | self.__close_handler(all_logger_handler) # 关闭handler 93 | self.__close_handler(error_logger_handler) 94 | 95 | def debug(self, message): 96 | self.__console('debug', message) 97 | 98 | def info(self, message): 99 | self.__console('info', message) 100 | 101 | def warning(self, message): 102 | self.__console('warning', message) 103 | 104 | def error(self, message): 105 | self.__console('error', message) 106 | 107 | def critical(self, message): 108 | self.__console('critical', message) 109 | 110 | 111 | def init_add_milvus_logger(): 112 | global logger_add_milvus 113 | logger_add_milvus = HandleLog("add_milvus") 114 | 115 | 116 | def init_api_logger(): 117 | global logger_api, logger_corpus_reranker, logger_corpus_milvus 118 | logger_api = HandleLog("support_api") 119 | 120 | logger_corpus_reranker = HandleLog("corpus_rerank") 121 | logger_corpus_milvus = HandleLog("corpus_milvus") 122 | -------------------------------------------------------------------------------- /models/chatbot_model.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | import logging 3 | 4 | from scene_processor.impl.common_processor import CommonProcessor 5 | from utils.data_format_utils import extract_continuous_digits, extract_float 6 | from utils.helpers import send_message, get_raw_slot, get_agent_current_scene, update_agent_current_scene 7 | 8 | 9 | class ChatbotModel: 10 | def __init__(self, scene_templates: dict): 11 | self.scene_templates: dict = scene_templates 12 | self.current_purpose: str = '' 13 | self.processors = {} 14 | self.scene_slot = {} 15 | for key in self.scene_templates: 16 | scene_config = self.scene_templates.get(key) 17 | parameters = scene_config["parameters"] 18 | self.scene_slot[key] = get_raw_slot(parameters) 19 | 20 | 21 | @staticmethod 22 | def load_scene_processor(self, scene_config,slot, current_purpose): 23 | try: 24 | return CommonProcessor(scene_config,slot,current_purpose) 25 | except (ImportError, AttributeError, KeyError): 26 | raise ImportError(f"未找到场景处理器 scene_config: {scene_config}") 27 | 28 | def is_related_to_last_intent(self, user_input,history): 29 | RELATED_INTENT_THRESHOLD = 0.7 30 | 31 | """ 32 | 判断当前输入是否与上一次意图场景相关 33 | """ 34 | if not self.current_purpose: 35 | return False 36 | prompt = f''' 37 | # 目标: 38 | 你需要判断当前用户输入内容与当前对话场景的关联性: 39 | 当前对话场景: {self.scene_templates[self.current_purpose]['description']} 40 | 当前用户输入: {user_input} 41 | 历史对话: role:AI , content:{history} 42 | # 举例: 43 | 当前对话场景:请假申请 44 | 当前用户输入:好的,谢谢 45 | 输出:0.1 46 | 47 | 当前对话场景:请假申请 48 | 当前用户输入:田明广 49 | 输出:0.7 50 | 51 | 当前对话场景:请假申请 52 | 当前用户搜索:我想要办理套餐 53 | 输出:0.0 54 | 55 | 当前对话场景:请假申请 56 | 当前用户搜索:我不申请了 57 | 输出:0.0 58 | 59 | 60 | # 注意: 61 | 这两次输入是否关联(仅用小数回答关联度,得分范围0.0至1.0)''' 62 | result = send_message(prompt, None) 63 | return extract_float(result) >= RELATED_INTENT_THRESHOLD 64 | 65 | def recognize_intent(self, user_input, chatId): 66 | # 根据场景模板生成选项 67 | purpose_options = {} 68 | purpose_description = {} 69 | index = 1 70 | for template_key, template_info in self.scene_templates.items(): 71 | purpose_options[str(index)] = template_key 72 | purpose_description[str(index)] = template_info["description"] 73 | index += 1 74 | options_prompt = "\n".join([f"{key}. {value} - 请回复{key}" for key, value in purpose_description.items()]) 75 | options_prompt += "\n0. 闲聊场景,例如:你好?你是谁? - 请回复0" 76 | 77 | # 发送选项给用户 78 | user_option = f"有下面多种场景,需要你根据用户输入进行判断,时间的问题应该选择请假申请的序号。只答选项\n{options_prompt}\n用户输入:{user_input}\n请回复序号:" 79 | user_choice = send_message(user_option, user_input) 80 | 81 | logging.debug(f'purpose_options: %s', purpose_options) 82 | logging.debug(f'user_choice: %s', user_choice) 83 | 84 | user_choices = extract_continuous_digits(user_choice) 85 | 86 | # 根据用户选择获取对应场景 87 | if user_choices and user_choices[0] != '0': 88 | self.current_purpose = purpose_options[user_choices[0]] 89 | update_agent_current_scene(self.current_purpose,chatId) 90 | if self.current_purpose: 91 | print(f"用户选择了场景:{self.scene_templates[self.current_purpose]['name']}") 92 | # 这里可以继续处理其他逻辑 93 | else: 94 | update_agent_current_scene('',chatId) 95 | # 用户输入的选项无效的情况,可以进行相应的处理 96 | print("无效的选项,请重新选择") 97 | 98 | def get_processor_for_scene(self, scene_name): 99 | if scene_name in self.processors: 100 | return self.processors[scene_name] 101 | 102 | scene_config = self.scene_templates.get(scene_name) 103 | if not scene_config: 104 | raise ValueError(f"未找到名为{scene_name}的场景配置") 105 | 106 | processor_class = self.load_scene_processor(self, scene_config,self.scene_slot[scene_name],self.current_purpose) 107 | self.processors[scene_name] = processor_class 108 | return self.processors[scene_name] 109 | 110 | def process_multi_question(self, user_input,history_content,chatId): 111 | """ 112 | 处理多轮问答 113 | :param user_input: 114 | :return: 115 | """ 116 | self.current_purpose = get_agent_current_scene(chatId) 117 | # 查看当前场景参数是否词槽填满且用户确认 118 | if "确认" in user_input: 119 | self.get_processor_for_scene(self.current_purpose) 120 | 121 | update_agent_current_scene('',chatId) 122 | 123 | current_purpose = self.current_purpose 124 | self.current_purpose = '' 125 | return self.processors[current_purpose].process("YES", None,chatId) 126 | 127 | # 检查当前输入是否与上一次的意图场景相关 128 | if self.is_related_to_last_intent(user_input,history_content): 129 | pass 130 | else: 131 | # 不相关时,重新识别意图 132 | self.current_purpose = '' 133 | self.recognize_intent(user_input,chatId) 134 | logging.info('current_purpose: %s', self.current_purpose) 135 | 136 | if self.current_purpose in self.scene_templates: 137 | # 根据场景模板调用相应场景的处理逻辑 138 | self.get_processor_for_scene(self.current_purpose) 139 | # 调用抽象类process方法 140 | return self.processors[self.current_purpose].process(user_input,None,chatId) 141 | 142 | print("未命中已有的场景,直接交给大模型自行回答---------------\n") 143 | return user_input 144 | 145 | 146 | -------------------------------------------------------------------------------- /utils/helpers.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | import glob 3 | import json 4 | import os 5 | import re 6 | import requests 7 | from utils import logger 8 | from utils.environ import set_None_environ 9 | 10 | def filename_to_classname(filename): 11 | """ 12 | Convert a snake_case filename to a CamelCase class name. 13 | 14 | Args: 15 | filename (str): The filename in snake_case, without the .py extension. 16 | 17 | Returns: 18 | str: The converted CamelCase class name. 19 | """ 20 | parts = filename.split('_') 21 | class_name = ''.join(part.capitalize() for part in parts) 22 | return class_name 23 | 24 | 25 | def load_scene_templates(file_path): 26 | with open(file_path, 'r', encoding='utf-8') as file: 27 | return json.load(file) 28 | 29 | 30 | def load_all_scene_configs(chatId): 31 | # 用于存储所有场景配置的字典 32 | all_scene_configs = {} 33 | 34 | # 搜索目录下的所有json文件 35 | #for file_path in glob.glob("function/scene_config/sceme_templates.json", recursive=True): 36 | # file_path = "/model/tmg0011285/4.12/LT-Agent/scene_config/scene_templates.json" 37 | original_path = "./Agent_data/first_important.json" 38 | file_path = f"./Agent_data/{chatId}.json" 39 | if not os.path.exists(file_path): 40 | # 读取original_path中json的内容 41 | with open(original_path, 'r', encoding='utf-8') as original_file: 42 | data = json.load(original_file) 43 | 44 | with open(file_path, 'w',encoding='utf-8') as new_file: 45 | json.dump(data,new_file,ensure_ascii=False,indent=4) 46 | 47 | current_config = load_scene_templates(file_path) 48 | 49 | for key, value in current_config.items(): 50 | # todo 可以有加载优先级 51 | # 只有当键不存在时,才添加到all_scene_configs中 52 | if key not in all_scene_configs: 53 | all_scene_configs[key] = value 54 | 55 | return all_scene_configs 56 | 57 | def send_message(prompt, user_input): 58 | """ 59 | 请求LLM函数 60 | """ 61 | # 取消代理 62 | set_None_environ() 63 | 64 | # logger.logger_api.info('prompt输入:' + prompt) 65 | 66 | # logger.logger_api.info('用户输入:' + user_input) 67 | 68 | headers = { 69 | "Content-Type": "application/json", 70 | "Authorization": "-------------" 71 | } 72 | data = { 73 | "model": "Qwen1.5-72b-chat", 74 | "messages": [{"role": "user", "content": prompt}] 75 | } 76 | 77 | response = requests.post("model.url", data=json.dumps(data), 78 | headers=headers).content 79 | print(response) 80 | 81 | response_1 = json.loads(response) 82 | message = response_1["choices"][0]["message"]["content"] 83 | 84 | # logger.logger_api.info("大模型输出:" + str(message)) 85 | 86 | return str(message) 87 | 88 | 89 | def is_slot_fully_filled(json_data): 90 | """ 91 | 检查槽位是否完整填充 92 | """ 93 | # 遍历JSON数据中的每个元素 94 | for item in json_data: 95 | # 检查value字段是否为空字符串 96 | if item.get('value') == '' or '未提供' in item.get('value') : 97 | return False # 如果发现空字符串,返回False 98 | return True # 如果所有value字段都非空,返回True 99 | 100 | 101 | def get_raw_slot(parameters): 102 | # 创建新的JSON对象 103 | output_data = [] 104 | for item in parameters: 105 | new_item = {"name": item["name"], "desc": item["desc"], "type": item["type"], "value": ""} 106 | output_data.append(new_item) 107 | return output_data 108 | 109 | 110 | def get_dynamic_example(scene_config): 111 | # 创建新的JSON对象 112 | if 'example' in scene_config: 113 | return scene_config['example'] 114 | else: 115 | return '答:{"name":"xx","value":"xx"}' 116 | 117 | 118 | def get_slot_update_json(slot): 119 | # 创建新的JSON对象 120 | output_data = [] 121 | for item in slot: 122 | new_item = {"name": item["name"], "desc": item["desc"], "value": item["value"]} 123 | output_data.append(new_item) 124 | return output_data 125 | 126 | 127 | def get_slot_query_user_json(slot): 128 | # 创建新的JSON对象 129 | output_data = [] 130 | for item in slot: 131 | if not item["value"] or "未提供" in item["value"]: 132 | new_item = {"name": item["name"], "desc": item["desc"], "value": item["value"]} 133 | output_data.append(new_item) 134 | return output_data 135 | 136 | 137 | def update_slot(json_data, dict_target): 138 | """ 139 | 更新槽位slot参数 140 | """ 141 | # 遍历JSON数据中的每个元素 142 | for item in json_data: 143 | # 检查value字段是否为空字符串 144 | if item is not None and 'value' in item and item['value'] != '': 145 | for target in dict_target: 146 | if target['name'] == item['name']: 147 | target['value'] = item.get('value') 148 | break 149 | 150 | # 在json文件也及时更新 151 | def update_agent_json(scene_name,slot,chatId): 152 | file_path = f"./Agent_data/{chatId}.json" 153 | with open(file_path,'r', encoding='utf-8') as file: 154 | data = json.load(file) 155 | 156 | for index in range(len(slot)): 157 | data[scene_name]["parameters"][index]["value"] = slot[index]["value"] 158 | 159 | with open(file_path,'w',encoding='utf-8') as file: 160 | json.dump(data,file,ensure_ascii=False,indent=4) 161 | 162 | 163 | # 清空对应的json文件 164 | def clear_agent_json(scene_name,chatId): 165 | file_path = f"./Agent_data/{chatId}.json" 166 | with open(file_path,'r', encoding='utf-8') as file: 167 | data = json.load(file) 168 | 169 | for index in range(len(data[scene_name]["parameters"])): 170 | data[scene_name]["parameters"][index]["value"] = "" 171 | 172 | with open(file_path,'w',encoding='utf-8') as file: 173 | json.dump(data,file,ensure_ascii=False,indent=4) 174 | 175 | def clean_slot_json(slot): 176 | 177 | return get_raw_slot(slot) 178 | 179 | 180 | def update_agent_current_scene(current_scene,chatId): 181 | file_path = f"./Agent_data/current_scene.json" 182 | with open(file_path,'r',encoding='utf-8') as file: 183 | data = json.load(file) 184 | 185 | data[chatId] = current_scene 186 | 187 | with open(file_path, 'w', encoding='utf-8') as file: 188 | json.dump(data, file, ensure_ascii=False, indent=4) 189 | 190 | def get_agent_current_scene(chatId): 191 | file_path = f"./Agent_data/current_scene.json" 192 | with open(file_path,'r',encoding='utf-8') as file: 193 | data = json.load(file) 194 | 195 | return data.get(chatId,'') 196 | 197 | def format_name_value_for_logging(json_data): 198 | """ 199 | 抽取参数名称和value值 200 | """ 201 | log_strings = [] 202 | for item in json_data: 203 | name = item.get('name', 'Unknown name') # 获取name,如果不存在则使用'Unknown name' 204 | value = item.get('value', 'N/A') # 获取value,如果不存在则使用'N/A' 205 | log_string = f"name: {name}, Value: {value}" 206 | log_strings.append(log_string) 207 | return '\n'.join(log_strings) 208 | 209 | 210 | def extract_json_from_string(input_string): 211 | """ 212 | JSON抽取函数 213 | 返回包含JSON对象的列表 214 | """ 215 | try: 216 | # 正则表达式假设JSON对象由花括号括起来 217 | matches = re.findall(r'\{.*?\}', input_string, re.DOTALL) 218 | 219 | # 验证找到的每个匹配项是否为有效的JSON 220 | valid_jsons = [] 221 | for match in matches: 222 | try: 223 | json_obj = json.loads(match) 224 | valid_jsons.append(json_obj) 225 | except json.JSONDecodeError: 226 | try: 227 | valid_jsons.append(fix_json(match)) 228 | except json.JSONDecodeError: 229 | continue # 如果不是有效的JSON,跳过该匹配项 230 | continue # 如果不是有效的JSON,跳过该匹配项 231 | 232 | return valid_jsons 233 | except Exception as e: 234 | print(f"Error occurred: {e}") 235 | return [] 236 | 237 | 238 | def fix_json(bad_json): 239 | # 首先,用双引号替换掉所有的单引号 240 | fixed_json = bad_json.replace("'", '"') 241 | try: 242 | # 然后尝试解析 243 | return json.loads(fixed_json) 244 | except json.JSONDecodeError: 245 | # 如果解析失败,打印错误信息,但不会崩溃 246 | print("给定的字符串不是有效的 JSON 格式。") 247 | 248 | --------------------------------------------------------------------------------