Skip to content

Commit

Permalink
kaiyuanshe/osschat#163 pass room and username into query
Browse files Browse the repository at this point in the history
  • Loading branch information
Hai Liang Wang committed Oct 4, 2021
1 parent 009ee6f commit e6e4225
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/asker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e6e4225

Please sign in to comment.