http://192.168.1.5:9580/client-apiVITE_API_SECRET 中配置所有API请求需要包含以下头部信息:
h-timestamph-signaccess-auth-token (可选,从localStorage获取)签名生成规则:
// 1. 将请求参数按ASCII码排序
// 2. 拼接排序后的参数值
// 3. 在末尾添加API密钥
// 4. 对拼接后的字符串进行MD5加密并转为大写
interface ResponseData<T = any> {
code: number, // 状态码,200表示成功
data: T, // 响应数据
message: string // 响应消息
}
GET /v1/websiteSet/selWebsiteSet响应数据:
type Basic = {
competentUnit: string, // 主管单位
organizer: string, // 承办单位
icpRecord: string, // ICP备案
websiteIdentifier: string, // 网站标识码
securityRecord: string, // 网安备案号
officeHours: string, // 办公时间
officeAddress: string, // 办公地址
dutyPhone: string, // 值班电话
fax: string, // 传真
reportPhone: string, // 举报电话
reportMail: string, // 举报信件
serviceHotline: string, // 服务热线
miniAppQrcodeUrl: string, // 小程序二维码URL
miniAppLink: string, // 小程序链接URL
policyFileUrl: string, // 政策文件
urlLink: string, // 小程序链接 URLLink
shortLink: string, // 小程序链接 ShortLink
}
POST /v1/chat/likeOrStepOn请求参数:
type likeOrStepParams = {
chatId: string, // 聊天ID
likeOrStepOn: number // 1:点赞, 2:踩
}
响应数据: null
GET /v1/chat/sendMsg请求参数:
type streamChatParams = {
message: string, // 消息内容
conversationId: string // 对话ID
}
请求头:
Content-Type: text/event-stream; charset=utf-8
h-timestamp: [时间戳]
h-sign: [签名]
响应事件类型:
conversation.chat.created: 创建对话
{
"event": {"value": "conversation.chat.created"},
"chat": {
"id": "聊天ID",
"conversationID": "对话ID"
}
}
conversation.message.delta: 消息增量
{
"event": {"value": "conversation.message.delta"},
"message": {
"content": "消息内容片段"
}
}
conversation.chat.completed: 对话完成
{
"event": {"value": "conversation.chat.completed"}
}
conversation.message.completed: 消息完成
{
"event": {"value": "conversation.message.completed"},
"message": {
"content": "完整消息内容",
"contentType": {"value": "text|card"}
}
}
GET /v1/serviceGuide/guideCategory响应数据:
type CategoryResult = categoryItem[]
interface categoryItem {
id: number, // 分类ID
categoryName: string, // 分类名称
imgUrl: string, // 分类图片URL
profile: string, // 分类简介
profileWap: string, // 移动端分类简介
}
GET /v1/serviceGuide/guideItem请求参数:
type ServiceParams = {
categoryId: number|string, // 分类ID
pageNum: number, // 页码
pageSize: number // 每页数量
}
响应数据:
type ServiceResult = {
total: number, // 总记录数
size: number, // 每页数量
current: number, // 当前页码
pages: number, // 总页数
records: ServiceContent[], // 记录列表
success: boolean, // 是否成功
message: string // 消息
}
interface ServiceContent {
itemContent: string // 服务内容
}
GET /v1/questions/selCommonQuestionsRandom请求参数:
type CommonProblemParams = {
pageNum: number, // 页码
pageSize: number, // 每页数量
keyword: string // 关键词
}
响应数据:
type CommonProblemResult = {
total: number, // 总记录数
size: number, // 每页数量
current: number, // 当前页码
pages: number, // 总页数
records: CommonProblemList[], // 记录列表
success: boolean, // 是否成功
message: string // 消息
}
type CommonProblemList = commonProblemItem[]
interface commonProblemItem {
questionContent: string, // 问题内容
remark: string | null, // 备注
}
POST /v1/chat/textToSpeech请求参数:
type TextToSpeechParams = {
text: string // 要转换的文字
}
响应数据:
type TextToSpeechResult = {
audioUrl: string // 语音文件URL
}
超时时间: 300秒
POST /v1/chat/transcribefile响应数据:
type TranscribeResult = {
text: string // 识别后的文字
}
超时时间: 300秒
GET /v1/chat/getFeedbackToken请求头:
Authorization: xT5v2pA7eJ9rL0fD3gH8kM4nZ6bW2cY
响应数据: 令牌字符串
POST /v1/feedback/subFeedback请求参数:
type OpinionParams = {
feedbackContent: string, // 反馈内容
phone: string, // 联系电话
}
响应数据: null
{
"code": 400,
"data": null,
"message": "参数错误"
}