From e6e4225f767f35a6d954948298fd8d63c71f2b66 Mon Sep 17 00:00:00 2001 From: Hai Liang Wang Date: Mon, 4 Oct 2021 20:09:22 +0800 Subject: [PATCH] https://github.com/kaiyuanshe/osschat/issues/163 pass room and username into query --- src/asker.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/asker.ts b/src/asker.ts index fbad4e5..fea3060 100644 --- a/src/asker.ts +++ b/src/asker.ts @@ -85,15 +85,19 @@ function asker (defaultOptions: ChatoperaOptions, repoConfig?: RepoConfig) { const options = await findOption(room?.id) if (!(options.clientId && options.secret)) { - return { botName: '', logic_is_fallback: true, logic_is_unexpected: true, service: { provider: 'BOT_NOT_DEF' }, state: '', string: '' } + return { botName: '', logic_is_fallback: true, logic_is_unexpected: true, service: { provider: 'BOT_NOT_DEF' }, state: '', string: '' } } const chatbot = new Chatbot(options.clientId, options.secret) + const extras = { room: false, username: '' } if (room) { + extras.username = contactId + extras.room = true contactId = `${await room.topic()}` } const cmdRes = await chatbot.command('POST', '/conversation/query', { + extras: extras, faqBestReplyThreshold: options.faqBestReplyThreshold, faqSuggReplyThreshold: options.faqSuggReplyThreshold, fromUserId: contactId,