import request from '/@/utils/request';

export interface AccountParams {
	datasetIds: number[];
	documentIds: number[];
	accountCode: string;
	accountName?: string;
	status?: number;
	greeting?: string;
	keywordOption?: string[];
	selfIdentity?: string;
	platform: string;
}

export interface AccountListParams {
	pageNum?: number;
	pageSize?: number;
	accountCode?: string;
	accountName?: string;
	status?: number;
	platform?: string;
}

export interface AccountDetailParams {
	id: number;
}

//获取客服账号列表
export function getAccountList(data: AccountListParams) {
	return request({
		url: '/customer-server/account/list',
		method: 'get',
		params: data,
	});
}

//获取客服账号详情
export function getAccountOne(params: AccountDetailParams) {
	return request({
		url: '/customer-server/account/getOne',
		method: 'get',
		params: params,
	});
}

//添加客服账号
export function addAccount(data: AccountParams) {
	return request({
		url: '/customer-server/account/add',
		method: 'post',
		data: data,
	});
}

//更新客服账号
export function updateAccount(data: AccountParams & { id: number }) {
	return request({
		url: '/customer-server/account/update',
		method: 'post',
		data: data,
	});
}

//删除客服账号
export function deleteAccount(data: { id: number }) {
	return request({
		url: '/customer-server/account/delete',
		method: 'post',
		data: data,
	});
}

//获取RAGFlow配置（提示词）
export function getRAGFlowConfig(params: object) {
	return request({
		url: '/customer-server/ragflow/config/get',
		method: 'get',
		params: params,
	});
}

//更新提示词
export function updatePrompt(data: object) {
	return request({
		url: '/customer-server/ragflow/config/updatePrompt',
		method: 'post',
		data: data,
	});
}
