<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ### 3.4.4 時間詢問 #### (1) 功能說明 時間詢問功能支持報時、詢問時間、日期、星期、農歷、生肖;時間差計算、時間單位的換算;判斷平閏年等;可識別日期、星期、農歷、節日、今/明天等;給用戶返回相應的時間結果。 #### (2) 接口說明 **請求方法** * POST **請求地址** * [http://api.ruyi.ai/v1/message](http://api.ruyi.ai/v1/message) **請求參數說明** | 參數名 | 參數類型 | 是否必須 | 參數說明 | | :--- | :--- | :---: | :--- | | q | String | 是 | 自然語言表達,例如“現在幾點了" | | app\_key | String | 是 | 應用開發者秘鑰,注冊開發者后臺賬號,建立虛擬助理后獲得 | | user\_id | String | 是 | 用戶唯一標識,便于支持個性化語義解析。建議開發者使用 UUID 字符,且不同用戶必須用不同的 user\_id,防止意圖串。 | #### (3) 返回說明 **返回參數說明** | 名稱 | 類型 | 說明 | | :--- | :--- | :--- | | code | Integer | 返回代碼 | | msg | String | 返回代碼描述 | | parameters | JSON Object | 解析到的實體以及服務說明 | | action | String | 服務的接口名稱 | | name | String | 匹配的意圖名稱 | | result | JSON Object | 接口返回內容 | | outputs | Array | 服務輸出結果,微信端使用 type 類型為 wechat 開頭的內容;硬件端收到所有內容,依據需求解析使用 | **返回代碼說明** | 返回代碼 | 錯誤類型 | 說明 | | :--- | :--- | :--- | | 0/200 | 成功 | 請求成功 | | 400 | 無效請求 | 某些必需參數缺失或參數值錯誤,詳見msg字段 | | 401 | 未授權 | 授權失敗,app\_key 缺失或錯誤 | | 403 | 請求被禁止 | 有效請求,但服務拒絕響應,請聯系contact@ruyi.ai | | 408 | 請求超時 | 請求響應超時,一般響應時間設置為2000ms以內 | | 429 | 短時間內大量訪問 | 短時間內請求數過多 | | 500 | 內部錯誤 | 服務處理異常 | | 503 | 服務不可用 | 服務異常或正在維護 | #### (4) 請求示例 **請求范例** _報時_ _今天幾號/周幾/農歷幾號_ _今年的年份/今年是什么生肖年_ _現在幾點\(默認北京時間\)_ _半小時后幾點_ _到元旦還有幾天_ _一小時等于多少分鐘_ _今年是閏年嗎_ _端午節是農歷幾月初幾/周幾/幾號_ _今天是什么節日_ **請求示例** (返回具體時刻、日期、農歷日期等信息) * [http://api.ruyi.ai/ruyi-api/v1/message?app\_key=APP\_KEY&user\_id=user0&q=現在幾點了](http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=現在幾點了) 返回結果 ```json { "code": 0, "msg": "ok", "result": { "_text": "現在幾點了", "msg_id": "d54ff04b-564e-4259-b54e-5528ec5893f1", "intents": [{ "parameters": { "time": "1481794490000", "city_from": "北京", "時刻": "幾點", "city_from_raw": "北京", "service": "time" }, "action": "sys.action.time/equation", "name": "時間詢問——沒有城市默認北京時間", "result": { "delta_hour": 0, "day_week": "星期四", "date2": "12月15號", "hour2": "17點34分", "month": 12, "day": 15, "lunar_date": "猴年冬月十七", "lunar_year": "猴", "lunar_month": "冬", "lunar_day": "十七", "text": "北京時間:17點34分 ", "type": "dialog" }, "outputs": [{ "type": "wechat.text", "property": { "text": "北京時間:17點34分 " } }, { "type": "dialog", "property": { "text": "北京時間17點34分 ", "emotion": "calm" } }], "score": "1.0", "scoreColor": "c4", "is_match": 1, "id": "55b1c7c2-8a3a-45f7-b67d-a79e3f4df851" }], "meta_process_milliseconds": 127 } } ``` **請求示例** (返回兩個時刻的時間差,第一個時間缺省默認為當下時間) * [http://api.ruyi.ai/ruyi-api/v1/message?app\_key=APP\_KEY&user\_id=user0&q=到元旦還有幾天](http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=到元旦還有幾天) 返回結果 ```json { "code": 0, "msg": "ok", "result": { "_text": "到元旦還有幾天", "msg_id": "9fe90626-3f41-4668-b151-f64d618a53f3", "intents": [{ "parameters": { "time2": "1483200000000", "service": "time" }, "action": "sys.action.time/diff", "name": "計算時間——單位日/天", "result": { "time2_day_week": "星期日", "lunar_date": "猴年臘月初四", "lunar_year": "猴", "lunar_month": "臘", "lunar_day": "初四", "time1": 1481794896468, "time2": 1483200000000, "timedelta": 1405103532, "timedeltaInSeconds": 1405103, "timedeltaInMinutes": 23418, "timedeltaInHours": 390, "timedeltaInDays": 16, "timedeltaInMonths": 1, "timedeltaInYears": 1, "text": " 16 天", "type": "dialog" }, "outputs": [{ "type": "wechat.text", "property": { "text": " 16 天" } }, { "type": "dialog", "property": { "text": " 16 天", "emotion": "calm" } }], "score": "1.0", "scoreColor": "c4", "is_match": 1, "id": "4ee1fcec-5b98-47a2-acbc-7a150fe531f6" }], "meta_process_milliseconds": 192 } } ``` **請求示例** (兩個時間單位的換算) * [http://api.ruyi.ai/ruyi-api/v1/message?app\_key=APP\_KEY&user\_id=user0&q=一天是多少小時](http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=一天是多少小時) 返回結果 ```json { "code": 0, "msg": "ok", "result": { "_text": "一天是多少小時", "msg_id": "4a3eb94c-6939-4585-911c-5f5521477961", "intents": [{ "parameters": { "timedelta": "86400000", "service": "time" }, "action": "sys.action.time/diff", "name": "換算為——小時", "result": { "time2_day_week": "星期五", "lunar_date": "猴年冬月十八", "lunar_year": "猴", "lunar_month": "冬", "lunar_day": "十八", "time1": 1481795169975, "time2": 1481881569975, "timedelta": 86400000, "timedeltaInSeconds": 86400, "timedeltaInMinutes": 1440, "timedeltaInHours": 24, "timedeltaInDays": 1, "timedeltaInMonths": 0, "timedeltaInYears": 0, "text": " 24 小時", "type": "dialog" }, "outputs": [{ "type": "wechat.text", "property": { "text": " 24 小時" } }, { "type": "dialog", "property": { "text": " 24 小時", "emotion": "calm" } }], "score": "1.0", "scoreColor": "c4", "is_match": 1, "id": "1589baed-4831-47d4-89d7-3a5520f1f36b" }], "meta_process_milliseconds": 188 } } ``` **請求示例** (判斷和閏年相關) * [http://api.ruyi.ai/ruyi-api/v1/message?app\_key=APP\_KEY&user\_id=user0&q=今年2月有多少天](http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=今年2月有多少天) 返回結果 ```json { "code": 0, "msg": "ok", "result": { "_text": "今年2月有多少天", "msg_id": "97b5b66d-bf48-427b-80eb-2f2bd30fe941", "intents": [{ "parameters": { "year": "2016", "service": "time" }, "action": "sys.action.time/leapyear", "name": "判斷二月有多少天", "result": { "year": "2016", "leapyear": "yes", "pre_leapyear": 2012, "next_leapyear": 2020, "text": "2016年 是閏年,二月有29天。", "type": "dialog" }, "outputs": [{ "type": "wechat.text", "property": { "text": "2016年 是閏年,二月有29天。" } }, { "type": "dialog", "property": { "text": "2016年 是閏年,二月有29天。", "emotion": "calm" } }], "score": "1.0", "scoreColor": "c4", "is_match": 1, "id": "75bab6f7-0300-4d8d-a8c5-4acbb34a96e9" }], "meta_process_milliseconds": 156 } } ``` **詳細參數說明** | 名稱 | 類型 | 說明 | | :--- | :--- | :--- | | service | String | 服務名稱 | | time | String | 識別的時間戳,Unix 格式 | | city\_from | String | 第一個城市 | | city\_t | String | 第二個城市 | | delta\_hour | String | 時差 | | day\_week | String | 星期幾 | | date2 | String | 返回日期 | | hour2 | String | 返回時刻 | | month | String | 月份 | | day | String | 幾號 | | lunar\_date | String | 農歷日期 | | lunar\_year | String | 生肖 | | lunar\_month | String | 農歷月份 | | lunar\_day | String | 農歷幾號 | | timedelta | Integer | 時間差,單位毫秒 | | timedeltaInSeconds | Integer | 時間差,單位秒 | | timedeltaInMinutes | Integer | 時間差,單位分鐘 | | timedeltaInHours | Integer | 時間差,單位小時 | | timedeltaInDays | Integer | 時間差,單位天 | | timedeltaInMonths | Integer | 時間差,單位月 | | timedeltaInMonths | Integer | 時間差,單位年 |
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看