왓슨 개발자 클라우드에서 iOS SDK을 사용한다고 가정합니다. 당신의 대화에
, 노드에 추가 :
{
"context": {
"myVariable": "<? input.text ?>"
},
"output": {
"text": {
"values": [
"My context variable value is $myVariable."
],
"selection_policy": "sequential"
}, { "etc": "etc" }
것을 제외 : input.text
는 모든 사용자 유형을 캡처합니다, 당신은 정확하게 당신이 원하는 무엇을 보려고 추출물에 대한 정규식을 사용할 필요가 내 this answer의 예. 이 예에 따라 볼 수있는 아이폰 OS SDK에
그리고 : 그래서
func testMessage() {
let description1 = "Start a conversation."
let expectation1 = self.expectation(description: description1)
let response1 = ["Hi. It looks like a nice drive today. What would you like me to do?"]
let nodes1 = ["node_1_1467221909631"]
var context: Context?
conversation.message(workspaceID: workspaceID, failure: failWithError) {
response in
// verify input
XCTAssertNil(response.input?.text)
// verify context
XCTAssertNotNil(response.context.conversationID)
XCTAssertNotEqual(response.context.conversationID, "")
XCTAssertNotNil(response.context.system)
XCTAssertNotNil(response.context.system.additionalProperties)
XCTAssertFalse(response.context.system.additionalProperties.isEmpty)
// verify entities
XCTAssertTrue(response.entities.isEmpty)
// verify intents
XCTAssertTrue(response.intents.isEmpty)
// verify output
XCTAssertTrue(response.output.logMessages.isEmpty)
XCTAssertEqual(response.output.text, response1)
XCTAssertEqual(response.output.nodesVisited!, nodes1)
context = response.context
expectation1.fulfill()
}
, 당신은 사용하여 환경 변수에 액세스 할 수 있습니다
스택 오버플로에 오신 것을 환영합니다. [둘러보기] (https://stackoverflow.com/tour)를 보내주십시오. – Xcoder