最初版本
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
sudo docker exec guest-chat bundle exec rails runner "
|
||||
email = 'admin@localhost.local'
|
||||
password = 'LocalCw#168'
|
||||
greeting = '您好,欢迎光临【49彩票集团】客服服务中心,请问有什么可以帮到您的呢?'
|
||||
|
||||
account = Account.first || Account.create!(name: '本地客服', locale: 'zh_TW')
|
||||
user = User.find_by(email: email)
|
||||
unless user
|
||||
user = User.new(name: '本地管理员', email: email, password: password, password_confirmation: password)
|
||||
user.save!
|
||||
AccountUser.create!(account: account, user: user, role: :administrator)
|
||||
end
|
||||
|
||||
inbox = account.inboxes.first
|
||||
unless inbox
|
||||
channel = Channel::WebWidget.create!(
|
||||
account: account,
|
||||
website_url: 'http://www.pubuli.com:7777',
|
||||
widget_color: '#E53935',
|
||||
welcome_title: '',
|
||||
welcome_tagline: greeting,
|
||||
pre_chat_form_enabled: false
|
||||
)
|
||||
inbox = Inbox.create!(account: account, name: '49彩票集团客服', channel: channel, greeting_enabled: true, greeting_message: greeting)
|
||||
end
|
||||
|
||||
bot = AgentBot.find_by(name: 'AI 客服') || AgentBot.create!(name: 'AI 客服', outgoing_url: 'http://127.0.0.1:7788/webhook/bot1/chatwoot', account: account)
|
||||
AgentBotInbox.find_or_create_by!(inbox: inbox, agent_bot: bot, account: account)
|
||||
|
||||
puts \"OK account=#{account.id} inbox=#{inbox.id} token=#{inbox.channel.website_token} bot_url=#{bot.outgoing_url}\"
|
||||
"
|
||||
Reference in New Issue
Block a user