2017-01-13 81 views
0

我正在使用Blumix免費帳戶來使用watson會話來發布聊天機器人。在watson會話中打開URL

如何做到這一點:在響應中添加可點擊的網址,或自動在瀏覽器中調用URL?

我已經editted「高級響應」使用的建議在這裏(但沒有工作): https://developer.ibm.com/answers/questions/306133/want-to-enter-and-url-in-watson-conversation-respo.html

知道如何實現這一目標?謝謝!

問候, 打碼機

+0

嗨,你使用什麼編程語言? Node.js,java? –

+0

我正在使用GUI界面,即我不需要爲它編寫代碼。示例界面:https://cdn-images-1.medium.com/max/800/1*MYDX5bGngxJ6ntTziWt2Fg.png – codeonthebeach

回答

2

,如果你想加入,我不知道如果我理解正確你的問題,但..某些URL inside流會話服務(IBM沃森),試試吧:

1º:添加標記爲<a target>href=的網址,您的URL位於流內。見例如:

enter image description here

JSON:

"output": { 
      "text": "This is a link <a target=\"_blank\" href= \"https://www.choosemyplate.gov\">Food and nutrition Guide</a>.\n<br/><br/>Talk to you later, bye for now!" 
     }, 

2º看到它沒有工作對話,因爲這將是你的瀏覽器將renderhtml

enter image description here

3º如果你與你的瀏覽器中打開,它的工作原理,請參閱:

enter image description here

看到該鏈接被顯示出來,這將在其他事情的工作HTML,像按鈕,例如...

但如果你可以:根據用戶輸入應該訪問一個url:

這是通過使用兩個特徵完成:Context.requestskip_user_input

請求是具有指定參數時,名稱和結果的特殊上下文變量。它用於告訴calling app它應該根據這個變量做一些操作。

設置skip_user_input是可選的。在很多情況下,您可能希望在應用程序中執行一些業務邏輯,然後通過result提供結果。將skip_user_input設置爲true,會告訴Watson對話不會等待來自用戶的輸入。因此,您在下一個節點上的條件應該基於結果中的內容。

{ 
     "output": {}, 
     "context": { 
     "request": { 
      "args": { 
      "url_to_invoke": "your_url" 


    }, 
     "name": "Call_A_URL", 
     "result": "context.response" 
    }, 
    "skip_user_input": true 
    } 
} 

參考:IBM專業@Dudihere