import request from '@/utils/request'
import defaultSettings from '@/settings'

// 获取Access_token
export function getAccessToken(query) {
    return request({
        // url: 'https://aip.baidubce.com/oauth/2.0/token',
		url: defaultSettings.baidubceUrl + '/oauth/2.0/token',
        method: 'get',
		params: query,
    })
}

// 对话接口
export function requestChat(data) {
    return request({
        // url: 'https://aip.baidubce.com/rpc/2.0/unit/service/chat',
		// url: defaultSettings.baidubceUrl + '/rpc/2.0/unit/bot/chat',
		url: defaultSettings.baidubceUrl + '/rpc/2.0/unit/service/chat',
		// url: defaultSettings.baidubceUrl + '/rpc/2.0/unit/service/v3/chat',
        method: 'post',
		params: {
			"access_token":data&&data.access_token
		},
        data: data
    })
}
// 对话接口
export function wssChat(data) {
    return request({
		url: '/baidu-chat/aichat/api/conversation',
        method: 'post',
        data: data
    })
}