当前位置: 首页 > news >正文

chatwoot 开源客服系统搭建

1. 准备开源客服系统(我是用的Chatwoot )

可以选择以下开源客服系统作为基础:

  • Chatwoot: 开源,多语言,跟踪和分析,支持多渠道客户对接,自动化和工作流等。源码
  • Zammad: 现代的开源工单系统。
  • FreeScout: 免费且轻量化的 Help Desk 系统。

Chatwoot 移动应用项目常见问题解决方案。


2. 创建 Docker 配置文件

  • 创建chatwoot目录
mkdir chatwoot
cd chatwoot
# 新建docker挂载的子目录
mkdir -p ./{postgres,redis,storage}
# 给chatwoot目录授权
chmod -R 777 chatwoot
  • 在chatwoot目录下创建一个 docker-compose.yml 文件来定义服务:
version: '3'services:base: &baseimage: chatwoot/chatwoot:latest#container_name: chatwoot-baseenv_file: env.txt ## Change this file for customized env variablesvolumes:- ./storage:/app/storagerails:<<: *basedepends_on:- postgres- redisports:- 3000:3000environment:- NODE_ENV=production- RAILS_ENV=production- INSTALLATION_ENV=dockerentrypoint: docker/entrypoints/rails.shcommand: ['bundle', 'exec', 'rails', 's', '-p', '3000', '-b', '0.0.0.0']sidekiq:<<: *basedepends_on:- postgres- redisenvironment:- NODE_ENV=production- RAILS_ENV=production- INSTALLATION_ENV=dockercommand: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml']postgres:image: postgres:14container_name: chatwoot-postgresrestart: always#ports:#  - 5432:5432volumes:- ./postgres:/var/lib/postgresql/dataenvironment:- POSTGRES_DB=chatwoot- POSTGRES_USER=postgres# Please provide your own password.- POSTGRES_PASSWORD=数据库密码redis:image: redis:6.2-alpinecontainer_name: chatwoot-redisrestart: alwayscommand: ["sh", "-c", "redis-server --requirepass \"$REDIS_PASSWORD\""]env_file: env.txtvolumes:- ./redis:/data#ports:#  - 6379:6379#  middleware:
#    build: ./middleware
#    restart: always
#    ports:
#      - "4000:4000"
#    environment:
#      - CHATWOOT_BOT_TOKEN=你的CHATWOOT机器人token
#      - CHATWOOT_URL=http://CHATWOOT的ip:3000
#      - RASA_URL=http://RASA的ip:5005
  • 在chatwoot目录下创建一个 env.txt文件来定义服务配置:
