Install
openclaw skills install @jsoncool/xiaodouai-car-skillopenclaw skills install @jsoncool/xiaodouai-car-skill该 Skill 专门用于处理用户的租车及下单需求。通过理解用户的自然语言输入,结构化提取租车关键要素,并在后台通过调用本地 CLI 命令来实现车源的实时查询与订单创建。
当用户提及以下意图时,必须自动触发并接管对话:
如果用户提及以下要点,请从get-price-detail-v3的返回信息中提取对应内容
注意: 1、任何操作如果失败了需要自动重试,重试次数最多不超过5次。 2、对于返回结果中不清楚的字段请参考references目录下的接口说明文档。 3、所有思考和输出过程都不要暴露参数相关的内容。 4、请关闭思考过程,不要输出思考的痕迹。如果关不掉,请尽可能不输出userid以及入参、接口响应相关的信息。 5、价格相关的东西一定不要乱猜,请通过get-price-detail-v3获取,参数从上下文中获取。
在调用任何 CLI 命令前,必须确保收集齐以下核心要素。不需要用户提供,记住:不要向用户提问!
当收集用户的输入后,需要增加以下元素
城市代码(根据用户提供的城市名称获取城市代码,从assets目录下的cityCode.csv中查询,并记录在上下文,查询车源信息时要用)
取还车地址经纬度(根据用户的取还车地址需要获取对应的经纬度,并记录在上下文,查询车源信息时要用)
字段映射 (根据用户选择的车型偏好,参考assets目录下的"cartype.csv"进行代码映射,存储到groupId字段中)
注意事项:transmissionType默认为1,表示自动挡的车,groupId默认为0,表示查所有的车型
当要素齐备后,在后台隐式执行以下格式的 CLI 命令来获取实时数据:
python3 scripts/xiaodou_api.py \
search-vehicle-v3 \
--endpoint-url https://interface.xiaodouzuche.com/xiaodou/ \
--pickup-address $address \
--pickup-date "$pickupdate" \
--pickup-city $city \
--pickup-city-code $citycode \
--pickup-district-name $districtName \
--pickup-lat $lat \
--pickup-lng $lng \
--return-address $address \
--return-date "$returndate" \
--return-city $city \
--return-city-code $citycode \
--return-district-name $districtName \
--return-lat $lat \
--return-lng $lng \
--xd-channel 11 \
--filter '{"groupId": $groupId, "transmissionType": "$transmissionType"}'
重要参数:在返回结果中,必须将extendInfo提取出来并记录在上下文中,在后面的调用时透传。响应结果也记录到上下文中,下一步的价格查询需要其中的参数,另外,channel很重要
输出解析:解析该命令返回的 JSON 或文本结果,为用户列出所有车型。其中,standardUnitPrice为日租金,basicInsuranceFee为基础保费,serviceFee为手续费。
输出解析后,对每条结果执行如下命令
python3 scripts/xiaodou_api.py get-price-detail-v3 \
--endpoint-url "https://interface.xiaodouzuche.com/xiaodou/" \
--model-code "$model_code" \
--store-code "$store_code" \
--fence-code "$fence_code" \
--extend-info "$extend_info" \
--order-type 0 \
--added-services "$added_services" \
--activity-sub-amount 0 \
--is-blind-box-order 0 \
--is-group-order 0 \
--channel $channel \
--pickup-address "$address" \
--pickup-city "$city" \
--pickup-city-code "$city_code" \
--pickup-district-name "$district_name" \
--pickup-lat $lat \
--pickup-lng $lng \
--pickup-date "$pickup_date" \
--pickup-address-type $address_type \
--return-address "$address" \
--return-city "$city" \
--return-city-code "$city_code" \
--return-district-name "$district_name" \
--return-lat $lat \
--return-lng $lng \
--return-date "$return_date" \
--return-address-type $address_type \
2、payAmount为租车总价。不可以修改!不可以修改!不可以修改! 请注意insuranceServiceList字段,该字段数据中如果有serviceName="优享保障" 的选项,需要将该选项的金额(amount字段)加到总价中。 channelMerchantDiscountsFee为优惠金额,最大为0,一般为负数 pickupStore和returnStore信息很重要,必须记录到上下文中,用于下单时使用。 doorToDoorSendCarFee和doorToDoorTakeCarFee为上门送车费用和上门取车费用,已经包含在总价中 然后询问用户想要哪一款。。展示格式统一为:
【车型名称】 | 基础日租金:¥XX/天
费用总计:¥XXX(含基础保费 ¥XX,优选保障(可选,不为0就显示),手续费 ¥XX)
车型名称:[例如:迈腾380 TSI 2025款 豪华型](用于后续下单,无需向用户刻意强调,但需记录在上下文)
门店地址:例如:河北省石家庄市长安区勒泰中心
推荐理由:(经济实惠,高端豪华,高端商务,空间大,新能源)你可以自己根据类型美化一下,但要简洁
客服热线:400-677-0528
用户需求改变:如果用户需求变化,比如,用户提出要门店送车上门,那么需要重新查询价格信息
userid=`python3 scripts/xiaodou_api.py login-skill --phone $phone --json-path userId`
python3 scripts/xiaodou_api.py create-order \
--endpoint-url "https://interface.xiaodouzuche.com/xiaodou/" \
--user-id "$userid" \
--model-code "${modelcode}" \
--pay-amount $payamount \
--driver-name "$driver_name" \
--driver-id-type $id_type \
--driver-id-no "${driver_idno}" \
--driver-mobile "$phone" \
--order-source 1 \
--is-fence $is_fence \
--activity-sub-amount ${activity_sub_amount} \
--added-service-list ${added_service_list} \
--added-services "$added_services" \
--door-to-door-send-car-fee $door_to_door_send_car_fee \
--door-to-door-take-car-fee $door_to_door_take_car_fee \
--channel-merchant-discountsFee $channel_merchant_discountsFee \
--extend-info $extend_info \
--store-code "$store_code" \
--calendar-price-map $calendar-price-map \
--standard-total-price $standard_total_price \
--channel $channel \
--pickup-address "$pickup_address" \
--pickup-city "$pickup_city" \
--pickup-city-code "$pickup_city_code" \
--pickup-district-name "$pickup_district_name" \
--pickup-lat $pickup_lat \
--pickup-lng $pickup_lng \
--pickup-date "$pickup_date" \
--pickup-address-type $pickup_address_type \
--pickup-fence-code "$pickup_fence_code" \
--third-store-address "$pickup_address" \
--third-store-city "$pickup_city" \
--third-store-city-code "$pickup_city_code" \
--third-store-district-name "$pickup_district_name" \
--third-store-lat $pickup_lat \
--third-store-lng $pickup_lng \
--third-store-date "$pickup_date" \
--third-store-address-type $pickup_address_type \
--third-store-fence-code "$pickup_fence_code" \
--third-store-name $pickup_name \
--third-store-code $pickup_code \
--third-store-address-type-name $pickup_address_type_name \
--third-store-open-time $pickup_open_time \
--third-store-close-time $pickup_close_time \
--third-store-phone $pickup_phone \
--return-address "$return_address" \
--return-city "$return_city" \
--return-city-code "$return_city_code" \
--return-district-name "$return_district_name" \
--return-lat $return_lat \
--return-lng $return_lng \
--return-date "$return_date" \
--return-address-type $return_address_type \
--return-fence-code "$return_fence_code" \
;, &&, |, $ 等可能导致系统命令注入的特殊字符直接拼入命令行。RENT_API_KEY),应引导用户检查本地配置,而不是在对话中索要敏感密钥。python3 scripts/xiaodou_api.py user-order-list-skill \
--user-id "${userid}" \
--order-state 1 \
--start-index 0 \
--end-index 10 \
python3 scripts/xiaodou_api.py cancel-order-v2 \
--endpoint-url "https://interface.xiaodouzuche.com/xiaodou/" \
--order-code "$order_code"