@chatopera/sdk
Advanced tools
Comparing version 1.8.0 to 1.9.0
@@ -87,3 +87,3 @@ declare interface DetailResult { | ||
clientSecret: string, | ||
host: string = "https://bot.chatopera.com" | ||
host: string = 'https://bot.chatopera.com' | ||
); | ||
@@ -124,3 +124,3 @@ | ||
page: number = 1, | ||
sortby: string = "-lasttime" | ||
sortby: string = '-lasttime' | ||
): Promise<UserResult[]>; | ||
@@ -175,3 +175,3 @@ | ||
*/ | ||
intentSessionDetail(sessionId: string); | ||
intentSessionDetail(sessionId: string): Promise<IntentSessionResult>; | ||
@@ -178,0 +178,0 @@ /** |
18
index.js
@@ -106,3 +106,3 @@ /** | ||
*/ | ||
faq(userId, textMessage) { | ||
faq(userId, textMessage, faq_best_reply, faq_sugg_reply) { | ||
let endpoint = `${basePath}/${this.clientId}/faq/query`; | ||
@@ -130,3 +130,5 @@ return request | ||
fromUserId: userId, | ||
query: textMessage | ||
query: textMessage, | ||
faq_sugg_reply: faq_sugg_reply, | ||
faq_best_reply: faq_best_reply | ||
}) | ||
@@ -142,3 +144,9 @@ .then(successHandler, failHandler); | ||
*/ | ||
conversation(userId, textMessage, isDebug = false) { | ||
conversation( | ||
userId, | ||
textMessage, | ||
faq_best_reply, | ||
faq_sugg_reply, | ||
isDebug = false | ||
) { | ||
debug("conversation userId %s, textMessage %s", userId, textMessage); | ||
@@ -168,3 +176,5 @@ let endpoint = `${basePath}/${this.clientId}/conversation/query`; | ||
textMessage: textMessage, | ||
isDebug: isDebug | ||
isDebug: isDebug, | ||
faq_best_reply: faq_best_reply, | ||
faq_sugg_reply: faq_sugg_reply | ||
}) | ||
@@ -171,0 +181,0 @@ .then(successHandler, failHandler); |
{ | ||
"name": "@chatopera/sdk", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "Official sdk of Chatopera", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -92,5 +92,13 @@ <p align="center"> | ||
``` | ||
var reply = await chatbot.conversation("张三", "今天北京天气怎么样"); | ||
var reply = await chatbot.conversation("张三", "今天北京天气怎么样", 0.8, 0.6); | ||
``` | ||
参数说明: | ||
| name | type | sample | description | | ||
| --- | --- | --- | --- | | ||
| userid | String | 张三 | 必填,代表该用户的唯一标识 | | ||
| query | String | 今天北京天气怎么样 | 必填,用户的文字消息 | | ||
| faq_best_reply | Number | 0.8 | 选填,最佳回复的阀值,(0,1)区间,默认值 0.8 | | ||
| faq_sugg_reply | Number | 0.6 | 选填,建议回复的阀值,(0, faq_best_reply) 区间,默认值 0.6 | | ||
返回值 | ||
@@ -118,5 +126,13 @@ | ||
``` | ||
var reply = await chatbot.faq("张三", "停效期间的保单是否能办理减保"); | ||
var reply = await chatbot.faq("张三", "停效期间的保单是否能办理减保", 0.8, 0.6); | ||
``` | ||
参数说明: | ||
| name | type | sample | description | | ||
| --- | --- | --- | --- | | ||
| userid | String | 张三 | 必填,代表该用户的唯一标识 | | ||
| query | String | 停效期间的保单是否能办理减保 | 必填,用户的文字消息 | | ||
| faq_best_reply | Number | 0.8 | 选填,最佳回复的阀值,(0,1)区间,默认值 0.8 | | ||
| faq_sugg_reply | Number | 0.6 | 选填,建议回复的阀值,(0, faq_best_reply) 区间,默认值 0.6 | | ||
返回值 | ||
@@ -136,4 +152,6 @@ | ||
说明:返回值为数组,*id*代表问答对 ID,*score*是相似度分数,*reply*是回复。在含有多个元素时按*score*降序排列,*score*的分数在[0,1]之间,越接近 1 越相似。 | ||
说明:返回值为数组,*id*代表问答对 ID,*score*是相似度分数,*reply*是回复。 | ||
在含有多个元素时按*score*降序排列,*score*的分数在[0,1]之间,越接近 1 越相似。 | ||
### 进行意图识别对话 | ||
@@ -140,0 +158,0 @@ |
50514
13
926
357