# Learn about the various environment variables at
# https://www.chatwoot.com/docs/self-hosted/configuration/environment-variables/#rails-production-variables# Used to verify the integrity of signed cookies. so ensure a secure value is set
# SECRET_KEY_BASE should be alphanumeric. Avoid special characters or symbols. 
# Use `rake secret` to generate this variable
SECRET_KEY_BASE=6eONF6WVhCjbsPMOawORdTF0MccxXgheFvklSzH5ud0=# Replace with the URL you are planning to use for your app
FRONTEND_URL=https://你的ip:3000
# To use a dedicated URL for help center pages
# HELPCENTER_URL=http://0.0.0.0:3000# If the variable is set, all non-authenticated pages would fallback to the default locale.
# Whenever a new account is created, the default language will be DEFAULT_LOCALE instead of en
# DEFAULT_LOCALE=en# If you plan to use CDN for your assets, set Asset CDN Host
ASSET_CDN_HOST=# Force all access to the app over SSL, default is set to false
FORCE_SSL=false# This lets you control new sign ups on your chatwoot installation
# true : default option, allows sign ups
# false : disables all the end points related to sign ups
# api_only: disables the UI for signup, but you can create sign ups via the account apis
ENABLE_ACCOUNT_SIGNUP=false# Redis config
# specify the configs via single URL or individual variables
# ref: https://www.iana.org/assignments/uri-schemes/prov/redis
# You can also use the following format for the URL: redis://:password@host:port/db_number
REDIS_URL=redis://redis:6379
# If you are using docker-compose, set this variable's value to be any string,
# which will be the password for the redis service running inside the docker-compose
# to make it secure
REDIS_PASSWORD=
# Redis Sentinel can be used by passing list of sentinel host and ports e,g. sentinel_host1:port1,sentinel_host2:port2
REDIS_SENTINELS=
# Redis sentinel master name is required when using sentinel, default value is "mymaster".
# You can find list of master using "SENTINEL masters" command
REDIS_SENTINEL_MASTER_NAME=# By default Chatwoot will pass REDIS_PASSWORD as the password value for sentinels
# Use the following environment variable to customize passwords for sentinels.
# Use empty string if sentinels are configured with out passwords
# REDIS_SENTINEL_PASSWORD=# Redis premium breakage in heroku fix
# enable the following configuration
# ref: https://github.com/chatwoot/chatwoot/issues/2420
# REDIS_OPENSSL_VERIFY_MODE=none# Postgres Database config variables
# You can leave POSTGRES_DATABASE blank. The default name of
# the database in the production environment is chatwoot_production
# POSTGRES_DATABASE=
POSTGRES_HOST=postgres
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=postgres
RAILS_ENV=development
# Changes the Postgres query timeout limit. The default is 14 seconds. Modify only when required.
# POSTGRES_STATEMENT_TIMEOUT=14s
RAILS_MAX_THREADS=5# The email from which all outgoing emails are sent
# could user either  `email@yourdomain.com` or `BrandName <email@yourdomain.com>`
MAILER_SENDER_EMAIL=Chatwoot <chatwoot@qq.com>SMTP_DOMAIN=qq.com
# Set the value to "mailhog" if using docker-compose for development environments,
# Set the value as "localhost" or your SMTP address in other environments
# If SMTP_ADDRESS is empty, Chatwoot would try to use sendmail(postfix)
SMTP_ADDRESS=
SMTP_PORT=
SMTP_USERNAME=
SMTP_PASSWORD=
# plain,login,cram_md5
SMTP_AUTHENTICATION=login
SMTP_ENABLE_STARTTLS_AUTO=true
SMTP_DEBUG_OUTPUT=true
# Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see http://api.rubyonrails.org/classes/ActionMailer/Base.html
SMTP_OPENSSL_VERIFY_MODE=none
RAILS_MAILER_TIMEOUT=60
# Comment out the following environment variables if required by your SMTP server
#SMTP_TLS=false
#SMTP_SSL=false
# SMTP_OPEN_TIMEOUT
# SMTP_READ_TIMEOUT# Mail Incoming
# This is the domain set for the reply emails when conversation continuity is enabled
MAILER_INBOUND_EMAIL_DOMAIN=
# Set this to the appropriate ingress channel with regards to incoming emails
# Possible values are :
# relay for Exim, Postfix, Qmail
# mailgun for Mailgun
# mandrill for Mandrill
# postmark for Postmark
# sendgrid for Sendgrid
RAILS_INBOUND_EMAIL_SERVICE=
# Use one of the following based on the email ingress service
# Ref: https://edgeguides.rubyonrails.org/action_mailbox_basics.html
# Set this to a password of your choice and use it in the Inbound webhook
RAILS_INBOUND_EMAIL_PASSWORD=MAILGUN_INGRESS_SIGNING_KEY=
MANDRILL_INGRESS_API_KEY=# Creating Your Inbound Webhook Instructions for Postmark and Sendgrid:
# Inbound webhook URL format:
#    https://actionmailbox:[YOUR_RAILS_INBOUND_EMAIL_PASSWORD]@[YOUR_CHATWOOT_DOMAIN.COM]/rails/action_mailbox/[RAILS_INBOUND_EMAIL_SERVICE]/inbound_emails
# Note: Replace the values inside the brackets; do not include the brackets themselves.
# Example: https://actionmailbox:mYRandomPassword3@chatwoot.example.com/rails/action_mailbox/postmark/inbound_emails
# For Postmark
# Ensure the 'Include raw email content in JSON payload' checkbox is selected in the inbound webhook section.# Storage
ACTIVE_STORAGE_SERVICE=local# Amazon S3
# documentation: https://www.chatwoot.com/docs/configuring-s3-bucket-as-cloud-storage
S3_BUCKET_NAME=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=# Log settings
# Disable if you want to write logs to a file
RAILS_LOG_TO_STDOUT=true
LOG_LEVEL=info
LOG_SIZE=500
# Configure this environment variable if you want to use lograge instead of rails logger
#LOGRAGE_ENABLED=true### This environment variables are only required if you are setting up social media channels# Facebook
# documentation: https://www.chatwoot.com/docs/facebook-setup
FB_VERIFY_TOKEN=
FB_APP_SECRET=
FB_APP_ID=# https://developers.facebook.com/docs/messenger-platform/instagram/get-started#app-dashboard
IG_VERIFY_TOKEN=# Twitter
# documentation: https://www.chatwoot.com/docs/twitter-app-setup
TWITTER_APP_ID=
TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_ENVIRONMENT=#slack integration
SLACK_CLIENT_ID=
SLACK_CLIENT_SECRET=# Google OAuth
GOOGLE_OAUTH_CLIENT_ID=
GOOGLE_OAUTH_CLIENT_SECRET=
GOOGLE_OAUTH_CALLBACK_URL=### Change this env variable only if you are using a custom build mobile app
## Mobile app env variables
IOS_APP_ID=L7YLMN4634.com.chatwoot.app
ANDROID_BUNDLE_ID=com.chatwoot.app# https://developers.google.com/android/guides/client-auth (use keytool to print the fingerprint in the first section)
ANDROID_SHA256_CERT_FINGERPRINT=AC:73:8E:DE:EB:56:EA:CC:10:87:02:A7:65:37:7B:38:D4:5D:D4:53:F8:3B:FB:D3:C6:28:64:1D:AA:08:1E:D8### Smart App Banner
# https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html
# You can find your app-id in https://itunesconnect.apple.com
#IOS_APP_IDENTIFIER=1495796682## Push Notification
## generate a new key value here : https://d3v.one/vapid-key-generator/
# VAPID_PUBLIC_KEY=
# VAPID_PRIVATE_KEY=
#
# for mobile apps
# FCM_SERVER_KEY=### APM and Error Monitoring configurations
## Elastic APM
## https://www.elastic.co/guide/en/apm/agent/ruby/current/getting-started-rails.html
# ELASTIC_APM_SERVER_URL=
# ELASTIC_APM_SECRET_TOKEN=## Sentry
# SENTRY_DSN=## Scout
## https://scoutapm.com/docs/ruby/configuration
# SCOUT_KEY=YOURKEY
# SCOUT_NAME=YOURAPPNAME (Production)
# SCOUT_MONITOR=true## NewRelic
# https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration/
# NEW_RELIC_LICENSE_KEY=
# Set this to true to allow newrelic apm to send logs.
# This is turned off by default.
# NEW_RELIC_APPLICATION_LOGGING_ENABLED=## Datadog
## https://github.com/DataDog/dd-trace-rb/blob/master/docs/GettingStarted.md#environment-variables
# DD_TRACE_AGENT_URL=# MaxMindDB API key to download GeoLite2 City database
# IP_LOOKUP_API_KEY=## Rack Attack configuration
## To prevent and throttle abusive requests
# ENABLE_RACK_ATTACK=true
# RACK_ATTACK_LIMIT=300
# ENABLE_RACK_ATTACK_WIDGET_API=true## Running chatwoot as an API only server
## setting this value to true will disable the frontend dashboard endpoints
# CW_API_ONLY_SERVER=false## Development Only Config
# if you want to use letter_opener for local emails
# LETTER_OPENER=true
# meant to be used in github codespaces
# WEBPACKER_DEV_SERVER_PUBLIC=# If you want to use official mobile app,
# the notifications would be relayed via a Chatwoot server
ENABLE_PUSH_RELAY_SERVER=true# Stripe API key
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=# Set to true if you want to upload files to cloud storage using the signed url
# Make sure to follow https://edgeguides.rubyonrails.org/active_storage_overview.html#cross-origin-resource-sharing-cors-configuration on the cloud storage after setting this to true.
DIRECT_UPLOADS_ENABLED=#MS OAUTH creds
AZURE_APP_ID=
AZURE_APP_SECRET=## Advanced configurations
## Change these values to fine tune performance
# control the concurrency setting of sidekiq
# SIDEKIQ_CONCURRENCY=10# AI powered features
## OpenAI key
# OPENAI_API_KEY=# Housekeeping/Performance related configurations
# Set to true if you want to remove stale contact inboxes
# contact_inboxes with no conversation older than 90 days will be removed
# REMOVE_STALE_CONTACT_INBOX_JOB_STATUS=false
  • 在env.txt文件中配置好以下参数:
