当前位置: 首页 > 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…...

30分钟搭建 Typecho 个人博客教程

Typecho是一款PHP博客程序&#xff0c;相比于WordPress&#xff0c;Typecho显得更加的轻量级和简洁。现在越来越多的人倾向于用Typecho来搭建个人博客——众所周知&#xff0c;能跑WordPress的机器都不便宜。 Typecho是一款国人团结打造的开源博客系统&#xff0c;和WordPress…...

智能工厂的设计软件 应用场景的一个例子:为AI聊天工具添加一个知识系统 之7 附件(文档)

为AI聊天工具添加一个知识系统 Part1 人性化&去中心化 前情提要 这一次我们暂时抛开前面对“智能工厂的软件设计”的考虑--其软件智能 产品就是 应用程序。直接将这些思维方式和方法论 运用在其具体应用场景中。本文是其中的一个应用场景。 今天用了 一个新的AI助手工具…...

鸿蒙应用开发启航计划

以前有过简单的学习了解&#xff0c;但是现在工作内容的原因&#xff0c;要专门搞这个&#xff0c;因此需要更加熟练地掌握鸿蒙应用开发。 1.开发IDE -- DevEco Studio Windows环境 运行环境要求 为保证DevEco Studio正常运行&#xff0c;建议电脑配置满足如下要求&#xff…...

基本算法——回归

目录 创建工程 加载数据 分析属性 创建与评估回归模型 线性回归 回归树 评估 完整代码 结论 本节将通过分析能源效率数据集&#xff08;Tsanas和Xifara&#xff0c;2012&#xff09;学习基本的回归算法。我们将基 于建筑的结构特点&#xff08;比如表面、墙体与屋顶面…...

深度学习——神经网络中前向传播、反向传播与梯度计算原理

一、前向传播 1.1 概念 神经网络的前向传播&#xff08;Forward Propagation&#xff09;就像是一个数据处理的流水线。从输入层开始&#xff0c;按照网络的层次结构&#xff0c;每一层的神经元接收上一层神经元的输出作为自己的输入&#xff0c;经过线性变换&#xff08;加权…...

解决git push报错:not valid: is this a git repository?

今天想把代码更新到仓库里&#xff0c;执行git push origin master:main的时候报错&#xff1a;not valid: is this a git repository? 查了好多方法都没用。后来经过这篇文章的启发&#xff1a;https://zhuanlan.zhihu.com/p/301518109 可能是由于校园网的问题&#xff0c;…...

树形查询转成TreeNode[],添加新节点

在使用PrimeVue的TreeTable组件时&#xff0c;需要将带有层级的数据转换为TreeNode[]类型的数据结构。TreeNode是PrimeVue中定义的一个接口&#xff0c;用于表示树节点。通常&#xff0c;带有层级的数据是一个嵌套的对象或数组&#xff0c;其中每个对象可能包含子对象&#xff…...

【Rust自学】8.2. Vector + Enum的应用

8.2.0. 本章内容 第八章主要讲的是Rust中常见的集合。Rust中提供了很多集合类型的数据结构&#xff0c;这些集合可以包含很多值。但是第八章所讲的集合与数组和元组有所不同。 第八章中的集合是存储在堆内存上而非栈内存上的&#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}}: 得到 再构造…...

vmware 修改Ubuntu终端字体大小

1. 2、 3、 4、 5、 6、点击select...

API 设计:从基础到最佳实践

https://levelup.gitconnected.com/api-design-101-from-basics-to-best-practices-a0261cdf8886 在本次深入研究中&#xff0c;我们将从基础开始&#xff0c;逐步了解 API 设计&#xff0c;并逐步实现定义卓越 API 的最佳实践。 作为开发人员&#xff0c;您可能熟悉其中的许多…...

ROUGE指标在自然语言处理中的应用:从理论到实践

引言 你是否曾经遇到过机器生成的文本摘要与原文内容不符的情况&#xff1f;或者在使用机器翻译时&#xff0c;发现译文虽然“看起来”正确&#xff0c;但语义却与原文相差甚远&#xff1f;在自然语言处理&#xff08;NLP&#xff09;领域&#xff0c;如何科学地评估生成文本的…...

GraalVM:云原生时代的Java虚拟机

1. 概述 GraalVM是由Oracle公司开发的一款高性能、多语言的虚拟机平台。它不仅兼容传统的JVM字节码执行&#xff0c;还引入了即时编译&#xff08;JIT&#xff09;技术的革新&#xff0c;以及对多种编程语言的支持。GraalVM旨在通过提供更高效的执行环境来满足云计算环境中日益…...

Linux 信号集与信号掩码

目录 一、引言 二、信号集是什么 三、信号集关键函数 1.信号集的创建与初始化 2.信号的添加与删除 3.信号集的阻塞与解除阻塞 四、信号集实际应用场景 五、信号掩码的作用 六、信号掩码相关函数 1.sigprocmask 函数 2.sigemptyset 和 sigfillset 函数 七、信号掩码注…...

如何设置Edge浏览器访问软件

使用Edge浏览器访问分销ERP A\V系列软件时会出现各种报错&#xff0c;如何设置Edge浏览器使其正常访问&#xff0c;请看下面的具体操作。 一、打开Edge浏览器&#xff0c;点击右上角的 设置及其他&#xff0c;如图&#xff1a; 二、在弹出界面中&#xff0c;点击 扩展&#xff…...

DL笔记:旋转编码RoPE

