Skip to content

PostChat对话变量

如果使用插件无需关心变量

插件已经集成变量,无需手动添加和调整。可以在对应插件的设置界面进行调整。

PostChat参数包裹在PostChat变量中。例如:

js
var postChatConfig = {
  backgroundColor: "#3e86f6",
  bottom: "16px"
}

所有参数均为可选参数,都可以不填写

userMode

用户唤起聊天的方式,分别有iframemagic两个模式。

magic模式更加现代,是直接执行在网页中的。

iframe模式兼容性更好,并且支持聊天历史记录,适合有比较重的聊天任务和长期高频使用场景。

js
var postChatConfig = {
  userMode: "magic"
}

defaultInput

此参数为true时,用户点击按钮后会自动添加本页面标题,让用户更方便的询问关于本页的内容

js
var postChatConfig = {
  defaultInput: "在Heo站点中,"
}

left

按钮距离左侧的边距,如果填写负值,则是距离右侧的边距。例如left为-3px,实际为right 3px

js
var postChatConfig = {
  left: "3px"
}

backgroundColor / fill / width / height

这些参数用来调整按钮尺寸与色彩

js
var postChatConfig = {
  backgroundColor: "#000000",
  fill: "#ffffff",
  width: '44px',
  height: '44px'
}

frameWidth / frameHeight(仅在iframe模式下有效)

显示的对话窗口大小,frameWidth为宽度,frameHeight为高度

js
var postChatConfig = {
  frameWidth: "200px",
  frameHeight: "600px"
}

upLoadWeb

是否上传当前页面内容到知识库,true为上传,推荐开启。开启后,任意用户访问网页都会将网页内容发送到知识库,无需人工干预即可上传。上传内容为文章所有文字内容,上限2000字,取前1000和后1000字。

js
var postChatConfig = {
  upLoadWeb: true
}

是否用户点击PostChat对话中的图标后会通过邀请链接进入PostChat,通过这种方式邀请的好友如果开通了会员,可以获得会员时长奖励。如果不填写此参数,默认为false。

js
var postChatConfig = {
  showInviteLink: false
}

userTitle

此参数填写你要自定义的PostChat界面标题

js
var postChatConfig = {
  userTitle: "PostChat"
}

userDesc

此参数填写你要自定义的PostChat聊天界面描述

js
var postChatConfig = {
  userDesc: "PostChat智能助手"
}

userIcon(仅在Magic模式下有效)

此参数可以更改聊天AI的图标

js
var postChatConfig = {
  userIcon: "https://example.com/1.png"
}

defaultChatQuestions / defaultSearchQuestions(仅在Magic模式下有效)

此参数可以设置默认问题

js
var postChatConfig = {
  defaultChatQuestions: ["你好","你是谁","你是做什么的","你有什么功能","你有什么用"],
  defaultSearchQuestions: ["视频压缩","制作黄焖鸡"]
}

addButton

此参数为是否显示按钮,true为显示,false为不显示。建议将前面编辑按钮的参数设置得与你自己创造的按钮的参数相同,以便更好的计算窗口宽高和位置。

js
var postChatConfig = {
  addButton: true
}

blackDom(仅开启聊天助手,未开启文章摘要时有效)

此参数填写你要屏蔽掉的容器内容,比如你在网页中插入了aplayer,为了避免提交的内容包含aplayer的歌词信息,你需要将包含aplayer的元素用选择器的方式屏蔽掉。

js
var postChatConfig = {
  blackDom: [".aplayer","#content"]
}

systemType

此参数用于适配url地址为纯参数非静态化地址的系统而使用,例如Discuz、emlog等。一般插件会处理此参数,如果url地址并非纯参数化地址,可以忽略。

js
var postChatConfig = {
  systemType: "Discuz"
}