SECRET_KEY_BASE=你的系统令牌ley (可以用命令 openssl rand -base64 32 来生成)
FRONTEND_URL=https://你的ip:3000 (前端地址,根据实际情况填写)
HELPCENTER_URL=https://你的ip:3000 (帮助中心地址,可以和FRONTEND_URL一样)
REDIS_URL=redis://password@redis:6379/1 (redis://:password@host:port/db_number)
REDIS_PASSWORD=redis密码
POSTGRES_HOST=postgres
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=(数据库密码,需与docker-compose.yaml中的postgres数据库密码保持一致)

3. 启动服务

通过运行迁移来准备数据库

# `docker compose` 是新版 cli 命令,如果执行不了,就换成 `docker-compose`
# 即 `docker-compose run --rm rails bundle exec rails db:chatwoot_prepare` 
docker compose run --rm rails bundle exec rails db:chatwoot_prepare
 

ubuntu@ubuntu:~/chatwoot$ docker compose run --rm rails bundle exec rails db:chatwoot_prepare
[+] Creating 2/2✔ Container chatwoot-postgres-1  Recreated                                                                                                                             0.1s
.....
fatal: not a git repository (or any of the parent directories): .git
Created database 'chatwoot_production'
ubuntu@ubuntu:~/chatwoot$

当看到 Created database 'chatwoot_production' 即表示创建成功,继续执行下面的命令

docker-compose down &&  docker-compose up -d

 使用浏览器管理后台访问:http://你的ip:3000/     

 注意事项

  • 第一次进来先要初始化账号信息,设置好系统语言

超级管理员后台:http://你的ip:3000/super_admin

设置中文:Settings --> Account Setting --> Site language ,下拉找到简体中文

创建web收件箱,按照步骤正确填写信息后创建

创建收件箱最后一步,生成 script 代码

将生成的js代码放到你的html中

最后效果