1 背景 由于计算资源限制&#xff0c;目前的LLM大多在较短的上下文长度中进行训练&#xff0c;在推理中&#xff0c;如果超出预训练的长度&#xff0c;模型的性能将会显著降低 ——>需要一个可提供外推性的位置编码最经典的绝对位置编码就是原始Transformer中的那个sinusoi…...

C语言自定义类型与文件操作

构造类型 枚举类型 若定义不相关的常量使用宏定义&#xff1b;若定义一组相关的常量使用枚举。switch中case后访问的就是枚举。 定义&#xff1a; 我们一般情况下定义常量使用宏定义(#define)&#xff0c;宏定义适合没有关联关系的常量&#xff1b;但有时需要对一组有关联关系…...

《计算机网络A》单选题-复习题库解析-3

目录 106、MAN通常是指&#xff08; &#xff09; 107、下列因素中&#xff0c;不会影响信道数据传输速率的是&#xff08; &#xff09; 108、以太网交换机进行转发决策时使用的PDU地址是&#xff08; &#xff09; 109、下列机制中&#xff0c;可以解决因数据帧丢失而…...

VM虚拟机配置ubuntu网络

目录 桥接模式 NAT模式 桥接模式 特点&#xff1a;ubuntu的IP地址与主机IP的ip地址不同 第一部分&#xff1a;VM虚拟机给ubuntu的网络适配器&#xff0c;调为桥接模式 第二部分&#xff1a;保证所桥接的网络可以上网 第三部分&#xff1a;ubuntu使用DHCP&#xff08;默认&…...

基于uniapp+WebSocket实现聊天对话、消息监听、消息推送、聊天室等功能,多端兼容

基于 ​UniApp + WebSocket​实现多端兼容的实时通讯系统,涵盖WebSocket连接建立、消息收发机制、多端兼容性配置、消息实时监听等功能,适配​微信小程序、H5、Android、iOS等终端 目录 技术选型分析WebSocket协议优势UniApp跨平台特性WebSocket 基础实现连接管理消息收发连接…...

条件运算符

C中的三目运算符&#xff08;也称条件运算符&#xff0c;英文&#xff1a;ternary operator&#xff09;是一种简洁的条件选择语句&#xff0c;语法如下&#xff1a; 条件表达式 ? 表达式1 : 表达式2• 如果“条件表达式”为true&#xff0c;则整个表达式的结果为“表达式1”…...

【决胜公务员考试】求职OMG——见面课测验1

2025最新版&#xff01;&#xff01;&#xff01;6.8截至答题&#xff0c;大家注意呀&#xff01; 博主码字不易点个关注吧,祝期末顺利~~ 1.单选题(2分) 下列说法错误的是:&#xff08; B &#xff09; A.选调生属于公务员系统 B.公务员属于事业编 C.选调生有基层锻炼的要求 D…...

佰力博科技与您探讨热释电测量的几种方法

热释电的测量主要涉及热释电系数的测定&#xff0c;这是表征热释电材料性能的重要参数。热释电系数的测量方法主要包括静态法、动态法和积分电荷法。其中&#xff0c;积分电荷法最为常用&#xff0c;其原理是通过测量在电容器上积累的热释电电荷&#xff0c;从而确定热释电系数…...

【Go语言基础【12】】指针:声明、取地址、解引用

文章目录 零、概述&#xff1a;指针 vs. 引用&#xff08;类比其他语言&#xff09;一、指针基础概念二、指针声明与初始化三、指针操作符1. &&#xff1a;取地址&#xff08;拿到内存地址&#xff09;2. *&#xff1a;解引用&#xff08;拿到值&#xff09; 四、空指针&am…...

【Linux】Linux 系统默认的目录及作用说明

博主介绍&#xff1a;✌全网粉丝23W&#xff0c;CSDN博客专家、Java领域优质创作者&#xff0c;掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域✌ 技术范围&#xff1a;SpringBoot、SpringCloud、Vue、SSM、HTML、Nodejs、Python、MySQL、PostgreSQL、大数据、物…...

【学习笔记】erase 删除顺序迭代器后迭代器失效的解决方案

目录 使用 erase 返回值继续迭代使用索引进行遍历 我们知道类似 vector 的顺序迭代器被删除后&#xff0c;迭代器会失效&#xff0c;因为顺序迭代器在内存中是连续存储的&#xff0c;元素删除后&#xff0c;后续元素会前移。 但一些场景中&#xff0c;我们又需要在执行删除操作…...

【Kafka】Kafka从入门到实战:构建高吞吐量分布式消息系统

Kafka从入门到实战:构建高吞吐量分布式消息系统 一、Kafka概述 Apache Kafka是一个分布式流处理平台,最初由LinkedIn开发,后成为Apache顶级项目。它被设计用于高吞吐量、低延迟的消息处理,能够处理来自多个生产者的海量数据,并将这些数据实时传递给消费者。 Kafka核心特…...

Android写一个捕获全局异常的工具类

项目开发和实际运行过程中难免会遇到异常发生&#xff0c;系统提供了一个可以捕获全局异常的工具Uncaughtexceptionhandler&#xff0c;它是Thread的子类&#xff08;就是package java.lang;里线程的Thread&#xff09;。本文将利用它将设备信息、报错信息以及错误的发生时间都…...

如何把工业通信协议转换成http websocket

1.现状 工业通信协议多数工作在边缘设备上&#xff0c;比如&#xff1a;PLC、IOT盒子等。上层业务系统需要根据不同的工业协议做对应开发&#xff0c;当设备上用的是modbus从站时&#xff0c;采集设备数据需要开发modbus主站&#xff1b;当设备上用的是西门子PN协议时&#xf…...