import http from './axios'
|
|
/**
|
* 对话分组(用户自建的文件夹)。
|
*
|
* 与「今天 / 昨天 / 更早」的时间分组无关:那是前端按时间算出来的视图归类,
|
* 这里是存在数据库里、用户可以命名和增删的实体。
|
*/
|
|
/** 当前用户的全部分组(含每个分组的会话数) */
|
export function listChatGroups() {
|
return http.get('/chat-groups')
|
}
|
|
/** 新建分组 */
|
export function createChatGroup(name) {
|
return http.post('/chat-groups', { name })
|
}
|
|
/** 重命名分组 */
|
export function renameChatGroup(groupId, name) {
|
return http.put(`/chat-groups/${groupId}`, { name })
|
}
|
|
/**
|
* 删除分组。
|
*
|
* 只解除分组关系,**不会删除组内会话** —— 它们会回到「未分组」。
|
* 返回值里带 movedChats(被移出的会话数),用于给用户一句明确的提示。
|
*/
|
export function deleteChatGroup(groupId) {
|
return http.delete(`/chat-groups/${groupId}`)
|
}
|