4. 扩展功能

  • 对接邮箱功能(env.txt 文件中配置好以下参数:
# 发送者,格式:“好日子 <123456789@qq.com>”  或  123456789@qq.com
MAILER_SENDER_EMAIL=好日子 <123456789@qq.com>
# SMTP 邮件服务器域名(例:qq.com,gmail.com)
SMTP_DOMAIN=cannmax.vip
# SMTP 邮件服务器地址(例:qq邮箱:smtp.qq.com,谷歌:smtp.gmail.com)
SMTP_ADDRESS=
# 587(TLS)或 465(SSL)
SMTP_PORT=
# 邮箱账号
SMTP_USERNAME=
# 邮箱密码或授权码(根据邮箱服务器规则去填,例:qq邮箱为邮箱授权码,)
SMTP_PASSWORD=
# 邮箱服务器SMTP 认证方式,通常为 plain,参数有plain,login,cram_md5
SMTP_AUTHENTICATION=login
# 是否使用TLS协议发送邮件
SMTP_ENABLE_STARTTLS_AUTO=true
# 开启debug调式(有些邮箱必须在debug情况下才能使用)
SMTP_DEBUG_OUTPUT=true
# 是否有ssl校验 Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see 
SMTP_OPENSSL_VERIFY_MODE=none
#发送等待时长
RAILS_MAILER_TIMEOUT=60
# 如果SMTP服务器需要,则注释掉以下环境变量
#SMTP_TLS=false
#SMTP_SSL=false

注意:

  • 如果使用 Gmail 或 QQ 邮箱,需要启用“允许低安全性应用访问”或使用授权码而非直接密码。
  • 配置中邮箱和密码需与 SMTP 服务一致。
  • 自定义机器人
        1.生成chatwoot机器人token

方式一:通过超级管理员后台(http://你的ip:3000/super_admin),生成机器人token

 

方式二:通过 Rails控制台创建代理机器人

  • 进入rails容器
 docker exec -it chatwoot-rails-1 sh
  • 启动 rails 控制台
bundle exec rails c
  • 在 Rails 控制台中,输入以下命令来创建代理机器人并获取其访问令牌。保存检索到的令牌(token),因为在调用 chatwoot API 时需要使用它。
# 在驻留bot逻辑时指定url
# 如果传参了account_id属性来创建帐户bot,而不是全局bot
bot = AgentBot.create!(name: "机器人名", outgoing_url: "http://localhost:8000")
bot.access_token.token
  • 为您的机器人添加头像(可选)
avatar_file = Down.download("image url 你的头像图片链接")
bot.avatar.attach(io: avatar_file, filename: avatar_file.original_filename, content_type: avatar_file.content_type)
  • 通过运行以下命令将 Agent Bot 连接到您的收件箱
# 取代的收件箱。首先使用Inbox.find(inbox_id)查找特定的收件箱
AgentBotInbox.create!(inbox: Inbox.first, agent_bot: bot)
        2.创建智能机器人对话服务系统(我用的是rasa)

部署文件我已经全部压缩,直接运行即可,下面是部署文件下载地址:https://download.csdn.net/download/ko_10086/90192098

注意:

     想更多了解rasa,请百度,我这里就不细讲了。

     我的对话模型仅为测试模型,如需替换成其它模型,将模型下载地址替换,重新运行即可

        4.测试 rasa服务API

使用postman或者Apifox测试

curl -X POST http://你的rasa的Ip:5005/webhooks/rest/webhook \-H "Content-Type: application/json" \-d '{"sender": "test_user", "message": "hello"}'

预期响应:

[{"recipient_id": "test_user","text": "Hey! How are you?"}
]
        3.rasa与 chatwoot整合对接
  • 在chatwoot目录下创建middleware
  • 在middleware目录下创建一个app.py,来执行rasa与 chatwoot的交互
# middleware/app.pyfrom flask import Flask, request,jsonify
import requests
import os
app = Flask(__name__)CHATWOOT_BOT_TOKEN = os.getenv("CHATWOOT_BOT_TOKEN")
CHATWOOT_URL  = os.getenv("CHATWOOT_URL")RASA_URL = os.getenv("RASA_URL")@app.route('/rasa', methods=['POST'])
def rasa():data = request.get_json()event = data.get('event')if 'message_created' == event:message_type = data['message_type']message = data['content']conversation = data['conversation']['id']contact = data['sender']['id']account = data['account']['id']if (message_type == "incoming"):bot_response = send_to_bot(contact, message)create_message = send_to_chatwoot(account, conversation, bot_response)print(create_message)if 'automation_event.message_created' == event:message = data['messages'][0]['content']conversation = data['messages'][0]['conversation_id']contact = data['messages'][0]['sender']['id']account = data['messages'][0]['account_id']message_type = data['messages'][0]['message_type']if (message_type == 0):bot_response = send_to_bot(contact, message)create_message = send_to_chatwoot(account, conversation, bot_response)print(create_message)return jsonify({"status": "success"}), 200def send_to_bot(sender, message):data = {'sender': sender,'message': message}headers = {"Content-Type": "application/json","Accept": "application/json"}r = requests.post(f'{RASA_URL}/webhooks/rest/webhook',json=data, headers=headers)return r.json()[0]['text']def send_to_chatwoot(account, conversation, message):data = {'content': message}url = f"{CHATWOOT_URL}/api/v1/accounts/{account}/conversations/{conversation}/messages"headers = {"Content-Type": "application/json","Accept": "application/json","api_access_token": f"{CHATWOOT_BOT_TOKEN}"}r = requests.post(url,json=data, headers=headers)return r.json()if __name__ == '__main__':app.run(host='0.0.0.0', port=4000)
  • 在middleware目录下创建一个 requirements.txt 文件来导入app.py相关工具
Flask
requests
  • 在middleware目录下创建一个Dockerfile 文件来构建服务
# middleware/DockerfileFROM python:3.8-slimWORKDIR /appCOPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --upgrade Jinja2 FlaskCOPY app.py .CMD ["python", "app.py"]
  • chatwoot目录下的 docker-compose.yml 文件里加上middleware服务(上面已经加上了,取消注释即可),然后运行,如果运行不了,就单写一个docker-compose.yml文件来运行middleware服务
  • 运行命令:docker-compose down &&  docker-compose up -d --build
4.测试智能机器人 
  • chatwoot的收件箱绑定好上面配置好的机器人

  • 在集成方式里面配置rasachatwoot交互的api,并选中对应交互事件

  • 然后去客户端发送消息测试即可,如以下这样

  • 还有一种配置rasachatwoot交互的api的方式,即在Automation配置规则

两种方式都是一样的

  • 队列分析和监控

http://你chatwoot的ip:3000/monitoring/sidekiq

相关文章:

chatwoot 开源客服系统搭建

1. 准备开源客服系统&#xff08;我是用的Chatwoot &#xff09; 可以选择以下开源客服系统作为基础&#xff1a; Chatwoot: 开源&#xff0c;多语言&#xff0c;跟踪和分析&#xff0c;支持多渠道客户对接&#xff0c;自动化和工作流等。源码Zammad: 现代的开源工单系统。Fr…...

Ungoogled Chromium127编译指南 Linux篇 - 安装Docker(六)

1. 引言 在了解了Docker的重要性后&#xff0c;我们需要在系统中正确安装和配置Docker环境。Docker的安装过程看似简单&#xff0c;但要确保其能够完美支持Ungoogled Chromium的编译&#xff0c;还需要进行一些特殊的配置。本文将详细介绍如何在Ubuntu系统上安装Docker&#x…...

试用ChatGPT的copilot编写一个程序从笔记本电脑获取语音输入和图像输入并调用开源大模型进行解析

借助copilot写代码和自己手写代码的开发过程是一样的。 首先要有明确的开发需求&#xff0c;开发需求越详细&#xff0c;copilot写出的代码才能越符合我们的预期。 其次&#xff0c;有了明确的需求&#xff0c;最好先做下需求拆解&#xff0c;特别是对于比较复杂的应用&#xf…...

Kafka 性能提升秘籍:涵盖配置、迁移与深度巡检的综合方案

文章目录 1.1.网络和io操作线程配置优化1.2.log数据文件刷盘策略1.3.日志保留策略配置1.4.replica复制配置1.5.配置jmx服务1.6.系统I/O参数优化1.6.1.网络性能优化1.6.2.常见痛点以及优化方案1.6.4.优化参数 1.7.版本升级1.8.数据迁移1.8.1.同集群broker之间迁移1.8.2.跨集群迁…...

2024年常用工具

作为本年度高频使用工具&#xff0c;手机端也好&#xff0c;桌面端也好&#xff0c;筛选出来9款产品&#xff0c;这里也分享给关注我的小伙伴 &#xff0c;希望对你有些帮助&#xff0c;如果你更好的产品推荐&#xff0c;欢迎留言给我。 即刻 产品经理的聚集地&#xff0c;“让…...

在Linux系统中使用字符图案和VNC运行Qt Widgets程序

大部分服务器并没有GUI&#xff0c;运行的是基础的Linux系统&#xff0c;甚至是容器。如果我们需要在这些系统中运行带有GUI功能的Qt程序&#xff0c;一般情况下就会报错&#xff0c;比如&#xff1a; $ ./collidingmice qt.qpa.xcb: could not connect to display qt.qpa.plu…...

kafka使用常见问题

连接不上kafka,报下边的错 org.apache.kafka.common.KafkaException: Producer is closed forcefully.at org.apache.kafka.clients.producer.internals.RecordAccumulator.abortBatches(RecordAccumulator.java:760) [kafka-clients-3.0.2.jar:na]at org.apache.kafka.client…...

Springboot项目:使用MockMvc测试get和post接口(含单个和多个请求参数场景)

一、引入MockMvc依赖 使用MockMvc&#xff0c;必须要引入依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency>二、具体演示…...

mysql_real_connect的概念和使用案例

mysql_real_connect 是 MySQL C API 中的一个函数&#xff0c;用于建立一个到 MySQL 数据库服务器的连接。这个函数尝试建立一个连接&#xff0c;并根据提供的参数进行连接设置。 概念 以下是 mysql_real_connect 函数的基本概念&#xff1a; 函数原型&#xff1a;MYSQL *my…...

单片机--51- RAM

1.概览某个51单片机对空间区域的划分&#xff1a; 2.RAM被分配的区域是256bytes&#xff0c; 通常8051单片机ram是128bytes 8052的ram是256bytes&#xff08;其中高128位的地址和sfr区域地址重合&#xff0c;物理区域不同&#xff09; extern uint32_t alarm_cnt_1; uint32…...

【机器学习】梯度下降

文章目录 1. 梯度下降概念2. 梯度下降的技巧2.1 动态设置学习率2.2 Adagrad调整梯度2.3 随机梯度下降&#xff08;SGD&#xff09;2.4 特征缩放 3. 梯度下降理论基础 1. 梯度下降概念 梯度&#xff1a;Loss 对参数在某一点的偏微分&#xff0c;函数沿梯度的方向具有最大的变化…...

攻防世界web第十题Web_python_template_injection

这是题目&#xff0c;从题目上看是一个python模板注入类型的题目。 首先测试是否存在模板注入漏洞&#xff0c;构造http://61.147.171.105:57423/{{config}} 得到 说明存在模板注入漏洞&#xff0c;继续注入 构造http://61.147.171.105:57423/{{‘’.class.mro}}: 得到 再构造…...

【《python爬虫入门教程11--重剑无峰168》】

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 【《python爬虫入门教程11--selenium的安装与使用》】 前言selenium就是一个可以实现python自动化的模块 一、Chrome的版本查找&#xff1f;-- 如果用edge也是类似的1.chrome…...

VUE echarts 教程二 折线堆叠图

VUE echarts 教程一 折线图 import * as echarts from echarts;var chartDom document.getElementById(main); var myChart echarts.init(chartDom); var option {title: {text: Stacked Line},tooltip: {trigger: axis},legend: {data: [Email, Union Ads, Video Ads, Dir…...

gitlab的搭建及使用

1、环境准备 服务器准备 CentOS Linux release 7.9.2009 (Core)&#xff0c;内存至少4G。 修改主机名和配置ip地址 hostnamectl set-hostname <hostname> 关闭主机的防火墙 # 关闭防火墙 systemctl stop firewalld #临时关闭防火墙 systemctl disable firewalld …...

openEuler ARM使用vdbench50407

openEuler ARM 使用 vdbench50407 系统信息&#xff1a;openEuler 22.03 (LTS-SP4) Linux 5.10.0-216.0.0.115.oe2203sp4.aarch64 1. 软件包获取 vdbench src https://www.oracle.com/downloads/server-storage/vdbench-source-downloads.htmlvdbench bin https://www.oracle.…...

如何使用 JPA 实现分页查询并返回 VO 对象

JPA分页踩坑指南 1.原生sql查询返回vo类包含主键id&#xff0c;无法自动映射&#xff0c;需要用到投影ResultTransformer&#xff0c;所以我定义了一个投影工具类 JpaCommonService 2.异步调用原生查询方法的时候&#xff0c;需要用 NativeQuery<?> query entityMa…...

【SQL Server】教材数据库(1)

1 利用sql建立教材数据库&#xff0c;并定义以下基本表&#xff1a; 学生&#xff08;学号&#xff0c;年龄&#xff0c;性别&#xff0c;系名&#xff09; 教材&#xff08;编号&#xff0c;书名&#xff0c;出版社编号&#xff0c;价格&#xff09; 订购&#xff08;学号…...

cmake学习_incomplete

文章目录 cmake使用举例cmake示例模板编译时库查找基础知识模块模式导入目标 交叉编译配置基础知识模板实际使用 使用实例链接库解决符号冲突 参考资料 老规矩&#xff0c;先放官方文档 如何构建从互联网下载的源代码包:User Interaction Guide 想使用第三方库的开发者:Using …...

过度与动画的区别?

过渡&#xff08;Transition&#xff09;&#xff1a; 过渡效果是由元素的状态变化触发的&#xff0c;例如&#xff1a;当鼠标悬停在某个元素上、或当某个 CSS 属性值发生改变时。 必须指定起始状态和结束状态。过渡会在两者之间自动平滑过渡。 过渡的触发通常是用户交互或通过…...

tcpdump指南(1)

大家读完觉得有意义记得关注和点赞&#xff01;&#xff01;&#xff01; tcpdump是一种在网络上转储流量的网络工具。 这篇文章服务器作为一些常用命令的指南。如需完整指南&#xff0c; 请参阅手册页&#xff0c;或在 Linux 计算机上。man tcpdump 1 基本选项 帮助摘要&#…...

Linux(Centos 7.6)网卡信息没有了问题处理

1.问题现象 虚拟机打开后&#xff0c;使用ifconfig查看IP信息&#xff0c;虚拟机默认的网卡名称是ens33&#xff0c;ifconfig没有看到相关问题&#xff0c;远程连接工具Xshell也不能正常访问该虚拟机。 [rootnode1 ~]# ifconfig lo: flags73<UP,LOOPBACK,RUNNING> mtu…...

基于SpringBoot的校园二手交易平台的设计与实现(源码+SQL+LW+部署讲解)

文章目录 摘 要1. 第1章 选题背景及研究意义1.1 选题背景1.2 研究意义1.3 论文结构安排 2. 第2章 相关开发技术2.1 前端技术2.2 后端技术2.3 数据库技术 3. 第3章 可行性及需求分析3.1 可行性分析3.2 系统需求分析 4. 第4章 系统概要设计4.1 系统功能模块设计4.2 数据库设计 5.…...

springboot523基于Spring Boot的大学校园生活信息平台的设计与实现(论文+源码)_kaic

摘 要 现代经济快节奏发展以及不断完善升级的信息化技术&#xff0c;让传统数据信息的管理升级为软件存储&#xff0c;归纳&#xff0c;集中处理数据信息的管理方式。本大学校园生活信息平台就是在这样的大环境下诞生&#xff0c;其可以帮助管理者在短时间内处理完毕庞大的数据…...

week05_nlp大模型训练·词向量文本向量

1、词向量训练 1.1 CBOW&#xff08;两边预测中间&#xff09; 一、CBOW 基本概念 CBOW 是一种用于生成词向量的方法&#xff0c;属于神经网络语言模型的一种。其核心思想是根据上下文来预测中心词。在 CBOW 中&#xff0c;输入是目标词的上下文词汇&#xff0c;输出是该目标…...

FreeRTOS Lwip Socket APi TCP Server 1对多

源文件 /********************************************************************************* file lwip_tcp_driver.cpp* brief TCP Server implementation using LwIP******************************************************************************* at…...

SonarQube相关的maven配置及使用

一、maven 全局配置 <settings><pluginGroups><pluginGroup>org.sonarsource.scanner.maven</pluginGroup></pluginGroups><profiles><profile><id>sonar</id><activation><activeByDefault>true</acti…...

【蓝桥杯选拔赛真题87】python输出字符串 第十五届青少年组蓝桥杯python选拔赛真题 算法思维真题解析

目录 python输出字符串 一、题目要求 1、编程实现 2、输入输出 二、算法分析 三、程序编写 四、程序说明 五、运行结果 六、考点分析 七、 推荐资料 1、蓝桥杯比赛 2、考级资料 3、其它资料 python输出字符串 第十五届蓝桥杯青少年组python比赛选拔赛真题详细解析…...

嵌入式开发中的机器人表情绘制

机器人的表情有两种&#xff0c;一种是贴图&#xff0c;一钟是调用图形API自绘。 贴图效果相对比较好&#xff0c;在存储空间大的情况下是可以采用的。 自绘比较麻烦&#xff0c;但在资源和空缺少的情况下&#xff0c;也是很有用的。而且自绘很容易通过调整参数加入随机效果&…...

本机实现Llama 7B推理及部署

本机实现Llama 7B推理及部署 使用llamafile在Windows系统部署 部署步骤:首先从https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=llamafile-0.6.2.win.zip下载llamafile并解压得到llamafile.exe文件, 再从https://www.…...

HarmonyOS NEXT 实战之元服务:静态案例效果---我的热门应用服务

背景&#xff1a; 前几篇学习了元服务&#xff0c;后面几期就让我们开发简单的元服务吧&#xff0c;里面丰富的内容大家自己加&#xff0c;本期案例 仅供参考 先上本期效果图 &#xff0c;里面图片自行替换 效果图1完整代码案例如下&#xff1a; Index import { authentica…...

二十三种设计模式-工厂方法模式

工厂方法模式是一种创建型设计模式&#xff0c;其核心思想是通过定义一个创建对象的接口&#xff0c;让子类决定实例化哪一个类。工厂方法模式将对象的实例化推迟到子类中进行&#xff0c;从而使得扩展变得容易&#xff0c;而不需要修改现有的代码&#xff0c;符合开闭原则&…...

硬件工程师面试题 21-30

把常见的硬件面试题进行总结&#xff0c;方便及时巩固复习。其中包括网络上的资源、大佬们的大厂面试题&#xff0c;其中可能会题目类似&#xff0c;加强印象即可。 更多硬件面试题&#xff1a;硬件工程师面试题 1-10硬件工程师面试题 11-20 21、单片机最小系统需要什么&#x…...

深度学习中的HTTP:从请求到响应的计算机网络交互

在现代深度学习应用中&#xff0c;HTTP&#xff08;超文本传输协议&#xff09;不仅仅是网页浏览的基础协议&#xff0c;它也在机器学习和人工智能的服务架构中扮演着至关重要的角色。本文将深入探讨HTTP在深度学习中的应用&#xff0c;并阐明它如何支持模型的训练、推理及API服…...

基于submitit实现Python函数的集群计算

一、项目介绍 Submitit是一款轻量级工具&#xff0c;旨在简化Python函数在Slurm集群上的提交过程。它不仅提供了对作业结果、日志文件等的无缝访问&#xff0c;更让开发者能够在本地执行与Slurm集群间切换自如&#xff0c;极大地提高了代码的可移植性和灵活性。 Slurm作为一种…...

开源GTKSystem.Windows.Forms框架:C# Winform跨平台运行深度解析

开源GTKSystem.Windows.Forms框架&#xff1a;C# Winform跨平台运行深度解析 一、跨平台框架的崛起 1.1 跨平台技术的现状与需求 在当今快速发展的科技时代&#xff0c;软件开发的需求日益多样化。随着移动设备和操作系统的不断涌现&#xff0c;开发者面临着前所未有的挑战&…...

uniapp Stripe 支付

引入 Stripe npm install stripe/stripe-js import { loadStripe } from stripe/stripe-js; Stripe 提供两种不同类型组件 Payment Element 和 Card Element&#xff1a;如果你使用的是 Payment Element&#xff0c;它是一个更高级别的组件&#xff0c;能够自动处理多种支…...

虚拟机用网线连其他设备(ROS多机网络配置)

电脑配置 把局域网的网线插入电脑&#xff0c;点击这边 配置以太网的IP 比如说我ROS主机的IP想设为192.168.144.10&#xff0c;那我笔记本的以太网IP可以设为192.168.144.8。 假设还有另外一个电脑&#xff08;ROS从机&#xff09;&#xff0c;他的IP被设置未192.168.144.4…...

20241218-信息安全理论与技术复习题

20241218-信息安全理论与技术复习题 一、习题1 信息安全的基本属性是&#xff08;D )。 A、机密性 B、可用性 C、完整性 D、上面 3 项都是 “会话侦听和劫持技术” 是属于&#xff08;B&#xff09;的技术。 A、 密码分析还原 B、 协议漏洞渗透 C、 应用漏洞分析与渗透 D、 D…...

家谱管理系统|Java|SSM|VUE| 前后端分离

【技术栈】 1⃣️&#xff1a;架构: B/S、MVC 2⃣️&#xff1a;系统环境&#xff1a;Windowsh/Mac 3⃣️&#xff1a;开发环境&#xff1a;IDEA、JDK1.8、Maven、Mysql5.7 4⃣️&#xff1a;技术栈&#xff1a;Java、Mysql、SSM、Mybatis-Plus、VUE、jquery,html 5⃣️数据库…...

音频进阶学习九——离散时间傅里叶变换DTFT

文章目录 前言一、DTFT的解释1.DTFT公式2.DTFT右边释义1&#xff09; 复指数 e − j ω n e^{-j\omega n} e−jωn2&#xff09;序列与复指数相乘 x [ n ] ∗ e − j ω n x[n]*e^{-j\omega n} x[n]∗e−jωn复指数序列复数的共轭正交正交集 3&#xff09;复指数序列求和 3.DTF…...

pytorch 计算图中的叶子节点介绍

1. 什么是叶子节点&#xff1f; 在 PyTorch 的自动微分机制中&#xff0c;叶子节点&#xff08;leaf node&#xff09; 是计算图中&#xff1a; 由用户直接创建的张量&#xff0c;并且它的 requires_gradTrue。这些张量是计算图的起始点&#xff0c;通常作为模型参数或输入变…...

CSS系列(42)-- Backdrop Filter详解

前端技术探索系列&#xff1a;CSS Backdrop Filter详解 &#x1f3a8; 致读者&#xff1a;探索背景滤镜的艺术 &#x1f44b; 前端开发者们&#xff0c; 今天我们将深入探讨 CSS Backdrop Filter&#xff0c;这个强大的视觉效果特性。 基础效果 &#x1f680; 模糊效果 /…...

【文献精读笔记】Explainability for Large Language Models: A Survey (大语言模型的可解释性综述)(一)

****非斜体正文为原文献内容&#xff08;也包含笔者的补充&#xff09;&#xff0c;灰色块中是对文章细节的进一步详细解释&#xff01; 三、传统微调范式&#xff08;Traditional Fine-Tuning Paradigm&#xff09; 在这个范式中&#xff0c;首先在大量未标记的文本数据上预…...

ChatGPT 与 AGI:人工智能的当下与未来走向全解析

在人工智能的浩瀚星空中&#xff0c;AGI&#xff08;通用人工智能&#xff09;无疑是那颗最为璀璨且备受瞩目的星辰。OpenAI 对 AGI 的定义为“在最具经济价值的任务中超越人类的高度自治系统”&#xff0c;并勾勒出其发展的五个阶段&#xff0c;当下我们大多处于以 ChatGPT 为…...

Redis - 1 ( 11000 字 Redis 入门级教程 )

一&#xff1a;服务端高并发分布式结构演进之路 1.1 常见概念 概念定义生活例子类比应用&#xff08;Application&#xff09;/ 系统&#xff08;System&#xff09;为完成一整套服务的程序或一组相互配合的程序群。为完成一项任务而组成的由一个人或一群相互配合的人构成的团…...

python opencv的sift特征检测(Scale-Invariant Feature Transform)

sift 官方文档地址&#xff1a;https://docs.opencv.org/4.10.0/da/df5/tutorial_py_sift_intro.html 创建SIFT实例cv2.SIFT.create()特征检测sift.detect描述子sift.compute/sift.detectAndCompute画特征cv2.drawKeypoints 原图 特征点 代码 import cv2first ./12.pngsif…...

Xilinx FPGA的Bitstream比特流加密设置方法

关于Xilinx FPGA的Bitstream比特流加密设置方法更多信息可参阅应用笔记xapp1084。 使用加密bitstream分两个步骤&#xff1a; 将bitstream的AES密钥存储在FPGA芯片内将使用AES密钥加密的Bitstream通过SPI Flash或JTAG加载至FPGA芯片 AES密钥可以存储在两个存储区之一&#x…...

如何通过深度学习提升大分辨率图像预测准确率?

随着科技的不断进步&#xff0c;图像处理在各个领域的应用日益广泛&#xff0c;特别是在医疗影像、卫星遥感、自动驾驶、安防监控等领域中&#xff0c;大分辨率图像的使用已经成为了一项不可或缺的技术。然而&#xff0c;大分辨率图像带来了巨大的计算和存储压力&#xff0c;同…...

Oracle SqlPlus常用命令简介

参考资料 【SQL*Plus】SETシステム変数の設定前後の具体例 目录 一. 执行系命令1.1 执行系统命令1.2 执行sql脚本文件1.2.1 在数据库中执行sql脚本1.2.2 通过sqlplus执行sql脚本 二. show命令2.1 显示SqlPlus中的全部环境变量2.2 显示指定环境变量的设置 三. 时间显示3.1 set …...